var lastMenu = null;
var mustLeave = true;
var minTime = 100;
var intShow;

if (document.all)    {n=0;ie=1;ns6=0;fShow="visible";fHide="hidden";}
if (document.getElementById&&!document.all)    {n=0;ie=0;ns6=1;fShow="visible";fHide="hidden";}
if (document.layers) {n=1;ie=0;ns6=0;fShow="show";fHide="hide";}

function showMenu(idMainMenu) {		
	var menu;
			
	hideAll();
	menu = getElementById(idMainMenu);
	if(menu != null) {
		menu.style.visibility = fShow;
		mustLeave = false;
		clearInterval(intShow);
		intShow = setInterval("clearLeave()", minTime);
	}
	
	lastMenu = menu;
}

function hideAll() {		
	if ((lastMenu != null) && mustLeave) {lastMenu.style.visibility = fHide;}
}

function hideAllForce() {		
	var menu;		
	for(i=0; i < leftMenuCount; i++) {
		menu = getElementById('menu'+i);
		if(menu != null) { menu.style.visibility = fHide; }
	}
}

function clearLeave() {		
	mustLeave = true;
}

function keepShowing(idMainMenu) {
	if (lastMenu != null) {lastMenu.style.visibility = fShow;}			
}

function getElementById(idMainMenu) {
	if(n)	{ return document.layers[idMainMenu]; } 
	if(ie) { return eval(idMainMenu);	} 
	if(ns6) { return document.getElementById(idMainMenu);	}
	
	return null;
}