/*
 * @description: A namespace to keep global vars clean     
 *               
 * @namespace: HYDRA
 */
var HYDRA = {};

//	once the document is loaded
//
$( document ).ready( function() {


    // set up tabs
    //
    $('.tabs').tabs({fx: {opacity: 'toggle', duration: 150 } });
    
    // resize flash container based on window dimensions
    //
    
    function fix_flash ()
    {
        new_width = $(window).width();
        new_distance = new_width * 0.5;
    
        $('#flash_container').css('width',new_width);
    }
    
    $(window).resize(fix_flash);
    
    
    
    // change color of form inputs on hover
	//
	$('.text_input, .select, textarea')
		.focus(
			function () {
				{
					keyword_color = $(this).css('color');
					$(this).css('color', '#555');
				}
			}
		)
		.blur(
			function () {
					$(this).css('color', keyword_color);
			}
		)
    
    
    
    // Clear and unclear search box on focus and blur
	//
	$('.text_input')
		.focus(
			function () {
				if (
    				$(this).val() == 'Search Asbury Park' ||
    				$(this).val() == 'Your Name' ||
    				$(this).val() == 'Your Email Address'
				)
				{
					stored_value = $(this).val();
					$(this).val('');
				}
			}
		)
		.blur(
			function () {
				if ($(this).val() == '')
				{
					$(this).val(stored_value);
				}
			}
		)
		
    // run flash fix
    //
    fix_flash();
    


	//	removes the flash "click to activate" in ie7...not 6?
	var activeXObjTypes = new Array( "applet", "embed", "object" ); 
	for ( var i = 0; i < activeXObjTypes.length; i++ ) 
	{ 
		var xObj = document.getElementsByTagName( activeXObjTypes[i] ); 
		for( var j = 0; j < xObj.length; j++ ) 
		{ 
			xObj[j].outerHTML = xObj[j].outerHTML; 
		} 
	}    



    // // $('.event_meta').hide()
    // .click(function()
    // {
    //     $(this).slideToggle();
    // });
    // 
    // 
    // 
    
    
    /*
     * @description: Factory for HYDRA.eventTruncater objects    
     *               
     */
    // $('.event_info').each( function()
    // {
    //     var classname       =   $(this).attr('css');
    //     HYDRA[classname]    =   new HYDRA.eventTruncater( $(this) );
    // });
    // 

    
}); //	end of ducument ready



    
    /*
     * @description: truncates event descriptions and adds a "more" link at the end to
     *               
     * @constructor
     *
     */
    // HYDRA.eventTruncater    =   function( jqThis )
    // {
    //     var cc              =   jqThis;
    //     this.characterLimit =   300;
    //     this.characterCount =   0;
    //     this.currentElement =   cc.find('*:not(h2):not(h3):eq(0)');
    //     
    //     
    //     
    //     this.currentElement.css('color', 'red');
    // 
    //     
    //    
    //     
    //     
    //     
    // 
    //     
    //     this.countNext  =   function()
    //     {
    //         while(parseInt(this.characterCount) <= parseInt(this.characterLimit) )
    //         {
    //             this.characterCount += this.currentElement.html().length;
    //             
    //             console.log('charCount= '+ this.characterCount);
    //             // console.log('charlimit= '+ this.characterLimit);           
    //             this.currentElement =   this.currentElement.next();
    //         }
    //         
    //         
    //     };
    //     
    //     
    //     this.countNext()
    //         // cc.find('p:eq(0)').html().length
    //     
    //     
    //     
    //     
    //     
    // }
    // 
    
    
