/*Einstellungen*/
var classOpen = "active";
var classSubnav = "sub";
var navList;
var aktTimeOut = false;
var oldEL = false;
var displayOLD = "";
var displayNEW = "block";

function loadDynNav(elid) {
    navList = document.getElementById(elid);
    if (navList) {
        loadJSforChilds(navList);
    }
}

function loadJSforChilds(el) {
    if (el) {
        //Javascript den Unterpunkten hinzufuegen
        var childs1 = el.childNodes;
        for (i = 0; i < childs1.length; i++) {
            if (childs1[i].nodeName.toUpperCase() == "LI") {
                var childs2 = childs1[i].childNodes;
                var check = false;
                for (j = 0; j < childs2.length; j++) {
                    if (childs2[j].nodeName.toUpperCase() == "UL") {
                        check = true;
                    }
                }
                if (check) {
                    childs1[i].onmouseover = new Function ("showMenu(this)");
                    childs1[i].onmouseout = new Function ("hideMenu()");
                    //childs1[i].setAttribute("onmouseout", "");
                    //childs1[i].setAttribute("onmouseover", );
                    //childs1[i].setAttribute("onmouseout", "hideMenu()");
                }
            }
        }
    }
}

function showMenu(el) {
    if (aktTimeOut) window.clearTimeout(aktTimeOut);
    aktTimeOut = false;
    if (el.nodeName.toUpperCase() == "LI") {
        hideMenuNow();
        oldEL = el;
        showSubmenu(el);
    }
}

function hideMenu() {
    //hideMenuNow();
    aktTimeOut = window.setTimeout("hideMenuNow()", 250);
}

function hideMenuNow() {
    if (oldEL) {
        hideSubmenu(oldEL);
    }
}

function showSubmenu(el) {
    if (el) {
        var childs1 = el.childNodes;
        for (i = 0; i < childs1.length; i++) {
            if (childs1[i].nodeName.toUpperCase() == "UL") {
                displayOLD = childs1[i].style.display;
                childs1[i].style.display = displayNEW;
            }
        }
    }
}

function hideSubmenu(el) {
    if (el) {
        var childs1 = el.childNodes;
        for (i = 0; i < childs1.length; i++) {
            if (childs1[i].nodeName.toUpperCase() == "UL") {
                childs1[i].style.display = displayOLD;
            }
        }
    }
}
