var isIE	= document.all;
var isIE6	= isIE && document.implementation;
var isIE5	= isIE && window.print && !isIE6; 
var isIEDOM2	= isIE5 || isIE6;
var isIE4	= isIE && !isIEDOM2 &&
		  navigator.cookieEnabled;
var isIE3	= isIE && !isIE4 && !isIEDOM2;
var isNS	= navigator.mimeTypes && !isIE;
var isNS3	= isNS && !navigator.language;
var isNS4	= document.layers;
var isNS6	= document.getElementById && !isIE;
var isNS7	= isNS6;
var isNS71	= document.designMode;
var isNSDOM2	= isNS6;
var isDOM2	= isIEDOM2 || isNSDOM2;



// get's element by ID
function getEid(ID)
{
  return document.getElementById(ID) ? document.getElementById(ID) :
	    (isNS4 ? document.layers[ID] :
			   document.all[ID]);
}
function getEstyle(ID) 
{
  return document.getElementById(ID) ? document.getElementById(ID).style :
	    (isNS4 ? document.layers[ID].style :
			   document.all[ID].style);
			   
}
function hideEid(ID)
{
	getEstyle(ID).display="none";
}
function showEid(ID)
{
	getEstyle(ID).display="";
}
function FindTarget(e)
{
	return e.srcElement ? e.srcElement : e.target ;
}


/// Menu Specific:
var fregex_on = /^.*_on\.\w{3,4}$/i;
var MenuBtnOff = true, MenuChoicesOff = true;
var SubBtnOff = true, SubChoicesOff = true;

var ActiveMenu="";
var ActiveSub = "";
var ActiveMOpt,ActiveMOptID;


function windowResize()
{
if(isNS||window.opera)
{
	getEstyle("MenuDrops").left=parseInt(getEid("MenuTops").offsetLeft)+0+"px";
	getEstyle("footerMENU").left=parseInt(getEid("footerbg").offsetLeft)+0+"px";
	getEstyle("footerMENU").top=parseInt(getEid("footerbg").offsetTop)-115+"px";
}
else
{
	getEstyle("MenuDrops").left=parseInt(getEid("MenuTops").offsetLeft)+10+"px";
	getEstyle("footerMENU").left=parseInt(getEid("footerbg").offsetLeft)+0+"px";
	getEstyle("footerMENU").top=parseInt(getEid("footerbg").offsetTop)-115+"px";
}
//alert();
}

function ShowUpMenu(id,sender,Y)
{
    
	if (ActiveSub!="")
		hideEid(ActiveSub);
	if (ActiveMenu!="")
		hideEid(ActiveMenu);
	ActiveMenu=id;
	MenuBtnOff=false;
	showEid(id);
	windowResize();
	//getEstyle(id).left=getEid(sender).offsetLeft+125;
	//getEstyle(id).top=getEid(sender).offsetTop;
}

function ShowAMenu(id)
{
    
	if (ActiveSub!="")
		hideEid(ActiveSub);
	if (ActiveMenu!="")
		hideEid(ActiveMenu);
	ActiveMenu=id;
	MenuBtnOff=false;
	showEid(id);
	windowResize();
}
function HideAMenu(id)
{
	if(ActiveMenu==id && MenuBtnOff && MenuChoicesOff)
		hideEid(id);
}

function ExecMenusOff()
{
	SubClose("PT.sub");
	SubClose("ET.sub");
	SubClose("Seat.sub");
	SubClose("Light.sub");
	SubClose("Support.sub");
	HideAMenu("ProdMenu");
	HideAMenu("CSMenu");
	HideAMenu("NewsMenu");
	HideAMenu("ContactMenu");
	HideAMenu("DownloadsMenu");
}
function MenusOff(src)
{
	if (src==0)
		MenuBtnOff=true;
	if (src==1)
		MenuChoicesOff=true;
	if(src==2)
		SubBtnOff=true;
	if(src==3)
		SubChoicesOff=true;
	window.setTimeout(ExecMenusOff, 700);
}

function TableOff()
{
	MenusOff(1);
	MenusOff(2);
//	alert ("table!");
}

function SubOpen(id)
{
	ActiveSub=id;
	SubBtnOff=false;
	showEid(id);
	
	getEstyle(id).position="absolute"
	getEstyle(id).left=parseInt(getEid(ActiveMOptID).offsetLeft)+151*2+"px";
	if(isNS)
		getEstyle(id).top=parseInt(getEid(ActiveMOptID).offsetTop)-0+"px";
	else
		getEstyle(id).top=parseInt(getEid(ActiveMOptID).offsetTop)-0+"px";
}
function SubClose(id)
{
	if(ActiveSub==id && SubBtnOff && SubChoicesOff)
		hideEid(id);
}

function SpaceOver(e)
{
	if (ActiveSub!="")
		hideEid(ActiveSub);
	if(ActiveMOpt)
		ActiveMOpt.backgroundColor="transparent";
	
	
	MenuChoicesOff = false;
	ActiveMOpt=getEstyle(e);
	ActiveMOptID=e;
}

function SpaceOut(e)
{
	MenusOff(1);
	MenusOff(2);
}

function NMenuOver(e)
{
	if (ActiveSub!="")
		hideEid(ActiveSub);
	if(ActiveMOpt)
		ActiveMOpt.backgroundColor="transparent";
	
	
	MenuChoicesOff = false;
	ActiveMOpt=getEstyle(e);
	ActiveMOptID=e;
	getEstyle(e).backgroundColor="#545353";
}

function NMenuOff(e)
{
	MenusOff(1);
	MenusOff(2);
	getEstyle(e).backgroundColor="transparent";
}


function SubOver(e)
{
	SubChoicesOff = false;
	MenuChoicesOff = false;
	
	ActiveMOpt.backgroundColor="#545353";
	getEstyle(e).backgroundColor="#2c2c2c";
}

function SubOff(e)
{
	MenusOff(1);
	MenusOff(3);
	getEstyle(e).backgroundColor="#545353";
}