//path to images
var rootPath = "/"

// preload nav images used in swapping

homeOn = new Image();
homeOn.src = rootPath + "images/nav_home_on.gif"
homeOff = new Image();
homeOff.src = rootPath + "images/nav_home_off.gif"

allMfgrsOn = new Image();
allMfgrsOn.src = rootPath + "images/nav_allMfgrs_on.gif"
allMfgrsOff = new Image();
allMfgrsOff.src = rootPath + "images/nav_allMfgrs_off.gif"

millingCtrsOn = new Image();
millingCtrsOn.src =  rootPath + "images/nav_millingCtrs_on.gif"
millingCtrsOff = new Image();
millingCtrsOff.src =  rootPath + "images/nav_millingCtrs_off.gif"

turningCtrsOn = new Image();
turningCtrsOn.src =  rootPath + "images/nav_turningCtrs_on.gif"
turningCtrsOff = new Image();
turningCtrsOff.src =  rootPath + "images/nav_turningCtrs_off.gif"

grindersOn = new Image();
grindersOn.src =  rootPath + "images/nav_grinders_on.gif"
grindersOff = new Image();
grindersOff.src =  rootPath + "images/nav_grinders_off.gif"

boringMillsOn = new Image();
boringMillsOn.src =  rootPath + "images/nav_boringMills_on.gif"
boringMillsOff = new Image();
boringMillsOff.src =  rootPath + "images/nav_boringMills_off.gif"

gearEquipmentOn = new Image();
gearEquipmentOn.src =  rootPath + "images/nav_gearEquipment_on.gif"
gearEquipmentOff = new Image();
gearEquipmentOff.src =  rootPath + "images/nav_gearEquipment_off.gif"

preOwnedOn = new Image();
preOwnedOn.src =  rootPath + "images/nav_preOwned_on.gif"
preOwnedOff = new Image();
preOwnedOff.src =  rootPath + "images/nav_preOwned_off.gif"

maintenanceOn = new Image();
maintenanceOn.src =  rootPath + "images/nav_maintenance_on.gif"
maintenanceOff = new Image();
maintenanceOff.src =  rootPath + "images/nav_maintenance_off.gif"

toolingOn = new Image();
toolingOn.src =  rootPath + "images/nav_tooling_on.gif"
toolingOff = new Image();
toolingOff.src =  rootPath + "images/nav_tooling_off.gif"

aboutOn = new Image();
aboutOn.src =  rootPath + "images/nav_about_on.gif"
aboutOff = new Image();
aboutOff.src =  rootPath + "images/nav_about_off.gif"

contactOn = new Image();
contactOn.src =  rootPath + "images/nav_contact_on.gif"
contactOff = new Image();
contactOff.src =  rootPath + "images/nav_contact_off.gif"

buttonArrowOn = new Image();
buttonArrowOn.src =  rootPath + "images/button_arrow_over.gif"
buttonArrowOff = new Image();
buttonArrowOff.src =  rootPath + "images/button_arrow_off.gif"
buttonArrowGreen = new Image();
buttonArrowGreen.src = rootPath + "images/button_arrow_green.gif"

//standard image swapping function
function swapImage(imageName,imageFile) { 
	if (document.images) {eval('document.images[imageName].src='+imageFile+'.src');}
	else return;
}


//css style swapper -- for rollovers
function changeLinkStyle(id,styleName) { 
	elem = document.getElementById(id);
	elem.className = styleName;
} 

//change layer visibility
function changeLayerVis(layerName,visType) {
	if (document.getElementById) { 
		document.getElementById(layerName).style.visibility = visType;
	}
}

function changeLayerDisplay(layerName,dispType) {
	if (document.getElementById) { 
		document.getElementById(layerName).style.display = dispType;
	}
}

function setThumb(thumb) {
	swapImage('enlargement',thumb);
	changeLinkStyle(activeThumb,'thumbnail-unselected');
	changeLinkStyle(thumb,'thumbnail-selected');
	activeThumb = thumb;
}

var activeThumb = "thumb1";

function thumbRollover(thumb) {
	if (thumb != activeThumb) {
		changeLinkStyle(thumb,"thumbnail-rollover")
		changeLayerDisplay("txt"+activeThumb,"none")
		changeLayerDisplay("txt"+thumb,"block")
	}
}

function thumbRollout(thumb) {
	if (thumb != activeThumb) {
		changeLinkStyle(thumb,"thumbnail-unselected");
		changeLayerDisplay("txt"+thumb,"none");
		changeLayerDisplay("txt"+activeThumb,"block");
	}
}


var activeSubMenu = "none"
var timerID = null;
var timerOn = false;
var timecount = 1000;

function noSubMenuOn(id) {
	hideSubMenu();
	var imgOn = id + "On";
	swapImage(id,imgOn);
}

function noSubMenuOff(id) {
	var imgOff = id + "Off";
	swapImage(id,imgOff);
}

function showSubMenu(layerName) {
	stopTime();

	var imgOn = layerName + "On";
	swapImage(layerName,imgOn);

	if (document.getElementById) { 
		if (activeSubMenu == "none") {
			changeLayerVis(layerName,"visible")
			activeSubMenu = layerName
			}
		else {
			changeLayerVis(activeSubMenu,"hidden")
			changeLayerVis(layerName,"visible")
			activeSubMenu = layerName
		}
	}
}

function hideSubMenu() {
	stopTime();
	if (activeSubMenu !="none") {
		changeLayerVis(activeSubMenu,"hidden")
		imgOff = activeSubMenu + "Off";
		swapImage(activeSubMenu,imgOff);
		activeSubMenu = "none";
	}
}


function startTime() {
	if (timerOn == false) {
		timerID=setTimeout( "hideSubMenu()" , timecount);
		timerOn = true;
	}
}

function stopTime() {
	if (timerOn) {
		clearTimeout(timerID);
		timerID = null;
		timerOn = false;
	}
}


//macromedia's function used to open windows
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
