var NS4;
var IE4;
if (document.all)
{
    IE4 = true;
    NS4 = false;
}
else
{
    IE4 = false;
    NS4 = true;
}
isWin = (navigator.appVersion.indexOf("Win") != -1)

if (IE4) 
{
    document.onclick = MouseDown;
}
else if (NS4) 
{
    document.captureEvents(Event.CLICK)
    document.onclick = MouseDown;
} 

var n_tid = "";

function laymenu(memberid) 
{
    n_tid = memberid;
}

function goMenu(key) 
{
    switch(key) 
    {
        case "submenu1" :
            goMypage(n_tid);
            break;
        case "submenu2" :
            sendMessage(n_tid);
            break;
        case "submenu3" :
            addFriend(n_tid);
            break;
    }

}
// Mypage °¡±â
function goMypage(id) {
	window.open("/mypage/mypage_index.asp?fid="+id,"mypage","width=517 height=623 scrollbars=yes menubar=no");
}

// Ä£±¸¿¡°Ô ÂÊÁö º¸³»±â
function sendMessage(id) {
	window.open("/mypage/Message/mypage_send_message2.asp?toid="+id,"sendmessage","width=480 height=183 scrollbars=no menubar=no");
}

// Ä£±¸ Ãß°¡ÇÏ±â
function addFriend(id) {
	document.location.href = "/mypage/Friend/friend_succ.asp?cat=input&fid=" + id;									
}

var mouse_top;
var mouse_left;
var scroll_top;
var scroll_left;
var event_id = "none";
var status_over = false;    
var parent_menu_name = "menu_parent";
var column_height = 18;
var mainmenu_top_indent = 0;    

function MouseDown(e) 
{
    if (!e) e = window.event;
    event_target = (NS4) ? e.target : e.srcElement;
    event_target = event_target.toString();
    event_check = event_target.indexOf("javascript:laymenu(");        
    
    if (!status_over) hiddenAllLay();
    if (!event_check) 
        viewMenu(e,  parent_menu_name);
    else 
    {
        if (!status_over) hiddenAllLay();
        return;
    }
}    

function hiddenAllLay() 
{
    eval("document.getElementById('" + parent_menu_name + "').style.display = \"none\"");
    if (event_id == "none") return;
    var menu_len = child_menu_array.length;
    for (i=0; i<menu_len; i++) 
        eval("document.getElementById('" + child_menu_array[i] + "').style.display = \"none\"");
}

function viewMenu(e, ar_id) 
{
    if (ar_id == "none") return;
    menuLocBod = window.document.body;
    xPos = menuLocBod.scrollLeft + e.clientX;
    yPos = e.clientY + menuLocBod.scrollTop;
    screen_height = window.document.body.offsetHeight;
    screen_width = window.document.body.offsetWidth;
    mouse_top = e.y;
    mouse_left = e.x;
    mainmenu_top_indent = eval("document.getElementById('" + parent_menu_name + "').childNodes[0].childNodes[0].childNodes.length");
    mainmenu_top_indent = mainmenu_top_indent * column_height;
    if (screen_height > mouse_top + mainmenu_top_indent) 
        yPos = e.clientY + menuLocBod.scrollTop;
    else
        yPos = (e.clientY + menuLocBod.scrollTop) - mainmenu_top_indent;

    if (mouse_top - mainmenu_top_indent < 0) 
        yPos = e.clientY + menuLocBod.scrollTop;

    var objMenu = eval("document.getElementById('" + ar_id + "')");
    objMenu.style.top = yPos;
    objMenu.style.left = xPos;
    objMenu.style.display = "";
}


document.write("<div id=\"menu_parent\" style=\"position:absolute;display:none;top:0;left:0;z-index:0;\">");
document.write("<table border=0 cellspacing=0 cellpadding=0 width=300>");
document.write("  <tr> ");
document.write("    <td>");
document.write("	  <table border=0 cellpadding=0 cellspacing=2 bgcolor=#a67c52>");
document.write("        <tr> ");
document.write("          <td align=center bgcolor=#eee2dF><table border=0 cellspacing=0 cellpadding=3>");
document.write("              <tr> ");
document.write("                <td class=smfont><img src=../img/icon_house.gif width=14 height=10><a href=\"javascript:goMenu('submenu1');\">Mypage ");
document.write("                  º¸±â</a> </td>");
document.write("              </tr>");
document.write("              <tr> ");
document.write("                <td height=1 bgcolor=B2B2B2></td>");
document.write("              </tr>");
document.write("              <tr> ");
document.write("                <td class=smfont><img src=../img//icon_label.gif width=14 height=10><a href=\"javascript:goMenu('submenu2');\">ÂÊÁö ");
document.write("                  º¸³»±â</a></td>");
document.write("              </tr>");
document.write("              <tr> ");
document.write("                <td height=1 bgcolor=B2B2B2></td>");
document.write("              </tr>");
document.write("              <tr> ");
document.write("                <td class=smfont><img src=../img/icon_friend.gif width=14 height=10><a href=\"javascript:goMenu('submenu3');\">Ä£±¸ ");
document.write("                  µî·ÏÇÏ±â</a></td>");
document.write("              </tr>");
document.write("            </table>");
document.write("		  </td>");
document.write("        </tr>");
document.write("      </table>");
document.write("	</td>");
/*document.write("        <td width=3 height=100%>");
document.write("	 <table width=3 height=100% border=0 cellspacing=0 cellpadding=0>");
document.write("        <tr> ");
document.write("          <td height=3></td>");
document.write("        </tr>");
document.write("        <tr> ");
document.write("          <td bgcolor=666666></td>");
document.write("        </tr>");
document.write("      </table>");
document.write("	</td>");*/
document.write("  </tr>");
document.write("  <tr> ");
document.write("    <td colspan=2 height=3 style=background-image: url(../gt_images/user_line01.gif); background-repeat: no-repeat; background-position: right top></td>");
document.write("  </tr>");
document.write("</table>");
document.write("</div>");
                                         


