var currentMenu = null;
var menuCheck = false;

if (!document.getElementById)
    document.getElementById = function() { return null; }

function initializeMenu(menuId, actuatorId) {
    var menu = document.getElementById(menuId);
    var actuator = document.getElementById(actuatorId);

    if (menu == null || actuator == null) return;

    actuator.onmouseout = function() {
        menuCheck = false;
        return false;
    }
    menu.onmouseout = function() {
        menuCheck = false;
        return false;
    }
  
    actuator.onmouseover = function() {
        if (currentMenu != null) {
			currentMenu.style.visibility = "hidden";
        }
        menuCheck = true;
        this.showMenu();
        return false;
    }
    
    menu.onmouseover = function() {
        menuCheck = true;
        return false;
    }

    actuator.showMenu = function() {
        menu.style.left = this.offsetLeft + 50 + "px";
        menu.style.top = this.offsetTop + this.offsetHeight + 160 + "px";
        menu.style.visibility = "visible";
        currentMenu = menu;
        document.title = currentMenu.id;
        return false;
    }
}

function close_menu()
{
	if(!menuCheck && currentMenu != null)
	{
		//alert("Close: " + menuCheck);
		currentMenu.style.visibility = "hidden";
		currentMenu = null;
	}
	return false;
}

setInterval("close_menu()", 400);