// hero_tabs.js
// 4-23-07
// Coded by SGB as a tab utility for the NS hero overlay

// preload the images
var myWinterImages = new Array ("/nsbase/wrap/theme0/images/heroConditions_on.png", "/nsbase/wrap/theme0/images/heroConditions_off.png", "/nsbase/wrap/theme0/images/heroForecast_on.png", "/nsbase/wrap/theme0/images/heroForecast_off.png", "/nsbase/wrap/theme0/images/heroTrails_on.png", "/nsbase/wrap/theme0/images/heroTrails_off.png", "/nsbase/wrap/theme0/images/tab_bg.gif");
 
var myWinterPreload = new Array ();
 
for (var i = 0; i < myWinterImages.length; i++ )
{

myWinterPreload[ i ]= new Image();
myWinterPreload[ i ].src = myWinterImages[ i ];

}

var activeTabWinterHero = "golf";

function winterHeroMouseOver(elementID)
{
	// turn all the buttons to the off position
	document.getElementById("conditionsLink").src = "/nsbase/wrap/theme0/images/masthead_conditions_off.png";
	document.getElementById("groomingLink").src = "/nsbase/wrap/theme0/images/masthead_grooming_off.png";
	document.getElementById("parkreportLink").src = "/nsbase/wrap/theme0/images/masthead_parkreport_off.png";
	document.getElementById("forecastLink").src = "/nsbase/wrap/theme0/images/masthead_forecast_off.png";
	document.getElementById("camsLink").src = "/nsbase/wrap/theme0/images/masthead_webcams_off.png";
	
	// switch on the elementID to turn on what should be on
	switch (elementID)
	{
		case "conditionsLink":
			document.getElementById("conditionsLink").src = "/nsbase/wrap/theme0/images/masthead_conditions_on.png";
			break
		case "groomingLink":
			document.getElementById("groomingLink").src = "/nsbase/wrap/theme0/images/masthead_grooming_on.png";
			break
		case "parkreportLink":
			document.getElementById("parkreportLink").src = "/nsbase/wrap/theme0/images/masthead_parkreport_on.png";
			break
		case "forecastLink":
			document.getElementById("forecastLink").src = "/nsbase/wrap/theme0/images/masthead_forecast_on.png";
			break
		case "camsLink":
			document.getElementById("camsLink").src = "/nsbase/wrap/theme0/images/masthead_webcams_on.png";
			break
		default:
			alert("The tab system does not recognize the following element: " + elementID);
	}
	
}

// Changes the style of current element to focus style
function winterHeroApplyFocus(elementID)
{

	// turn all the tabs invisible
	document.getElementById("heroTabConditions").style.visibility = "hidden";
	document.getElementById("heroTabForecast").style.visibility = "hidden";
	document.getElementById("heroTabTrails").style.visibility = "hidden";
	
	// turn all the button to the off position
	document.getElementById("conditionsButtonHero").src = "/nsbase/wrap/theme0/images/heroConditions_off.png";
	document.getElementById("forecastButtonHero").src = "/nsbase/wrap/theme0/images/heroForecast_off.png";
	document.getElementById("trailsButtonHero").src = "/nsbase/wrap/theme0/images/heroTrails_off.png";

	
	// switch on the elementID to turn on what should be on
	switch (elementID)
	{
		case "conditionsButtonHero":
			document.getElementById("heroTabConditions").style.visibility = "visible";
			document.getElementById("conditionsButtonHero").src = "/nsbase/wrap/theme0/images/heroConditions_on.png";
			
			ifActiveGoToURL("conditions", "/snowreport.asp?intcmp=NS000010")
			
			activeTabWinterHero = "conditions";
			break
		case "forecastButtonHero":
			document.getElementById("heroTabForecast").style.visibility = "visible";
			document.getElementById("forecastButtonHero").src = "/nsbase/wrap/theme0/images/heroForecast_on.png";
			
			ifActiveGoToURL("forecast", "/winter/forecast.asp?intcmp=NS000010")
			
			activeTabWinterHero = "forecast";
			break
		case "trailsButtonHero":
			document.getElementById("heroTabTrails").style.visibility = "visible";
			document.getElementById("trailsButtonHero").src = "/nsbase/wrap/theme0/images/heroTrails_on.png";
			
			ifActiveGoToURL("trails", "/groomingReport.asp?intcmp=NS000010")
			
			activeTabWinterHero = "trails";
			break
		default:
			alert("The tab system does not recognize the following element: " + elementID);
	}
	
	// change the background image depending on active tab
	if (activeTabWinterHero == "conditions") {
		document.getElementById("heroContainerWinter").style.backgroundImage = "url('/nsbase/wrap/theme0/images/heroConditionsBG.png')";
		document.getElementById("tabsContainer").style.backgroundImage = "none";
	}
	else {
		document.getElementById("heroContainerWinter").style.backgroundImage = "none";
		document.getElementById("tabsContainer").style.backgroundImage = "url('/nsbase/wrap/theme0/images/tab_bg.gif')";
	}
}

// Changes the style of current element to focus style
function winterHeroBlurFocus()
{
	// turn all the buttons to the off position
	document.getElementById("conditionsLink").src = "/nsbase/wrap/theme0/images/masthead_conditions_off.png";
	document.getElementById("groomingLink").src = "/nsbase/wrap/theme0/images/masthead_grooming_off.png";
	document.getElementById("parkreportLink").src = "/nsbase/wrap/theme0/images/masthead_parkreport_off.png";
	document.getElementById("forecastLink").src = "/nsbase/wrap/theme0/images/masthead_forecast_off.png";
	document.getElementById("camsLink").src = "/nsbase/wrap/theme0/images/masthead_webcams_off.png";

}

function ifActiveGoToURL(tabName, destURL)
{
	if (activeTabWinterHero == tabName)
		location.href = destURL;
}
