﻿/* Last published: 09 Jun 2010 10:01 */
var currentMenu = null;
function setMenuHider() {
    var links = document.getElementsByTagName("A");
    for(var i=0; i<links.length; i++) {
        if(!links[i].parentNode.parentNode.className.match("menu") && !links[i].className.match("actuator")) {
            links[i].onfocus = function() {
                if (currentMenu) {
                    currentMenu.style.visibility = "hidden";
                    currentMenu = null;
                }
            };
        }
    }
}
window.document.onmouseover= function(e) {
    var currNode ;
    if(window.event) {
        currNode=window.event.srcElement ;
    }
    if(e) {
        currNode=e.target;
    }
    while(currNode && currNode !=document.getElementById("innerMenu")) {
        currNode=currNode.parentNode ;
    }
            if (currentMenu && !currNode) {
        currentMenu.style.visibility = "hidden";
        currentMenu = null;
    }
};
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) {
    //    alert(menuId +" or "+actuatorId+ "not found") ;
    //    return;
    //    }
    actuator.onmouseover = function() {
        if (currentMenu) {
            currentMenu.style.visibility = "hidden";
        }
        this.showMenu();
    };
    actuator.onfocus = actuator.onmouseover;
    actuator.showMenu = function() {
		if (menu) {
	        menu.style.left = this.offsetLeft - 20 + "px";
	        menu.style.top = this.offsetTop + 15 + "px";
	        menu.style.visibility = "visible";
	        currentMenu = menu;
		}
    };
}
