/*Start Jquery
 * 
 * prepare to get DOM 
 */




jQuery(document).ready(function() {
	AllRolloverImages();
 	Menu.init();
	login.init();
	
	/*variable to determine what the current tab is*/
	var firstSet = 0;
	var menuTimer = 1;
	
	/*guides show/hide categories*/
	
	jQuery(".guide-categories-list").show();
	
    jQuery("#show-categories").click(function () {
		if(jQuery(this).html() == "show categories")
		{
			jQuery(this).html("hide categories");
			jQuery(".guide-categories-list").slideToggle("slow");
		}else{
			jQuery(this).html("show categories");
			jQuery(".guide-categories-list").slideToggle("slow");
		}
		return true;
    });
	
	jQuery("#hideGoogleMap").click(function () {
		if(jQuery(this).html() == "show map")
		{
			jQuery(this).html("hide map");
			jQuery("#richGoogleMap").slideToggle("slow");
		}else{
			jQuery(this).html("show map");
			jQuery("#richGoogleMap").slideToggle("slow");
		}
		return true;
    });
	
	/*guides search usability helper*/
	
	jQuery(".guide-search-keyword").focus(function() {
		if(jQuery(this).val() == "keyword(s)"){
			jQuery(this).val("");
		}
		jQuery(".guide-search-zip-code").val("zip code");
		jQuery(".guide-search-location").val("location");
	})
	jQuery(".guide-search-zip-code").focus(function() {
		if(jQuery(this).val() == "zip code"){
			jQuery(this).val("");
		}
		jQuery(".guide-search-keyword").val("keyword(s)");
		jQuery(".guide-search-location").val("location");
	})
	jQuery(".guide-search-location").focus(function() {
		jQuery(".guide-search-zip-code").val("zip code");
		jQuery(".guide-search-keyword").val("keyword(s)");
	})
	
	/*Add to Calendar Button*/
	
	/*jQuery(".trigger").mouseover(function() {
		jQuery(this).next(".add-to-calendar-links").css("display", "block");
		t = setTimeout(function() {jQuery(".add-to-calendar-links").hide()}, 2250);
	})
	
	jQuery(".add-to-calendar-links").hover(function() {
			clearTimeout(t);
		}, function() {
			clearTimeout(t);
			t = setTimeout(function() {jQuery(".add-to-calendar-links").hide()}, 2250);
		} 
    );*/
	
	
		function addHoverHide(linkClass, layerId) {
			var t;
			jQuery("." + linkClass).click(function() {
					jQuery(this).next("." + layerId).css("display", "block");
					t = setTimeout(function() {jQuery("." + layerId).hide()}, 1250);
				});
				
				jQuery("." + layerId).hover(function() {
						clearTimeout(t);
					}, function() {
						clearTimeout(t);
						t = setTimeout(function() {jQuery("." + layerId).hide()}, 1250);
					});
		}

		  addHoverHide("trigger.1-calendar-count", "add-to-calendar-links.1-calendar-count");
		  addHoverHide("trigger.2-calendar-count", "add-to-calendar-links.2-calendar-count");
		  addHoverHide("trigger.3-calendar-count", "add-to-calendar-links.3-calendar-count");
		  addHoverHide("trigger.4-calendar-count", "add-to-calendar-links.4-calendar-count");
		  addHoverHide("trigger.5-calendar-count", "add-to-calendar-links.5-calendar-count");
		  addHoverHide("trigger.6-calendar-count", "add-to-calendar-links.6-calendar-count");
		  addHoverHide("trigger.7-calendar-count", "add-to-calendar-links.7-calendar-count");
		  addHoverHide("trigger.8-calendar-count", "add-to-calendar-links.8-calendar-count");
		  addHoverHide("trigger.9-calendar-count", "add-to-calendar-links.9-calendar-count");
		  addHoverHide("trigger.10-calendar-count", "add-to-calendar-links.10-calendar-count");
		  
		  addHoverHide("trigger.single-calendar-count", "add-to-calendar-links.single-calendar-count");

	

 });
