function menuInit() {
    var menu = window.document.getElementById("menu");
    var divs = menu.getElementsByTagName("DIV");
    for (var i = 0; i < divs.length; i++) {
        if (divs[i].className == "dropdown_menu") {
            var dropDown = divs[i];
            dropDown.onmouseover = function () {
                this.isOpen = false;
                this.isShown = true;
                this.style.visibility = 'visible';
            }
            dropDown.onmouseout = function () {
                this.isShown = false;
                if (!this.isOpen && !this.isShown) {
                    this.style.visibility = 'hidden';
                }
            }
            var label = dropDown.previousSibling;
            label.onmouseover = function () {
                var dropDown = this.nextSibling;
                dropDown.isOpen = true;
                dropDown.isShown = false;
                dropDown.style.top = (findElementPosition(this).y  + this.offsetHeight) + "px";
                dropDown.style.left = findElementPosition(this).x + "px";
                dropDown.style.visibility = 'visible';
            }
            label.onmouseout = function () {
                var dropDown = this.nextSibling;
                dropDown.isOpen = false;
                if (!dropDown.isOpen && !dropDown.isShown) {
                    dropDown.style.visibility = 'hidden';
                }
            }
        }
    }
}

function findElementPosition(element) {
    var position = {x: 0, y: 0};
    while (element) {
        position.x += element.offsetLeft;
        position.y += element.offsetTop;
        element = element.offsetParent;
    }
    return position;
}
