var __showing__menu=null;

function showMenu(parentObj, menuId) {
	if (menuId==__showing__menu)
		return;
	var obj=document.getElementById(menuId);
	if (obj!=null) {
		__showing__menu=menuId;
	} else {
		__showing__menu=null;
		return;
	}
	var pos=getPosition(parentObj);
	obj.style.top=(pos.top+60)+"px";
	obj.style.left=pos.left+"px";
	obj.style.zIndex=0;
    	obj.style.visibility="visible";
	animateShow(menuId,1);
}

function hideMenu() {
	if (__showing__menu==null) return;
	var obj=document.getElementById(__showing__menu);
	var elements=new Array(0);
	elements.push(__showing__menu);
	if (obj.showingMenu!=null) {
		elements=hideSubMenus(elements,obj.showingMenu);
		obj.showingMenu=null;
	}
	for (var i=elements.length-1;i>=0;i--){
		setTimeout('animateHide("'+elements[i]+'",1)',(elements.length-i)*500);
	}
}

function showSubMenu(parentObj, menuId) {
	var menuNode=parentObj.parentNode;
	if (menuNode.showingMenu!=null && menuNode.showingMenu==menuId)
		return;
	if (menuNode.showingMenu!=null)
		setTimeout('animateHide("'+menuNode.showingMenu+'",1)');
	var pos=getPosition(parentObj);
	var obj=document.getElementById(menuId);
	obj.style.top=(pos.top+30)+"px";
	obj.style.left=pos.left+"px";
	obj.style.zIndex=0;
    obj.style.visibility="visible";
	menuNode.showingMenu=menuId;
	animateShow(menuId,1);
}	

function hideSubMenus(elements, menuId) {
	var obj=document.getElementById(menuId);
	if (obj==null)
		return;
	if (obj.showingMenu!=null) {
		hideSubMenus(obj.showingMenu);
		obj.showingMenu=null;
	}
	elements.push(menuId);
	return elements;
}

function processMenu(obj, menuId) {
	MoveLightTo(obj);
	if (__showing__menu==menuId)
		return;
	hideMenu();
        //if (document.getEementb)
	showMenu(obj, menuId)
}

function menuItemMouseOver(obj){
	var parent=obj.parentNode;
	animateShow(parent.getAttribute("id"),1);
}

