/* this file sets up all the javascript and plugins for the page */

$(function(){ 
/* sets up superfish for the dropdown menus */
	$("ul.sf-menu").superfish(); 

/* this takes the right border off the last item in every menu list */
	$("ul li:last-child").addClass("last");

/* here's the slideshow controls */
	$('#slideshow_content').cycle({
        speed:       1000,
        timeout:     5000,
        pager:      '#slideshow_nav',
        pagerEvent: 'mouseover'
    });

/* this sets the cookie and controls the slide down effect for the pres nation header
	var duration = 1000;
	var wait = 4000;
	if ( !$.cookie("header_slider_cookie") ) {
		$.cookie("header_slider_cookie", "visited", { expires : 365 } );
		$("#top_programs ul").css( { 'top' : '-98px' } );
		setTimeout(function() {
			$("#top_programs ul").animate( { top : "6px" }, duration);
		}, wait);
	}
	
	*/
	
/* all this does is make the error message look a little nicer and draw a bit more attention to it */
   $('p.ErrorMessage').hide();
   $('p.ErrorMessage').fadeIn('slow');

/* this swaps out the text color and default text in a search box when you click */
	$('#cons_email').text_swap();
	$('#map_location_input').text_swap();
	
/* this sets up the carousel for the footer slideshow */
	$('#footer_carousel').jcarousel({
		scroll: 5,
		wrap: 'both'
	});
	
});  

/* this function swaps out the class and default text of the calling element (i.e. email input form) */
jQuery.fn.text_swap = function() {
	$(this).focus(function() {
		$(this).removeClass("gray_text").addClass("black_text");
		if (this.value == this.defaultValue){
		this.value = '';
	}
	if(this.value != this.defaultValue){
		this.select();
	}
	});
	/* do we need an action on blur? I'll comment it here for safe-keeping */
	$(this).blur(function() {
		$(this).removeClass("black_text").addClass("gray_text");
		/* if (this.value != this.defaultValue){
			this.value = this.defaultValue;
		} */
	}); 
}

