var myTimer;
var divobj = new Object;
var divcount = 0;
var element;
var hilightM;
var ns4;
var ns6;
var ie;
var dom2;
var safari1;
var opera;
var linux;
var macOs9;
var dhtml;
var flash;
var moved = false;
if(document.layers && !document.getElementById)
{
	ns4 = true;
}
if(navigator.vendor == ("Netscape6"))
{
	ns6 = true;
}
if(navigator.appVersion.indexOf("AppleWebKit") != -1)
{
	safari1 = true;
}
if(navigator.userAgent.indexOf("Opera") != -1)
{
	opera = true;
}

if((navigator.appVersion.indexOf("Macintosh") != -1)&!(navigator.appVersion.indexOf("OS X") != -1))
{
	macOs9 = true;
}
if((navigator.appVersion.indexOf("X11") != -1)||(navigator.appVersion.indexOf("Linux") != -1))
{
	linux = true;
}
if((document.getElementById && document.all)&&!(navigator.userAgent.indexOf("Opera") != -1))
{
	ie = true;
	
}
if((navigator.userAgent.indexOf("Gecko/") != -1)&&(!ns6))
{
	dom2 = true;
}

if (dom2||ie||ns6||safari1||opera)
{
	dhtml = true;
}
if((ie||dom2)&&!linux)
{
	flash = true;
}

function showmenu(menu, currentsm)
{
	hilightM = currentsm;
	if (dhtml)
	{
		showmenuOK(menu, currentsm);
	}
}
function hidemenu(currentsm)
{
	currentsm.style.backgroundColor="";
	hilightM = currentsm;
	if (dhtml)
	{
		hidemenuOK();
	}
}
function showmenuOK(sm, parentMenu)
{
	clearTimeout(myTimer);
	if(document.getElementById(sm))
	{
		div = document.getElementById(sm);	
		div.style.visibility = "visible";
	}
	for(i=0; i<divcount; i++)
	{
		var templayer = divobj[i];		
		if((templayer.style.visibility=="visible")&&(templayer.id.length!=0)&&(parentMenu!=templayer.id)&&(sm.indexOf(templayer.id)))
		{
			templayer.style.visibility = "hidden";
		}
	}
}

function clearmenus()
{
	for(i=0; i<divcount; i++)
	{
		divobj[i].style.visibility = "hidden";
	}
}
function sm(sm,level)
{	
	clearTimeout(myTimer);
	
	if(level==2)
	{
		hilightM.style.backgroundColor="#DBE3EA";
//		hilightM.style.fontWeight="bold";
		hilightM.style.color="";
		
		sm.style.backgroundColor="#ECF1F5";
		sm.style.fontWeight="bold";
		sm.style.color="#486a9f";
	}
	else
	{
		sm.style.backgroundColor="#DBE3EA";
		//sm.style.fontWeight="bold";
		sm.style.color="#486a9f";
	}

}
function smo(sm)
{
	hilightM.style.backgroundColor="";
	sm.style.backgroundColor="";
	sm.style.fontWeight="";
	sm.style.color="";
	myTimer=setTimeout("clearmenus()",1000);
}
//location changer
function go(navUrl,newWin)
{
	if (newWin == null)
	{
		location.href = navUrl;
	}
	else if(newWin == "_blank")
	{
		myDate = new Date();
		window.open(navUrl, myDate.getTime(), 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1');
	}	
	// if(newWin=='new')
	else
	{
		// eval("newWinName = window.open(navUrl, 'new', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1');");
		newWin = window.open(navUrl, newWin, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1');
		newWin.focus();
	}

}
function moveit()
{
	//find position of main table and start dhtml there
	if(ie) 
	{
		element = document.all['dern'];
		document.getElementById('main').style.left = element.offsetLeft+"px";
	}
	else if(dom2||ns6||safari1||opera)
	{
		element = document.getElementById('dern');
		document.getElementById('main').style.left = element.offsetLeft+"px";
	}
}

//selectURL
function selectURL(sURL) 
{
	if (sURL != "") 
	{  
		location = sURL;  
	}
}
//  Load template CSS based on browser
if (ns4) {  document.write("<link rel='stylesheet' type='text/css' href='/css/templateStyleNS4.css'>");  }
else {  document.write("<link rel='stylesheet' type='text/css' href='/css/templateStyle.css'>");  }

//  Pop-up function
function popUp(URL, ww, hh) {	
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" +ww+ ",height=" +hh+ "');");
}
function popUp2(URL, ww, hh) {	
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=0,statusbar=1,menubar=1,resizable=1,width=" +ww+ ",height=" +hh+ "');");
}

// Roll-over functions
function rollOver(placeholder) {
	eval("document.images['" + placeholder + "'].src = " + placeholder + "Over.src;");
}

function rollOut(placeholder) {
	eval("document.images['" + placeholder + "'].src = " + placeholder + "Out.src;");
}