var curMenu="";
var isNC=false;
var HTML_tool="";
ua=navigator.userAgent;
function whichBrowser()
{
	var br="BR";
	if (ua.indexOf("MSIE") != -1) {br="IE";}
	if ((ua.indexOf('Mozilla') != -1) && ((ua.indexOf('Spoofer') == -1) && (ua.indexOf('compatible') == -1))) {br="NS";}
	return br;
}
function whichVersion(br)
{
	var bv=0;
	bv=navigator.appVersion.substring(0,1);
	if (br == "IE") {(parseInt(bv));}
	if (br == "NS") {(parseInt(bv));}
	return bv;
}
function whichPlatform()
{
var os="OS";
if ((ua.indexOf("Win98")!=-1)||(ua.indexOf("Windows 98")!=-1)) { os="win32_98"; }
if ((ua.indexOf("Win95")!=-1)||(ua.indexOf("Windows 95")!=-1)) { os="win32_95"; }
if ((ua.indexOf("WinNT")!=-1)||(ua.indexOf("Windows NT")!=-1)) {os="win32_NT"; }
if ((ua.indexOf("Win16")!=-1)||(ua.indexOf("Windows 3.1")!=-1)) {os="win16"; }
if ((ua.indexOf("Linux")!=-1)||(ua.indexOf("linux")!=-1)) {os="Linux"; }
return os;
}
b=whichBrowser();
v=whichVersion(b);
o=whichPlatform();
if((b=="IE")&&(v>3)&&(o.indexOf("win")>=0))isIE=true;
//if((b=="NS")&&(v>3)&&(o.indexOf("win")>=0))isNC=true;
if((b=="NS")&&(v>3))isNC=true;

///////////////////////////////////////////////////////
HTML_tool="<!--SUBMENU-->";
function setTool(whichtool,idStr)
{
	var tag="";
	var menuHTML;
	var subTag=idStr.toUpperCase()+"_SUB";
	if(isIE)
	{
		tag="<!--SUBMENU-->";
		menuHTML="<div class=\"menu\" id=\""+idStr.toUpperCase()+ "_SUB\" style=\"position:absolute;display:none;z-index:2;";
		if(whichtool==1)menuHTML+="top:"+menuTop1+";background-color:"+menuColor1+";";
		else menuHTML+="top:"+menuTop2+";background-color:"+menuColor2+";";
		menuHTML+="width:100;height:0;\" NOWRAP><font style=\"font-size:12px;\"><!--"+idStr.toUpperCase()+"--></font></div>"+tag;
		HTML_tool=HTML_tool.replace(tag,menuHTML);
	}
	if(isNC)
	{
		tag="<!--SUBMENU-->";
		menuHTML="<layer name=\""+idStr.toUpperCase()+"_SUB\" visibility=\"hide\" onmouseout=\"showLayer('"+subTag+"',2,event)\"";
		menuHTML+=" bgcolor=\"#0017BF\"";
		menuHTML+=" width=\"100\" NOWRAP><font face=\"Verdana, Arial, Helvetica\" size=\"2\"><!--"+idStr.toUpperCase()+"--></font></layer>"+tag;
		HTML_tool=HTML_tool.replace(tag,menuHTML);
	}
}
function setSubMenu(idStr,displayStr,urlStr)
{
	var tag="<!--"+idStr.toUpperCase()+"-->";
	var menuHTML;
	var targ="";
	var newURL=urlStr;
	menuHTML="<a class=\"menu\"";
        if(urlStr.indexOf("?")>0)targ=urlStr.substring(urlStr.indexOf("?")+1,urlStr.length);
        if(targ!="")newURL=urlStr.substring(0,urlStr.indexOf("?"));
	if(urlStr!="")menuHTML+=" href=\""+newURL+"\" ";
	if(targ!="")menuHTML+=targ;
	if(isIE)menuHTML+=" onmouseover=\"doMouse('red')\" onmouseout=\"doMouse('white')\"";
	menuHTML+=">&nbsp;"+displayStr+"&nbsp;</a><br>"+tag;
	HTML_tool=HTML_tool.replace(tag,menuHTML);
}
function setSubDiv(idStr)
{
	var tagStr="<!--" +idStr.toUpperCase()+"-->";
	var bodyStr="<hr class=\"menu\">"+tagStr;
	HTML_tool = HTML_tool.replace(tagStr,bodyStr);
}

function showLayer(subName,act,evt)
{
	if((isIE)&&(act==1))
	{
		var element=window.event.srcElement;
		var tagID=subName.toUpperCase()+"_SUB";
		if(curMenu!="")curMenu.style.display="none";
		curMenu=document.all(tagID);
		curMenu.style.left=element.offsetLeft+element.offsetParent.offsetLeft+menuOffset;
		if(curMenu!="")curMenu.style.display="";
	}
	if(isNC)
	{
	if(act==1)
		{
		var lName=subName.toUpperCase()+"_SUB";
		if(curMenu!="")document.layers[curMenu].visibility="hide";
		curMenu=lName;
		document.layers[lName].left=evt.target.x;
		document.layers[lName].top=evt.target.y+18;
		document.layers[lName].visibility="show";
		}
	else	{
		if(curMenu!="")document.layers[curMenu].visibility="hide";
		curMenu="";
		}
	}
}
function showIconLayer(subName,act,evt)
{
	if((isIE)&&(act==1))
	{
		var element=window.event.srcElement;
		var tagID=subName.toUpperCase()+"_SUB";
		if(curMenu!="")
		  if(curMenu.id!=tagID)
		    curMenu.style.display="none";
		curMenu=document.all(tagID);
		curMenu.style.top=60;
		curMenu.style.left=document.body.scrollLeft+document.body.clientWidth-120;
		if(curMenu!="")curMenu.style.display="";
	}
	if(isNC)
	{
	if(act==1)
		{
		var lName=subName.toUpperCase()+"_SUB";
		if(curMenu!="")document.layers[curMenu].visibility="hide";
		curMenu=lName;
		document.layers[lName].left=evt.target.x-20;
		document.layers[lName].top=evt.target.y+40;
		document.layers[lName].visibility="show";
		}
	else	{
		if(curMenu!="")document.layers[curMenu].visibility="hide";
		curMenu="";
		}
	}
}
function doMouse(color)
{
	if(isIE)window.event.srcElement.style.color=color;
}
function doNothing()
{}
function f(name)
{
       	if(isIE)
	{
	if(document.all(name).style.display!="")
		{
		//document.all(name).style.display="";
		var tg=eval(name);
		tg.style.display="";
		document[name+"_p"].src=open.src;
		}
	else
		{
		//document.all(name).style.display="none";
		var tg=eval(name);
		tg.style.display="none";
		document[name+"_p"].src=close.src;
		}
		
	}
}
function hidePop()
{
 //default is open status 03/03/17 old if(isIE)
	if(!isIE)
	{
	var a = document.all.tags("TD");
    		if (a.length!=null) 
    		{
        		for (i=0; i<a.length; i++)
        		{
        		if(a(i).id.indexOf("pop")>=0)
                       		a(i).style.display="none";
               		}
    	        } 
	}
}

