var now	= new Date();
var tid	= now.getTime();
var ns4 = (document.layers) ? true:false;
var ie4 = (document.all) ? true:false;
var xInitArray = new Array();

function openWin(windowURL, windowName, windowFeatures)
{
	return window.open(windowURL, windowName, windowFeatures) ;
}

function MSIEVersion()
{
	var ua		= window.navigator.userAgent;
	var msie	= ua.indexOf("MSIE ");

	if (msie > 0)
		return parseInt(ua.substring(msie+5, ua.indexOf (".", msie )));
	else // If another browser, return 0
		return 0;
}

// use xInit_add("function"); to add init functions
function init()
{
	// xInit
	for (i = 0; i < xInitArray.length; i++)
	{
		eval(xInitArray[i] + "();");
	}
}

function xInit_add(functionname)
{
	xInitArray[xInitArray.length] = functionname;
}

//names of dropdowns stored here
tle_droplayer=new Array()
tle_droplayer[0]="drop1"
tle_droplayer[1]="drop2"
tle_droplayer[2]="drop3"
tle_droplayer[3]="drop4"
tle_droplayer[4]="drop5"
tle_droplayer[5]="drop6"
tle_droplayer[6]="drop7"
tle_droplayer[7]="drop8"
//simple browser guess
tle_ie=(document.all)?1:0
tle_ns=(document.layers)?1:0
tle_ghey=(!tle_ie && !tle_ns)?1:0
//code for drops
function tle_showdrop(thelayer){
	tle_keep=thelayer; tle_hideall(); tle_showitnow=1
	tle_showit(thelayer)
		}
function tle_showit(thelayer){
		if(tle_ns){ eval('document.'+tle_droplayer[thelayer]+'.visibility="show"');}
		if((tle_ghey)||(tle_ie)){ eval('document.getElementById("'+tle_droplayer[thelayer]+'").style.visibility="visible"');}

	}
function tle_hidedrop(){
	tle_keep=-1; setTimeout('tle_hideall();',1000)
		}
tle_keep=-1
function tle_hideall(){
	for(i=0;i<tle_droplayer.length;i++){
		tle_hideit=0; tle_checkmousepos(i)
		if(tle_ns && tle_keep!=i){
			if(tle_hideit){ eval('document.'+tle_droplayer[i]+'.visibility="hide"') }
			}
		if(((tle_ghey)||(tle_ie)) && tle_keep!=i){
			if(tle_hideit){ eval('document.getElementById("'+tle_droplayer[i]+'").style.visibility="hidden"');}
			}
		}
	}
//deal with cursor over layer
document.onmousemove = tle_getmousepos
if (tle_ns) document.captureEvents(Event.MOUSEMOVE)
if (tle_ghey) document.captureEvents(Event.MOUSEMOVE)
function tle_getmousepos(e){
	if(tle_ns){tle_mousex=e.pageX; tle_mousey=e.pageY}
	if(tle_ie){tle_mousex=event.clientX; tle_mousey=event.clientY;}
	if(tle_ghey){tle_mousex=e.pageX; tle_mousey=e.pageY}
	}
function tle_checkmousepos(i){
	if(tle_ns){
		tle_x_min=eval('document.'+tle_droplayer[i]+'.left')
		tle_x_max=tle_x_min+eval('document.'+tle_droplayer[i]+'.clip.width')
		tle_y_min=eval('document.'+tle_droplayer[i]+'.top')
		tle_y_max=tle_y_min+eval('document.'+tle_droplayer[i]+'.clip.height')
		}
	if((tle_ghey)||(tle_ie)){
		tle_x_min=eval('document.getElementById("'+tle_droplayer[i]+'").left')
		tle_x_max=tle_x_min+eval('document.getElementById("'+tle_droplayer[i]+'").width')
		tle_y_min=eval('document.getElementById("'+tle_droplayer[i]+'").top')
		tle_y_max=tle_y_min+eval('document.getElementById("'+tle_droplayer[i]+'").height')
		}
	if (tle_mousex>=tle_x_min && tle_mousex<=tle_x_max && tle_mousey>=tle_y_min && tle_mousey<=tle_y_max){
		tle_hideit=0; setTimeout('tle_hideall()',1000)
		}
	else { tle_hideit=1 }
	return tle_hideit
	}
// class swappage on mousevents
function ovr2(what){
	what.className='ovr2';
	}
function out2(what){
	what.className='out2';
	}
function clk2(what){
	what.className='clk2';
	}
//browser stylesheets
if((tle_ghey)||(tle_ie)) document.write('<link rel="STYLESHEET" type="text/css" href="https://www.terrasip.com/layout/tle.menu.ie.css">')
if(tle_ns) document.write('<link rel="STYLESHEET" type="text/css" href="https://www.terrasip.com/layout/tle.menu.ns.css">')

