PopupWindow = ""
var hideTimeOut = "";
var hideLayerFlag = 0;
var myLayersArray = new Array();

//************************************************************************************************
function OpenPopUp(address,width,height,scrollbars,resizable)
{
	var w = 480, h = 340;
	
	if (document.all || document.layers)
	{
	   w = screen.availWidth;
	   h = screen.availHeight;
	}
	
	var popW = width, popH = height;
	
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	
	if(PopupWindow)
	{
		if(!PopupWindow.closed)
		{
			PopupWindow.close();
		}
	}
	PopupWindow = window.open(address,'popup','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',status=0,toolbar=0,location=0,menubar=0,directories=0');
	PopupWindow.focus();
}

//************************************************************************************************
function defaultFocus()
{
	if (document.forms[0][0])
			document.forms[0][0].focus();
}

//************************************************************************************************
function MouseLocation(strMousePosition,strPath)
{	
	if(strMousePosition==1)
	{
		if (document.images) strPath
	}
	else
	{
		if (document.images) strPath
	}
}

//************************************************************************************************
function init()
{
	myLayersArray[myLayersArray.length] = "productsMenu";
	myLayersArray[myLayersArray.length] = "marketsMenu";
	myLayersArray[myLayersArray.length] = "facilityMenu";
	myLayersArray[myLayersArray.length] = "customerMenu";
	//myLayersArray[myLayersArray.length] = "careersMenu";
	//myLayersArray[myLayersArray.length] = "trainingMenu";
	//myLayersArray[myLayersArray.length] = "caseMenu";
	myLayersArray[myLayersArray.length] = "aboutusMenu";
	//myLayersArray[myLayersArray.length] = "newsMenu";
	if(document.getElementsByTagName)
	{
		arrayOfDiv = document.getElementsByTagName("div");
	}
	hideAll();
}

//************************************************************************************************
function clearTime(layerName)
{
	clearTimeout(hideTimeOut);
	hideLayerFlag = 0;
}

//************************************************************************************************
function hideLayer(layerName)
{
	if(hideLayerFlag == 0)
	{
		hideTimeOut = setTimeout("hideLayer('"+layerName+"');",10);
		hideLayerFlag = 1;
		return;
	}
    if (document.all)
	{
      	document.all[layerName].style.visibility = "hidden";
    }
	else if(document.layers)
	{
		document.layers[layerName].visibility = "hidden";
    }
	else if(document.getElementById)
	{
		arrayOfDiv[layerName].style.visibility = "hidden"
	}
}

//************************************************************************************************
function hideAll()
{
	for(i=0;i<myLayersArray.length;i++)
	{
    	if (document.all)
		{
    	  document.all[myLayersArray[i]].style.visibility = "hidden";
	    }
    	else if(document.layers)
		{
			document.layers[myLayersArray[i]].visibility = "hidden";
	    }
		else if(document.getElementById)
		{
			arrayOfDiv[layerName].style.visibility = "hidden"
		}
	}
}

//************************************************************************************************
function showLayer(layerName)
{
	clearTime();
	for(i=0;i<myLayersArray.length;i++)
	{
		if(myLayersArray[i] != layerName)
		{
			hideLayerFlag = 1;
			hideLayer(myLayersArray[i]);
			hideLayerFlag = 0;
		}
	}
    if (document.all)
	{
		document.all[layerName].style.visibility = "visible";
    }
    else if(document.layers)
	{
		document.layers[layerName].visibility = "visible";
    }
	else if(document.getElementById)
	{
		arrayOfDiv[layerName].style.visibility = "visible"
	}
}
//************************************************************************************************
function detectflash(strFlashmovie,strNonflashimage,strWidth,strHeight)
{
	noautoinstall = ""

	if(navigator.appName == "Microsoft Internet Explorer" && 
		(navigator.appVersion.indexOf("Mac") != -1 || 
		 navigator.appVersion.indexOf("3.1") != -1)){
			noautoinstall = "true";
	}

	if (navigator.appName == "Microsoft Internet Explorer" && noautoinstall != "true")
	{
		document.write ("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+strWidth+"' height='"+strHeight+"' hspace='0' vspace='0'>")
        document.write ("<param name='movie' value='"+strFlashmovie+"'>")
       	//document.write ("<param name='wmode' value='transparent'>")
       	document.write ("<embed src='"+strFlashmovie+"' width='"+strWidth+"' height='"+strHeight+"' hspace='0' vspace='0' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>")
    	document.write ("</object>")
	}
	else if(navigator.plugins)
	{
		if(navigator.plugins["Shockwave Flash"] || navigator.plugins["Shockwave Flash 2.0"])
		{
			document.write ("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+strWidth+"' height='"+strHeight+"' hspace='0' vspace='0'>")
	        document.write ("<param name='movie' value='"+strFlashmovie+"'>")
	       	//document.write ("<param name='wmode' value='transparent'>")
	       	document.write ("<embed src='"+strFlashmovie+"' width='"+strWidth+"' height='"+strHeight+"' hspace='0' vspace='0' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>")
	    	document.write ("</object>")
		}
		else
		{
			document.write ("<img src="+strNonflashimage+" border='0' width="+strWidth+" height="+strHeight+">")
		}
	}
	else
	{
		document.write ("<img src="+strNonflashimage+" border='0' width="+strWidth+" height="+strHeight+">")
	}
}


function Navigation(strLocation, strSection)
{
    document.write("<div id=\"menu\">");
	document.write("	<ul class=\"level1\">");
	document.write("		<li class=\"submenu\"><a href=\"" + strLocation + "aboutus/\" class=\"mainMenu\">About Us</a>");
	document.write("			<ul class=\"level2\">");
	document.write("				<li id=\"2ndLevel\"><a href=\"" + strLocation + "aboutus/company.htm\" class=\"subMenuLevel2\">Company Background</a></li>");
	document.write("		  </ul>");
	document.write("		</li>");
	document.write("		<li class=\"submenu\"><a href=\"" + strLocation + "products/\" class=\"mainMenu\">Products &amp; Services</a></li>");
	document.write("		<li class=\"submenu\"><a href=\"" + strLocation + "news/\" class=\"mainMenu\">News</a></li>");
	document.write("		<li class=\"submenu\"><a href=\"http://www.huntongroup.com/careers/\" target=\"_blank\" class=\"mainMenu\">Careers</a></li>");
	document.write("	</ul>");
	document.write("</div>");
}