// JavaScript Document

function fixWidth() { 
	// Adds extra width to 1 or more divs (you'll have to hard code it)
	// to make up for a WiniE 5x rendering bug that draws borders on the
	// inside of the objects.
	userOS = navigator.platform;
	browserName = navigator.appName;
	// If Browser is Win I
	if (browserName.indexOf("Microsoft")!=-1 && userOS == "Win32") { 
		browserName="MSIE" 
	}
	//prep for version detection
	browserVersion="0";
	if (navigator.appVersion.indexOf("2.")!=-1) {browserVersion="2"};
	if (navigator.appVersion.indexOf("3.")!=-1) {browserVersion="3"};
	if (navigator.appVersion.indexOf("4.")!=-1) {browserVersion="4"};
	if (navigator.appVersion.indexOf("5.")!=-1) {browserVersion="5"};
	if (navigator.appVersion.indexOf("6.")!=-1) {browserVersion="6"};
	// detect version
	if (browserName=="MSIE" && browserVersion < 6) {
		if (document.getElementById) {
			// add extra width
			document.getElementById("page").style.width = "862px";
		}
	}
}

function suggestUpgrade() { 
	// Adds extra width to 1 or more divs (you'll have to hard code it)
	// to make up for a WiniE 5x rendering bug that draws borders on the
	// inside of the objects.
	userOS = navigator.platform;
	browserName = navigator.appName;
	// If Browser is Win I
	if (browserName.indexOf("Microsoft")!=-1 && userOS == "Win32") { 
		browserName="MSIE" 
	}
	//prep for version detection
	browserVersion="0";
	if (navigator.appVersion.indexOf("2.")!=-1) {browserVersion="2"};
	if (navigator.appVersion.indexOf("3.")!=-1) {browserVersion="3"};
	if (navigator.appVersion.indexOf("4.")!=-1) {browserVersion="4"};
	if (navigator.appVersion.indexOf("5.")!=-1) {browserVersion="5"};
	if (navigator.appVersion.indexOf("6.")!=-1) {browserVersion="6"};
	// detect version
	if (browserName=="MSIE" && browserVersion < 6) {
		alert("The version of Windows Internet Explorer you are using is not supported.\nYou may experience rendering and performance issues when viewing this site.\nWe highly recommend updating to the most recent version of Explorer.");
	}
}

function tweakMenu() {
	// Workaround for difference bewtween Mac and PC browsers' font-sizes being off by 1px
	// This function solves the issue in Safari, but only improves the situation slightly in Firefox
	// Safari & Firefox identify themselves as Netscape MacPPC, so it makes separating the two.. impossible?
	userOS = navigator.platform;
	browserName = navigator.appName;
	//alert(browserName+" "+userOS);
	if (browserName == "Netscape" && userOS == "MacPPC") {
		if (document.getElementById) {
		//	add extra width
	  	document.getElementById("subnav").style.height = "22px";
		//	document.getElementById("subnav").style.zIndex = 30;
		//	alert(document.getElementById("subnavitems").style.zIndex);
		}
	}
}


// Controls area rollovers for white to gray containers
function swapObjBG(objRef, state) {
	objRef.style.backgroundColor = (1 == state) ? '#f1f1f1' : '#ffffff';
	return;
}

// Puts in the current year as the copyright date
// Currently used only on the site credits page so I don't have to
// remember to update it down the road.
function copyright() {
	var time=new Date();
	var date=time.getDate();
	var year=time.getYear();
	if (year < 2000)
	year = year + 1900;
	document.write("&copy; " + year + " GK's Custom Polishing, Inc. All Rights Reserved.");
	}