function loadHotMenu(){
    var strFirstMenu = "";
    strFirstMenu = strFirstMenu + "<div id='hotmenutop' onmouseover='showSubHotMenu();' onmouseout='backcolor();' class='hotmenutop' onclick='clickEvent(\"/ehm.sl\",\"1\");'><span id='hotkeytopspan'>¿ì½Ý²Ëµ¥</span></div>";
    document.write(strFirstMenu);
    writeSubHotMenu();
}

function writeSubHotMenu(){
    var strSubHotMenu = "";
    strSubHotMenu = strSubHotMenu + "<table name='subhotmenu' id='subhotmenu' cellspacing='0' cellpadding='4' class='hotmenucontainer' style='display:none;z-index:5010'>";
    for(var i=0;i<objMenuNameArray.length;i++){
        if(objMenuPop[i]=="0"){
            strSubHotMenu = strSubHotMenu + "<tr name='subhotmenu' style='background-color:#ffffff;color:#" + objMenuuFontColorArray[i] + "' onclick='clickEvent(\""+objMenuAddrArray[i]+"\",\"0\");' onmouseover='moveinitem(this);' onmouseout='moveoutitem(this);'>";
        }else{
            strSubHotMenu = strSubHotMenu + "<tr name='subhotmenu' style='background-color:#ffffff;color:#" + objMenuuFontColorArray[i] + "' onclick='clickEvent(\""+objMenuAddrArray[i]+"\",\"1\");' onmouseover='moveinitem(this);' onmouseout='moveoutitem(this);'>";
        }
        strSubHotMenu = strSubHotMenu + "<td name='subhotmenu' style='border-bottom:1px solid #F2F2F2'>&nbsp;</td>";
        strSubHotMenu = strSubHotMenu + "<td name='subhotmenu' style='border-bottom:1px solid #F2F2F2'>";
        strSubHotMenu = strSubHotMenu + texttohtm1(objMenuNameArray[i]);
        strSubHotMenu = strSubHotMenu + "</td>";
        strSubHotMenu = strSubHotMenu + "<td name='subhotmenu' style='border-bottom:1px solid #F2F2F2'>&nbsp;</td>";
        strSubHotMenu = strSubHotMenu + "</tr>";
    }
    strSubHotMenu = strSubHotMenu + "</table>";
    document.write(strSubHotMenu);
}

function showSubHotMenu(){
    var objPosition = GetAbsoluteLocationEx(ge("hotmenutop"));
    ge("subhotmenu").style.top=objPosition.absoluteTop+ge("hotmenutop").offsetHeight;
    if(navigator.appName.indexOf("Internet Explore")>-1){
        ge("subhotmenu").style.left=objPosition.absoluteLeft;
    }else{
        ge("subhotmenu").style.left=objPosition.absoluteLeft+22;
    }
    ge("hotkeytopspan").style.color="#FFFFFF";
    ge("hotkeytopspan").style.backgroundColor="#0063DC";
    ge("subhotmenu").style.display="";
}

function backcolor(){
    ge("hotkeytopspan").style.color="#0063DC";
    ge("hotkeytopspan").style.backgroundColor="";
}

function closeSubHotMenu(){
    try{
        if(ge("subhotmenu")){
            ge("subhotmenu").style.display="none";
        }
    }catch(e){
    }
}

function clickEvent(strAddr,strPop){
    if(strAddr.indexOf("javascript:")==0){
        strAddr=strAddr.replace(/javascript:/g,"");
        eval(strAddr);
    }else{
        if(strPop=="0"){
            window.location.href=strAddr;
        }else{
            window.open(strAddr);
        }
    }
}

function moveinitem(el){
    el.style.backgroundColor="#EDEDED";
    //el.style.color="#0066FF";
}

function moveoutitem(el){
    el.style.backgroundColor="#ffffff";
    //el.style.color="#0065CE";
}

