var LastMenu=null;

function window_onscroll()
{
	MainMenu.style.top=document.body.scrollTop;
	hideAll();
}

function DisplaySubmenu(submenuId,MenuLeft)
{
	var posLeft;
	var x=MainMenu.offsetHeight+MainMenu.style.posTop-1;
	posLeft=MenuLeft;
	if (LastMenu!=null && LastMenu!=submenuId) {
		LastMenu.filters.alpha.opacity=0
		LastMenu.style.display="none"
	}
	if (LastMenu!=submenuId){
		LastMenu=submenuId;
		submenuId.style.top=x;
		submenuId.style.left=posLeft;
		unfade(submenuId);
	}
}

function unfade(TableID)
{
	TableID.style.display=""
	TableID.filters.alpha.opacity=TableID.filters.alpha.opacity+5;
	TDef = TableID;
	if (TableID.filters.alpha.opacity != 100) rol=setTimeout("unfade(TDef)",1);
}
function ClearLastMenu()
{
	var y = window.event.clientY;
	if (y<11) {
		clearTimeout(rol)
		LastMenu.filters.alpha.opacity=0
		LastMenu.style.display="none"
		LastMenu=null;
	}	
}
function hideAll()
{
	if (LastMenu!=null) {
		clearTimeout(rol)
		LastMenu.filters.alpha.opacity=0
		LastMenu.style.display="none"
		LastMenu=null;
	}	
}

if (document.all)
{
	document.onclick=hideAll;
	document.onscroll=hideAll;
	document.onmousemove=Lasttreak;
}

function curserCheker(x,y,IDx)
{
	var LimXL=IDx.offsetLeft+7
	var LimXR=IDx.offsetLeft+IDx.offsetWidth-7
	var LimY=IDx.offsetHeight+IDx.offsetTop-3
	if ( x < LimXL || x > LimXR) hideAll();
	else if (y > LimY) hideAll();
}

function Lasttreak()
{
	if (event.clientY>133) hideAll();
}



