if (!(navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5)) {
	document.write("<link rel='STYLESHEET' type='text/css' href='../_css/ie.css'>")
} else {
	document.write("<link rel='STYLESHEET' type='text/css' href='../_css/ns.css'>");
}
document.write("<base target='_top'>");

function HideAll(show) {
	swapImgRestore()
	for (i = 1 ; i < 17 ; i++){
		if (i == show){
			eval("swapImage('l" + i + "','','../_general/line.gif',1)");
			eval("showHideLayers('Layer" + i + "','','show')");}
		else{
			eval("swapImage('l" + i + "','','../_general/empty.gif',1)");
			eval("showHideLayers('Layer" + i + "','','hide')");}
	}
	//eval("swapImage('a" + show + "','','../_general/bullet_red_arrow.gif',1)")
}

function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);

function showHideLayers() { //v6.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function openBrWindow(theURL,winName,features) { //v2.0
  var popUpWin = window.open(theURL,winName,features);
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function checkSearch()
{
    if(document.frm_Search.hfld_StrSearch.value == "")
      {
          alert("Please fill in the Search Keyword field!");
          document.frm_Search.hfld_StrSearch.focus();
          return false;
       }
    return  true;
}

function submitSearch(sender)
{
	if(sender == "event")
		{
			if (checkSearch())
			{
				return true;
			}
			else
			{
				return false;
			}
		}
	else if (checkSearch())
		{
			document.frm_Search.submit();
		}		
}

function showImage(name,title,W,H)
{

	var WW = W + 70;
	var WH = H + 100;
	var scrollbarsStatus;

	var SW = screen.width;
	var SH = screen.height;

	scrollbarsStatus = WH > SH || WW > SW ? "yes" : "no";

	if (WH > SH)
	{
		WH = SH - 40;
	}

	if (WW > SW)
	{
		WW = SW - 10;
	}


	title = 'AMPOL - ' + title;


	imageWin=window.open("","winImage","width=540,height=430,stutus=Yes,toolbar=No,menubar=No,scrollbars=" + scrollbarsStatus + ",resizable=yes");
	imageWin.document.open(); 
	imageWin.document.write ("<html><head><title>" + title + "</title>");
	imageWin.document.write ("</head>");
	imageWin.document.write ("<body bgcolor='#ffffff'><center><img src='../_general/" + name + ".jpg' vspace='5' width=" + W + " height=" + H + "><br>");
	imageWin.document.write ("<a href='javascript:window.close()'><img width=49 height=19 border=0 src='../_general/b_close.gif' style='margin-top:5' title='Close Window'></a>");
	imageWin.document.write ("</center></body></html>");
	imageWin.document.close();

	imageWin.resizeTo(WW,WH);
	imageWin.focus();
	return;
}

function changeBg(idNum)
{	
	if (document.location.href.indexOf('search') < 0)
	{	
		if (!document.layers){
			for (var i=1;i<5;i++)
			{
				if(eval("document.getElementById('subItem" + i + "')") != null)
					{
					eval("document.getElementById('subItem" + i + "').className = 'subMenu'");
					}
			}
			if (idNum > 0)
			{	
				eval("document.getElementById('subItem"+ idNum + "').className = 'subMenuThis'");
			}
		}
		if (document.location.href.indexOf('new') < 0)
		{
			document.images['menuPic'].src = 'images/menu_pic_' + idNum + '.jpg';	
		}
		//alert(eval("document.getElementById('subItem"+ idNum + "').className = 'subMenuThis'"));
	}
}



function DownLoadPopup(lDocID)
{
	
	window.open('http://www.ampol-tech.com/Site/systems/DocDownload.asp?DocumentID='+lDocID,'PopUp','width=500,height=500,scrollbars,resizable');

}