function gethotkeyhotmenucontent(){
    var strHotKeyMenuHTML = "";
    strHotKeyMenuHTML = strHotKeyMenuHTML + "<table cellspacing='0' cellpadding='4' class='hotmenucontainer'>";
    for(var i=0;i<objMenuNameArray.length;i++){
        if(objMenuPop[i]=="0"){
            strHotKeyMenuHTML = strHotKeyMenuHTML + "<tr style='background-color:#ffffff;color:#" + objMenuuFontColorArray[i] + "' onclick='clickEvent(\""+objMenuAddrArray[i]+"\",\"0\");' onmouseover='moveinitem(this);' onmouseout='moveoutitem(this);'>";
        }else{
            strHotKeyMenuHTML = strHotKeyMenuHTML + "<tr style='background-color:#ffffff;color:#" + objMenuuFontColorArray[i] + "' onclick='clickEvent(\""+objMenuAddrArray[i]+"\",\"1\");' onmouseover='moveinitem(this);' onmouseout='moveoutitem(this);'>";
        }
        strHotKeyMenuHTML = strHotKeyMenuHTML + "<td style='border-bottom:1px solid #F2F2F2'>&nbsp;</td>";
        strHotKeyMenuHTML = strHotKeyMenuHTML + "<td style='border-bottom:1px solid #F2F2F2'>";
        strHotKeyMenuHTML = strHotKeyMenuHTML + texttohtm1(objMenuNameArray[i]);
        strHotKeyMenuHTML = strHotKeyMenuHTML + "</td>";
        strHotKeyMenuHTML = strHotKeyMenuHTML + "<td style='border-bottom:1px solid #F2F2F2'>&nbsp;</td>";
        strHotKeyMenuHTML = strHotKeyMenuHTML + "</tr>";
    }
    strHotKeyMenuHTML = strHotKeyMenuHTML + "</table>";
    return strHotKeyMenuHTML;
}

function closehotkeyhotmenu(){
    try{
        ge("hotkeymenu").style.display="none";
    }catch(e){
    }
}

function showhotkeyhotmenu(event){
    var objTarget = event.srcElement || event.target;
    var objPosition = getMouseCoords(event);
    var objHotKeyMenu = ge("hotkeymenu");
    objHotKeyMenu.style.width = "120px";
    objHotKeyMenu.style.display = "";
    objHotKeyMenu.innerHTML = gethotkeyhotmenucontent();
    objHotKeyMenu.style.top = objPosition.y;
    objHotKeyMenu.style.left = objPosition.x;
}

function handleMove(event){
    event = event || window.event;
    var objTarget = event.srcElement || event.target;
    if(objTarget.id==undefined){
      return false;
    }
    try{
        objTarget.id.search(/mm[0-9]*/g);
    }catch(e){
        return false;
    }
    if(objTarget.id.search(/mm[0-9]*/g)>-1){
        return true;
    }else if(objTarget.id=="hotkeytopspan"){
        return true;
    }else if(objTarget.getAttribute("name")){
        if(objTarget.getAttribute("name").search(/submenu[0-9]*/g)>-1){
            return true;
        }else if(objTarget.getAttribute("name").search(/sm[0-9]*/g)>-1){
            return true;
        }else{
            try{
                hideSubMenu();
                return true;
            }catch(e){
            }
        }
    }else{
        try{
            hideSubMenu();
        }catch(e){
        }
    }
    if(objTarget.id=="hotmenutop"){
        return true;
    }else if(objTarget.getAttribute("name")){
        if(objTarget.getAttribute("name")=="subhotmenu"){
            return true;
        }else{
            closeSubHotMenu();
            return true;
        }
    }else{
        closeSubHotMenu();
        return true;
    }
    return true;
}

function handleMouseDown(event){
    var ua = navigator.userAgent.toLowerCase();
    isSafari = (ua.indexOf("safari") != -1);
    if(isSafari){
        return true;
    }
    event = event || window.event;
    if((event.ctrlKey)){
        try{
            showhotkeyhotmenu(event);
        }catch(e){
        }
        return false;
    }
}

function addcurpage(){
    var menuname = document.title || "";
    var menuaddr = location.href || "";
    window.open('/ehm.sl?n='+encodeURIComponent(menuname)+'&a='+encodeURIComponent(menuaddr));
}

document.oncontextmenu=handleMouseDown;

