var g_activemnu='';
menuDelay = null;
var showDelay = 1;
var hideDelay = 200;

var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ieX = ie4||ie5;
var ns6 = (!document.all && document.getElementById);

if(ns4){origWidth=innerWidth;origHeight=innerHeight;onresize=function(){if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload()}}

function getElement(id,doc) {
	if (!doc) { doc = document; }
	if (ie5||ns6)
		return(doc.getElementById(id));
	else if (ie4)
		return(doc.all[id]);
	else if (ns4)
		return(doc.layers[id]);
	else
		return null;
}

function styleObject(e) {
	return (ns4 ? e : e.style);
}

function showElement() {
	var e = getElement('mnu'+g_activemnu); 
	if (e) {
		cancelDelay();
		so = styleObject(e);
		so.visibility = "visible";
		so.zIndex = 10;
	}else
	alert(g_activemnu);
}

function showElementDelayed(){
	
	menuDelay = window.setTimeout("showElement()",showDelay);
}

function hideElement(e) {
	
so = styleObject(e);
	so.visibility = "hidden";
	so.zIndex = -1;
}

function menuSafeBrowser() {
	if (ie4 || ie5 || ns6) { return true; }
	return false;
}

function hideMenus() {
	var i,e,code;
	cancelDelay();
	g_activemnu='';	

	for (i = menuList.length; i--;) {
		code = menuList[i];
		e = getElement(code);
		if (e) { hideElement(e,true);
		 }
	}	
}

function menuOver(mnu) {

	if (!menuSafeBrowser()) { return; }
	hideMenus();
	if (!mnu) { return; }
	
	e = getElement('mnu'+mnu);
	g_activemnu=mnu;
	if (e) { 
		showElementDelayed(); 
	}
}

function menuOut() {
	if (!menuSafeBrowser()) { return; }
	hideMnusDelayed();
}

function hideMnusDelayed() {
	if (!menuSafeBrowser()) { return; }
	cancelDelay();
	menuDelay = window.setTimeout("hideMenus()",hideDelay);
}

function cancelDelay() {
	window.clearTimeout(menuDelay);
}
