// JavaScript Document

var CurrentPage;
var date = new Date();
var day = date.getDate();
var month = date.getMonth();

function Load() //
{
	document.getElementById("Fix").style.height = document.getElementById("Container").offsetHeight - 42 + "px";
	if (document.title === "Welcome to Baeten's Nursery!")
	{
		document.getElementById("Nav1").setAttribute("class", "Selected");
		document.getElementById("BNav1").setAttribute("class", "SelectedBottom");
		
		CurrentPage = "Nav1";
	}
	else if (document.title ==="Gallery")
	{
		document.getElementById("Nav7").setAttribute("class", "Selected");
		document.getElementById("BNav7").setAttribute("class", "SelectedBottom");
		
		CurrentPage = "Nav7";
	}
	else if (document.title ==="Baeten's Nursery Events")
	{
		document.getElementById("Nav3").setAttribute("class", "Selected");
		document.getElementById("BNav3").setAttribute("class", "SelectedBottom");
		
		CurrentPage = "Nav3";
	}
	else if (document.title ==="Earl Baeten's Tips for Growing")
	{
		document.getElementById("Nav6").setAttribute("class", "Selected");
		document.getElementById("BNav6").setAttribute("class", "SelectedBottom");
		
		CurrentPage = "Nav6";
	}
	else if (document.title ==="Baeten's Seasonal Plants for Water and Japanese Gardens")
	{
		document.getElementById("Nav2").setAttribute("class", "Selected");
		document.getElementById("BNav2").setAttribute("class", "SelectedBottom");
		
		CurrentPage = "Nav2";
	}
	else if (document.title ==="Information Links from Baeten's Nursery")
	{
		document.getElementById("Nav4").setAttribute("class", "Selected");
		document.getElementById("BNav4").setAttribute("class", "SelectedBottom");
		
		CurrentPage = "Nav4";
	}
	else if (document.title ==="Baeten's Landscaping Services")
	{
		document.getElementById("Nav5").setAttribute("class", "Selected");
		document.getElementById("BNav5").setAttribute("class", "SelectedBottom");
		
		CurrentPage = "Nav5";
	}
	else if (document.title ==="Baeten's Nursery & Greenhouses Store Information")
	{
		document.getElementById("Nav8").setAttribute("class", "Selected");
		document.getElementById("BNav8").setAttribute("class", "SelectedBottom");
		
		CurrentPage = "Nav8";
	}
	
	
	document.getElementById("Nav1").firstChild.href = "index.html";
	document.getElementById("BNav1").href = "index.html";
	document.getElementById("Nav2").firstChild.href = "seasonal.html";
	document.getElementById("BNav2").href = "seasonal.html";
	document.getElementById("Nav3").firstChild.href = "events.html";
	document.getElementById("BNav3").href = "events.html";
	document.getElementById("Nav4").firstChild.href = "links.html";
	document.getElementById("BNav4").href = "links.html";
	document.getElementById("Nav5").firstChild.href = "landscaping.html";
	document.getElementById("BNav5").href = "landscaping.html";
	document.getElementById("Nav6").firstChild.href = "Tips.html";
	document.getElementById("BNav6").href = "Tips.html";
	document.getElementById("Nav7").firstChild.href = "Gallery.html";
	document.getElementById("BNav7").href = "Gallery.html";
	document.getElementById("Nav8").firstChild.href = "store_info.html";
	document.getElementById("BNav8").href = "store_info.html";	
	
	
	/* Code for changing the date object. If the date is between 2/16 and 6/17 it will change to the spring hours */
	/* Make note that January is 0 so subtract one from the month's number to ensure it's the right date i.e. August is the 7th month not the 8th */
		
			if (month == 1 && day >= 16 || month == 2 || month == 3 && day <= 15) {//Early Spring Hours(2/16-4/15)		
				document.getElementById("Hours").innerHTML = '<span class="BoldInfo">Early Spring Hours:</span><br><b>Monday - Friday</b><br>8:00 AM - 5:00 PM<br><b>Saturday</b><br>8:00 AM - 4:30 PM<br><b>Sunday</b><br>Closed';
		}
		
		else if (month == 3 && day >= 16 || month == 4 || month == 5  && day <= 19)	// Spring Hours	(4/16-6/15)
			document.getElementById("Hours").innerHTML = '<span class="BoldInfo">Spring Hours:</span><br><b>Monday - Friday</b><br>8:00 AM - 7:00 PM<br><b>Saturday</b><br>8:00 AM - 7:00 PM<br><b>Sunday</b><br>10:30 AM - 5:00 PM<br>(CLOSED MEMORIAL DAY)';	
		
		else if (month == 5 && day >= 20 || month == 6 || month == 7 && day <= 15)	// Summer Hours	(6/16-8/15)
			document.getElementById("Hours").innerHTML = '<span class="BoldInfo">Summer Hours:</span><br><b>Monday - Friday</b><br>8:00 AM - 5:00 PM<br><b>Saturday</b><br>8:00 AM - 4:30 PM<br><b>Sunday</b><br>Closed';
	
		else if (month == 7 && day >= 16 || month == 8 || month == 9 || month == 10 || month == 11 && day <= 25) // Fall & Christmas Hours (8/16-12/31)
			document.getElementById("Hours").innerHTML = '<span class="BoldInfo">Fall/Christmas Hours:</span><br><b>Monday - Friday</b><br>8:00 AM - 5:00 PM<br><b>Saturday</b><br>8:00 AM - 4:30 PM<br><b>Sunday</b><br>Closed';
			
		else if (month == 11 && day >= 26 || month == 0 && day <= 1) // Holiday Closure (12/25-1/1)
			document.getElementById("Hours").innerHTML = '<span class="BoldInfo">Closed for the Holidays<br>(Dec 25-Jan 1)</span><br>For urgent needs call:<br>Todd Baeten at<br>859-750-0356<br>';
		
		else if (month == 0 && day >= 2 || month == 1 && day <= 15)	// Winter Hours	(1/2-2/15)
			document.getElementById("Hours").innerHTML = '<span class="BoldInfo">Winter Hours:</span><br><b>Monday - Friday</b><br>8:00 AM - 4:30 PM<br><b>Saturday & Sunday</b><br>Closed';
		
//IE fixes
browser_type = navigator.appName;
if (browser_type == "Microsoft Internet Explorer" && document.getElementById("liContainer") != null)
document.getElementById("liContainer").setAttribute("id", "liContainerIE");

}

function Highlight(Element)
{
	if (Element.charAt(0) != "B")
	{
		//document.getElementById(Element).style.backgroundColor = "#104D23";
		document.getElementById(Element).firstChild.style.textDecoration = "underline";
	}
	else
		document.getElementById(Element).style.textDecoration = "underline";
}

function Deselect(Element)
{
	if (Element.charAt(0) != "B")
	{
		//document.getElementById(Element).style.backgroundColor = "#669966";
			
			document.getElementById(Element).firstChild.style.textDecoration = "none";
	}
	else
	{		
		if (Element != "B" + CurrentPage)	
			document.getElementById(Element).style.textDecoration = "none";
	}
}

function validate_email(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
  }
}



