var onLayer=null;
var menuActive=0;
var timeOn;
var layerTimmer;
var myimages=new Array();

// ===============================================================================================
// =============================================================================================== 
function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++)
	{
	myimages[i]=new Image();
	myimages[i].src="main_images/"+preloadimages.arguments[i];
	}
}
// ===============================================================================================
// =============================================================================================== 
// Enter path of images to be preloaded inside parenthesis. Extend list as desired.
preloadimages("droplist-assembly-normal.gif","droplist-assembly-over.gif","droplist-cncbending-normal.gif","droplist-cncbending-over.gif",
			  "droplist-endbar.gif","droplist-insert-normal.gif","droplist-insert-over.gif","droplist-laserprofiling-normal.gif","droplist-laserprofiling-over.gif",
			  "droplist-powdercoating-normal.gif","droplist-powdercoating-over.gif","droplist-powerpress-normal.gif","droplist-powerpress-over.gif",
			  "droplist-productfinishing-normal.gif","droplist-productfinishing-over.gif","droplist-punch-normal.gif","droplist-punch-over.gif",
			  "droplist-rollleveling-normal.gif","droplist-rollleveling-over.gif","droplist-sample-normal.gif","droplist-sample-over.gif",
			  "droplist-spotwelding-normal.gif","droplist-spotwelding-over.gif","droplist-welding-normal.gif","droplist-welding-over.gif","droplist-studwelding-normal.gif","droplist-studwelding-over.gif",
			  "nav-contactus-over.gif","nav-manufacturing-over.gif","nav-profile-over.gif","nav-services-over.gif");
// ===============================================================================================
// =============================================================================================== 
// SHOW MENU
function showDroplistMenu(itemName){
	if (document.getElementById("lynavCapabilities").style.visibility=='visible'){
		clearTimeout(timeOn);
		return;
	}		

	menuLeft = 250;
//getRealLeft('imgnavCapabilities');
	menuTop = 70;
//getRealTop('imgnavCapabilities');

	//Make Layer visible
	document.getElementById("lynavCapabilities").style.visibility="visible";
	//Load iFrame with HTML menu contents
	document.getElementById("ifnavCapabilities").src = "../nav-manufacturing-menu.htm";
	//Dynamically determine height of layer
	totalLayerHeight=0;
	
	i=0; 
 	for (i;ifnavCapabilities.document.images[i]!=null;i++){ 
		totalLayerHeight=ifnavCapabilities.document.images[i].height + totalLayerHeight;
 	}

	//Poaition and Format the menu
	document.getElementById("ifnavCapabilities").style.height =totalLayerHeight;
	document.getElementById("ifnavCapabilities").style.width =150;
	document.getElementById("lynavCapabilities").style.top=menuTop;
	document.getElementById("lynavCapabilities").style.left=menuLeft;
	//document.getElementById("lynavCapabilities").style.height=355;
	//document.getElementById("lynavCapabilities").style.width=150;

 	onLayer = 'navCapabilities';
 	menuActive=1;
	
	
}// HIDE MENU

// ===============================================================================================
// ===============================================================================================
function hideLayer(layerName){
 	if (menuActive == 0) {
 	document.getElementById("lynavCapabilities").style.visibility="hidden";
 	}
}// TIMER FOR BUTTON MOUSE OUT
// ===============================================================================================
// ===============================================================================================
  function subMenuRollover(rollBut){
	clearTimeout(timeOn);
   if (document.getElementById("lynavCapabilities").style.visibility=="hidden"){
    document.getElementById("lynavCapabilities").style.visibility="visible";}
		buttonId="img"+rollBut;
 	menuActive = 1;
	ifnavCapabilities.document.images[buttonId].src = "main_images/"+rollBut+"-over.gif";
 }
// ===============================================================================================
// ===============================================================================================
 function subMenuRollout(rollBut)
 {
 	clearTimeout(timeOn);
	buttonId="img"+rollBut;

 	ifnavCapabilities.document.images[buttonId].src = "main_images/"+rollBut+"-normal.gif";	
 	menuActive = 0;
	timeOn = window.setTimeout("hideLayer(onLayer)", 200);
 }
// ===============================================================================================
// ===============================================================================================
 function menuOut(itemName) {
 	clearTimeout(timeOn);
 	menuActive = 0;
 	timeOn = setTimeout("hideLayer(onLayer)", 200);
} 
// ===============================================================================================
// ===============================================================================================
	function menuOver(itemName){
	clearTimeout(timeOn);
	parent.showDroplistMenu('navCapabilities');
 }
// ===============================================================================================
// ===============================================================================================
function getRealLeft(imgElem) {
imgElem = document.images[imgElem];
	xPos = eval(imgElem).offsetLeft;
	tempEl = eval(imgElem).offsetParent;
  	while (tempEl != null) {
  		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
  	}
	return xPos;
}
// ===============================================================================================
// ===============================================================================================
function getRealTop(imgElem) {
imgElem = document.images[imgElem];
	yPos = eval(imgElem).offsetTop;
	tempEl = eval(imgElem).offsetParent;
	while (tempEl != null) {
  		yPos += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
  	}
	return yPos;
}
// ===============================================================================================
// ===============================================================================================
function ChangeImage(itemName, buttonPosition)
{
	elementId="img"+itemName;
	document.getElementById(elementId).src="../main_images/"+itemName+"-"+ buttonPosition+".gif";
	//alert("../main_images/"+itemName+"-"+buttonPosition+".gif");
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// ===============================================================================================
// ===============================================================================================
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
// ===============================================================================================
// ===============================================================================================
var legalpopUpWin=0;
function legalpopUpWindow(URLStr, left, top, width, height)
{
  if(legalpopUpWin)
  {
    if(!legalpopUpWin.closed) legalpopUpWin.close();
  }
  legalpopUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);