


//this parses the href and finds the page type (menu, directions, auroramenu, etc), so
// the correct stylesheet can be applied

//whichBrowser is called with the onload function of the <body> tag


function whichBrowser()
{

	//caching the main images
	var mainImages = new Array("Images/bigimageex.jpg", "Images/boxfadewide.jpg");
	

	var thisLocation = window.location.href;
	thisLocation = thisLocation.substr(thisLocation.lastIndexOf("/") + 1);

	if (thisLocation.lastIndexOf("-") != -1)
	{
		var positionOfPeriod = thisLocation.lastIndexOf(".");

		var positionOfTwo = thisLocation.lastIndexOf("-");
	
		//if the filename is for example aurora-menu.htm 'foldername' returns 'menu'

		var folderName = thisLocation.substring(positionOfTwo + 1, positionOfPeriod);
		
		var genericName = "location";
		var pageName = genericName + folderName;
	
	}

	if (thisLocation.lastIndexOf("-") == -1)
	{
		var pageName = "generic";
		var folderName = "top-nav";
	
	}

	

	var browserType = navigator.userAgent.toLowerCase();
	
	var changeLink = document.getElementById("link1");

	var isMozilla = (browserType.indexOf('firefox') != -1);

	var isMSIE = (browserType.indexOf('msie') != -1);
	
	var isNetscape = (browserType.indexOf('netscape') != -1);

	var isOpera = (browserType.indexOf('opera') != -1);

	if (isMozilla)
	{
		
		theVersion = parseFloat(browserType.substring(browserType.lastIndexOf('firefox/') +8));

		if (theVersion > "0" && theVersion < "1.5")
		{	
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'mozilla/' + pageName + 'mozilla-15.css';
		}
		
		else if (theVersion >= "1.5" && theVersion < "2.0")
		{	
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'mozilla/' + pageName + 'mozilla-19.css';
		}
		
		else if (theVersion >= "2.0" && theVersion < "3.0")
		{
				
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'mozilla/' + pageName + 'mozilla-2.css'
			
		}
		else
		{
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'mozilla/' + pageName + 'mozilla-15.css';
		}
	
		
	}
	else if (isMSIE)
	{
		theVersion = parseFloat(browserType.substring(browserType.lastIndexOf('msie') + 4));
		

		if (theVersion >= "7" && theVersion < "8")
		{
			
			changeLink.href = 'stylesheets' + '/' + folderName + '/IE/' + pageName + '-'  + 'MSE7.css';
		}
		else if (theVersion >= "6" && theVersion < "7")
		{	
			changeLink.href = 'stylesheets' + '/' + folderName + '/IE/' + pageName + '-'  + 'MSE6.css';
		}
		else if (theVersion >= "5" && theVersion < "6")
		{
			changeLink.href = 'stylesheets' + '/' + folderName + '/IE/' + pageName + '-' + 'MSE5.css';
		}
		else
		{
			changeLink.href = 'stylesheets' + '/' + folderName + '/IE/' + pageName + '-' + 'MSE5.css';
		}
		

	}
	else if (isNetscape)
	{
		theVersion = parseFloat(browserType.substring(browserType.lastIndexOf('netscape') + 9));
		

		if (theVersion >= "8" && theVersion < "9")
		{	
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'netscape/' + pageName + 'netscape-8.css';
		}
		else if (theVersion >= "7" && theVersion < "8")
		{
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'netscape/' + pageName + 'netscape-7.css';
		}
		else if (theVersion >= "6" && theVersion < "7")
		{
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'netscape/' + pageName + 'netscape-6.css';
		}
		else if (theVersion >= "5" && theVersion < "6")
		{
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'netscape/' + pageName + 'netscape-5.css';
		}
		else
		{
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'netscape/' + pageName + 'netscape-4.css';
		}

		
	}
	else if (isOpera)
	{
		
		theVersion = parseFloat(browserType.substring(browserType.lastIndexOf('opera') +6));		

		if (theVersion >= "9" && theVersion < "10")
		{	
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'opera/' + pageName + 'opera-9.css';
		}
		else if (theVersion >= "8" && theVersion < "9")
		{	
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'opera/' + pageName + 'opera-8.css';
		}
		else if (theVersion >= "7" && theVersion < "8")
		{	
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'opera/' + pageName + 'opera-7.css';
		}
		else if (theVersion >= "6" && theVersion < "7")
		{	
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'opera/' + pageName + 'opera-6.css';
		}
		else
		{
			changeLink.href = 'stylesheets' + '/' + folderName + '/' + 'opera/' + pageName + 'opera-5.css';
		}
		
	}
	
	var makeVisible = document.getElementById("container");
	makeVisible.style.visibility = "visible";


	
	
	//another href parser

	var thisLocation = window.location.href;

	thisLocation = thisLocation.substr(thisLocation.lastIndexOf("/") + 1);
	

if(thisLocation.lastIndexOf("-") != -1)	
{

	var positionOfTwo = thisLocation.lastIndexOf("-");

	var menuName = thisLocation.substring(0, positionOfTwo);



	//this code checks the href to see if the page is a menu or directions page
	//and IF the page is a menu page (folderName = menu) then it executes the following:

	if(folderName == "menu")
	{

		if (menuName == "aurora" || menuName == "bellevue" || menuName == "millcreek")
		{
			var hideSpan = document.getElementById("linner");
			hideSpan.style.display = "none";

			var hideSpan2 = document.getElementById("lunch2");
			hideSpan2.style.display = "inline";

			var hidden = document.getElementById("breakfast");
			hidden.style.display = "none";

			var changeAlign = document.getElementById("upperdiv");
			changeAlign.style.textAlign = "center";
		}
		else
		{
			var hideSpan = document.getElementById("lunch2");
			hideSpan.style.display = "none";

			var imageChng = document.getElementById("selectimage");
			imageChng.src = "Images/lunchimage.jpg";
		}

	}
		//this code makes the location from the 2ndary menu white
		//as a user-navigation tool...(in the menu, directions and jobs pages)
	
	if (menuName == "millcreek")
	{
		var elemChange = document.getElementById("millcreek");
		elemChange.style.color = "white";	
	}
	
	else if (menuName != "millcreek")
	{
	var elemChange = document.getElementById(menuName);
	elemChange.style.color = "white";
	}
}

//this ends the function bracket for whichBrowser function

}	
