/**
* Set a javascript variable with the value of the href attribute of the base tag. This is used so
* that e.g. calls to swfobject which need to pass in the path to a resource as a flashvar (e.g. an .FLV
* or flash video player skin) can prepend this javascript variable and thus create a complete URL.
*
* Note that this is outside of the document.ready block below. If it's within the block, then all Flash embeds
* using swfobject must be wrapped in document.ready callbacks or baseHref will not be defined. Wrapping them
* in these blocks makes the Flash not begin to load until after the DOM is ready.
*/
baseHref = $("base").attr("href");

$(function()
{
	var timeoutId;

/**
* Product menu hover over/out callback functions
* We use setTimeout calls to induce a slight delay before the menu is shown so that
* users can easily navigate to the items in the menu below the product menu.
*/
	$("div.productMenu").hover(
		function()
		{
			var element = this;
			timeoutId = setTimeout(function() 
			{
				$(element).addClass("hover");
   	        	$(element).children("div").show();
			}, 380);
		},
		function()
		{
			clearTimeout(timeoutId);
			$(this).removeClass("hover");
			$(this).children('div').hide();
		}
	);
	$(".subCategory").hover(function(){
		if($(this).parent().parent().attr("id") == "brats" || $(this).parent().parent().attr("id") == "italian" || $(this).parent().parent().attr("id") == "breakfast"){
			$(this).find(".subCategoryMenu").css({"width":$(this).width()+"px"});
		}
		$(this).addClass("over").find(".subCategoryMenu").show();
	},function(){
		$(this).removeClass("over").find(".subCategoryMenu").hide();	
	});
	//EC Club sign up toggle
	$("a#smallFormToggle").click(function(){
		if($("div#smallEnthusiastClubForm").css("display") == "none"){
			$(this).removeClass("showShortEcForm").addClass("hideShortEcForm");
		}else{
				$(this).removeClass("hideShortEcForm").addClass("showShortEcForm");
		}
		$("div#smallEnthusiastClubForm").slideToggle();		
		return false;
	});
	
	//target="_blank"
	$(".newWindow").click(function(){
		window.open($(this).attr("href"));
		return false;
	});
	
	//bottom other websites toggle
	$("#otherWebSites").click(function(){
		$("#otherSites").slideToggle();
		return false;
	});
});
