﻿

var activesubmenu = '';
var activemenus = new Array();

function loadmenu() {
    var menuh = document.getElementById('menuh');
    var lis = menuh.getElementsByTagName('LI');
    var l = lis.length;
    
 
    
    for(i = 0;i < l;i++) {
        if (lis[i].childNodes[0].className == 'top_parent' || lis[i].childNodes[0].className == 'parent') {
            lis[i].onmouseover = function() {
                if (this.className != 'liulhover') {
                    this.className = 'liulhover';                    
                }
                clearTimeout(activemenus[this.id]);
                if (this.id != 'menu0' && activesubmenu != this.id) {
                    if (activesubmenu != '') {
                        document.getElementById(activesubmenu).className = '';
                    }
                    activesubmenu = this.id;
                }
            }
            lis[i].onmouseout = function() {
                if (this.className == 'liulhover') {
                    activemenus[this.id] = setTimeout("hidemenu('" + this.id + "')", 1000);
                    
                }
            }
        }
    }
}

function hidemenu(id) {
    var o = document.getElementById(id);
    if (o.className == 'liulhover') {
        o.className = '';
        if (this.id == activesubmenu) {
            activesubmenu = '';
        }
    }
}

window.onload = loadmenu;