// JavaScript Document

//Rotates the top content on the home page betwee
//Home, Grape to Glass, Stewards of the Land and Varietals
lCTopContentRotate={
	show1:function()//Shows Home div 
	{
		
		$("#lCTopContent").css("z-index","10");
		$("#lCTopContent4").css("z-index","3");
		$("#lCTopContent3").hide();
		$("#lCTopContent").show(1000,function(){if(jQuery.browser.msie)
		{
			$("#lCTopContent").get(0).style.removeAttribute('filter');
		}});  
		
		$("#varietalsMainNav").removeClass("active");
					
		//TimerIDArray[0] = setTimeout("lCTopContentRotate.show2()", 8000);
	},
	show2:function() //shows Grape to Glass Div
	{
		$("#lCTopContent2").css("z-index","10");
		$("#lCTopContent").css("z-index","4");
		$("#lCTopContent4").hide();
		$("#lCTopContent2").show(1000,function(){if(jQuery.browser.msie)
		{
			$("#lCTopContent2").get(0).style.removeAttribute('filter');	
		}});
		
		$("#grapeMainNav").toggleClass("active");
		
		//TimerIDArray[1] = setTimeout("lCTopContentRotate.show3()", 8000);
	},
	show3:function() //Shows Stewards of the Land Div
	{		
		$("#lCTopContent3").css("z-index","15");
		$("#lCTopContent2").css("z-index","5");
		$("#lCTopContent1").hide();
		$("#lCTopContent3").show(1000,function(){if(jQuery.browser.msie)
		{
			$("#lCTopContent3").get(0).style.removeAttribute('filter');	
		}});
		
		$("#grapeMainNav").removeClass("active");
		$("#stewardsMainNav").toggleClass("active");
		
		//TimerIDArray[2] = setTimeout("lCTopContentRotate.show4()", 8000);
	},
	show4:function() //Shows varietals div
	{		
		$("#lCTopContent4").css("z-index","20");
		$("#lCTopContent3").css("z-index","10");
		$("#lCTopContent2").hide();
		$("#lCTopContent4").show(1000,function(){if(jQuery.browser.msie)
		{
			$("#lCTopContent4").get(0).style.removeAttribute('filter');	
		}});
		
		$("#stewardsMainNav").removeClass("active");
		$("#varietalsMainNav").toggleClass("active");
		
		//TimerIDArray[3] = setTimeout("lCTopContentRotate.show1()", 8000);
	}
}

//Function for when the top Main div is clicked with Grape To Glass, Stewards of the Land, etc.
var ClickDivRotate={
		jumpToText:function(divClicked)
		{
			$("#grapeMainNav").removeClass("active");
			$("#stewardsMainNav").removeClass("active");
			$("#varietalsMainNav").removeClass("active");
			
			$("#lCTopContent").hide();
			$("#lCTopContent2").hide();
			$("#lCTopContent3").hide();
			$("#lCTopContent4").hide();
			
			$("#lCTopContent").css("z-index","0");
			$("#lCTopContent2").css("z-index","0");
			$("#lCTopContent3").css("z-index","0");
			$("#lCTopContent4").css("z-index","0");
			
			if(divClicked == "home")
			{
				lCTopContentRotate.show1();
			}
			else if(divClicked == "grape")
			{
				lCTopContentRotate.show2();
			}
			else if(divClicked == "stewards")
			{
				lCTopContentRotate.show3();
			}
			else
			{
				lCTopContentRotate.show4();
			}	
				
			return false;
		}
	}
	
/*End the javascript for the top left area of the page
where the 4 divs rotate on click for grape to glass, stewards and varietals */




//Functions to handle the hiding/showing of the Divs on the right side of the screen
// These are the wine country maps.
var $o = "None";

$(document).ready(function (){	
		$("#lCTopContent").css("display","block");
			
		//North Coast  Image Hover on Large Map Animation
		$("#northCoastImgHome").mouseenter(function()
		{
			$('#wineCountryNorthCoast').css('zIndex', 50);
			resetDivs.removeAll();
			$("#wineCountryNorthCoast").fadeIn('normal')
		});
		//When mouse is removed from the larger zoomed in image of North Coast Map
		$('#wineCountryNorthCoast').mouseleave(function()
		{
			resHome.jumpToHome();
			$("#wineCountryNorthCoast").hide();
		});
		
		
		//Sacramento Valley Image Hover on Large Map Animation
		$("#sacValleyImgHome").mouseenter(function()
		{
			$('#wineCountrySacramento').css('zIndex', 50);
			resetDivs.removeAll();
			$("#wineCountrySacramento").fadeIn('normal')
		});
		//When mouse is removed from the larger zoomed in image of North Coast Map
		$('#wineCountrySacramento').mouseleave(function()
		{
			resHome.jumpToHome();
			$("#wineCountrySacramento").hide();
		});
				
				
		//Sierra Foothills  Image Hover on Large Map Animation
		$("#sierraFootImgHome").mouseenter(function()
		{
			$('#wineCountrySierra').css('zIndex', 50);
			resetDivs.removeAll();
			$("#wineCountrySierra").fadeIn('normal')
		});
		//When mouse is removed from the larger zoomed in image of North Coast Map
		$('#wineCountrySierra').mouseleave(function()
		{
			$("#wineCountrySierra").fadeOut('normal');
			resHome.jumpToHome();
		});
		
		
		//Central Coast  Image Hover on Large Map Animation
		$("#centralCoastImgHome").mouseenter(function()
		{
			$('#wineCountryCentralCoast').css('zIndex', 50);
			resetDivs.removeAll();
			$("#wineCountryCentralCoast").fadeIn('normal')
		});
		//When mouse is removed from the larger zoomed in image of North Coast Map
		$('#wineCountryCentralCoast').mouseleave(function()
		{
			$("#wineCountryCentralCoast").hide();
			resHome.jumpToHome();
		});
		
		
		//San Joaquin Image Hover on Large Map Animation
		$("#sanjoaquinImgHome").mouseenter(function()
		{
			$('#wineCountrySanJoaquin').css('zIndex', 50);
			resetDivs.removeAll();
			$("#wineCountrySanJoaquin").fadeIn('normal')
		});
		//When mouse is removed from the larger zoomed in image of North Coast Map
		$('#wineCountrySanJoaquin').mouseleave(function()
		{
			$("#wineCountrySanJoaquin").hide();
			resHome.jumpToHome();
		});
		
		
		//South Coast Image Hover on Large Map Animation
		$("#southCoastImgHome").mouseenter(function()
		{
			$('#wineCountrySouthCoast').css('zIndex', 50);
			resetDivs.removeAll();
			$("#wineCountrySouthCoast").fadeIn('normal')
		});
		//When mouse is removed from the larger zoomed in image of South Coast Map
		$('#wineCountrySouthCoast').mouseleave(function()
		{
			$("#wineCountrySouthCoast").hide();
			resHome.jumpToHome();
		});
	}
);



/*Start of Right side wine country regions Javascript*/
//Right side of the home page where the regions rotate on hover
	
	var resHome={
		jumpToHome:function()
		{
			if(!($("#wineCountryDef").is(':visible')))
			{
				resetDivs.removeAll();
				$("#wineCountryDef").css("z-index","10");
				$("#wineCountryDef").fadeIn('normal',function(){if(jQuery.browser.msie)
				{
					$("#wineCountryDef").get(0).style.removeAttribute('filter');
				}});
			}
			else{
				
			}
		}
	};
	
	
	//Resets all Divs before showing new animation
	var resetDivs={
		removeAll:function()
		{			
			$("#wineCountryDef").hide();
			
		}
	}
