// browser detection
isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE6 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

// preload nav images and create objects
homeOn = new Image();
homeOn.src = "images/home_on.gif";
homeOff = new Image();
homeOff.src = "images/home.gif";
servicesOn = new Image();
servicesOn.src = "images/services_on.gif";
servicesOff = new Image();
servicesOff.src = "images/services.gif";
equipmentOn = new Image();
equipmentOn.src = "images/equipment_on.gif";
equipmentOff = new Image();
equipmentOff.src = "images/equipment.gif";
knowledgeOn = new Image();
knowledgeOn.src = "images/knowledge_on.gif";
knowledgeOff = new Image();
knowledgeOff.src = "images/knowledge.gif";
contactOn = new Image();
contactOn.src = "images/contact_on.gif";
contactOff = new Image();
contactOff.src = "images/contact.gif";
buyOn = new Image();
buyOn.src = "images/buy_on.gif";
buyOff = new Image();
buyOff.src = "images/buy.gif";

// basic image rolloverFunction
function rollImage(imageObj, imgTarget) {
	document.getElementById(imgTarget).src = eval(imageObj + ".src");
}

// Really basic show and hide layer functions

function showLayer(divId) {
	document.getElementById(divId).style.visibility = "visible";
}
		
function hideLayer(divId) {
	document.getElementById(divId).style.visibility = "hidden";
}


//  show layer function

var menuTimer;
var menuTimeout;
var submenuTimeout;
var currentMenu;
var currentsubMenu;


function menuOn(menuName) {
	var theMenu;

	if (menuTimeout) { clearTimeout(menuTimeout); }	// clear the timeout

	if (currentMenu) {			// hide the current menu
		theMenu = document.getElementById(currentMenu);
		theMenu.style.visibility = "hidden";
	}
	currentMenu = menuName;
	theMenu = document.getElementById(currentMenu);
	theMenu.style.visibility = "visible";				// display menuName
}

function submenuOn(submenuName) {
	var thesubMenu;

	if (submenuTimeout) { clearTimeout(submenuTimeout);	} // clear the timeout

	if (currentsubMenu) {			// hide the current menu
		thesubMenu = document.getElementById(currentsubMenu);
		thesubMenu.style.visibility = "hidden";
	}
	currentsubMenu = submenuName;
	thesubMenu = document.getElementById(currentsubMenu);
	theMenu = document.getElementById(currentMenu);
	thesubMenu.style.visibility = "visible";
	theMenu.style.visibility = "visible";				// display menuName
}

// Hides the dropdown menus
// inputs: menuName - name of the menu DIV layer without the Div.  ie. vehicles
// outputs: none
function menuOff(menuName) {
	if (menuTimeout) clearTimeout(menuTimeout)	// clear the current timeout
	menuTimeout = setTimeout('document.getElementById("' + menuName + '").style.visibility = "hidden"', 500);		// set the new timeout
}

function submenuOff(submenuName) {
	if (submenuTimeout) clearTimeout(submenuTimeout)	// clear the current timeout
	submenuTimeout = setTimeout('document.getElementById("' + submenuName + '").style.visibility = "hidden"', 330);		// set the new timeout
}


function navItemRollOn(itemName) {
	document.getElementById(itemName).bgColor='#EBEBEB';
}

function navItemRollOff(itemName) {
	document.getElementById(itemName).bgColor='#FFFFFF';
}