var gstrTargetName        = "";
var gstrMyselfName      = "";
var gstrMenuName = "dropmenu01";
var nMouseEvent = 0;
var gstrNickName = "";

function dropit2(strTargetName, strMyselfName, nViewCode, strNickName)
{
	gstrTargetName   = strTargetName;
  	gstrMyselfName   = strMyselfName;
	gstrNickName = strNickName;


  	if (strTargetName == strMyselfName)
  	{
    	nViewCode +="a";
  	}
  	else
  	{
    	nViewCode +="b";
  	}

  	switch(nViewCode)
  	{
    	case "1b" : gstrMenuName = "dropmenu01"; break;
    	case "0b" : gstrMenuName = "dropmenu02"; break;
    	case "1a" : gstrMenuName = "dropmenu03"; break;
    	case "0a" : gstrMenuName = "dropmenu04"; break;
    	default   : gstrMenuName = "dropmenu01";
  	}

	try
    {
		document.getElementById(gstrMenuName).style.pixelLeft = (document.body.scrollLeft+event.clientX)-25;
		document.getElementById(gstrMenuName).style.pixelTop = (document.body.scrollTop+event.clientY)-8;

        dropmenu01.style.visibility="hidden";
        dropmenu02.style.visibility="hidden";
        dropmenu03.style.visibility="hidden";
        dropmenu04.style.visibility="hidden";

        if (document.getElementById(gstrMenuName).style.visibility=="hidden")
        {
			showmenu();
            showSelects_mybox_ict(false);
        }
        else
        {
            hidemenu();
        }
    }
	catch(e) {}
}

function showmenu()
{
	document.getElementById(gstrMenuName).style.visibility="visible";
}

function hidemenu()
{
    showSelects_mybox_ict(true);
    if ((gstrMenuName != "dropmenu01")&&(gstrMenuName != "dropmenu02")&&(gstrMenuName != "dropmenu03")&&(gstrMenuName != "dropmenu04"))
    {
        gstrMenuName = "dropmenu01";
    }
    document.getElementById(gstrMenuName).style.visibility="hidden";
}

function setMouseEvent()
{
    nMouseEvent = 1;
}

function showSelects_mybox_ict(bVisible)
{
	if( document.URL.indexOf("needAuth/list_box.cgi") != -1 )
	{
		try
		{
			document.all.favoriteIframe.runtimeStyle.visibility = bVisible ? "" : "hidden";
		}
		catch (e) {}

		try
		{

			document.all.otherIframe.runtimeStyle.visibility = bVisible ? "" : "hidden";
			document.all.myIframe.runtimeStyle.visibility = bVisible ? "" : "hidden";
		}
		catch(e) {}
	}
}

//°Ô½ÃÆÇÀÌ¸é¼­ ³²¿¡²¨ viewCode=1b
document.write("<div id=\"dropmenu01\" style='position:absolute; left:10px; top:0px; width:120px; height:0px; z-index:1000; visibility: hidden' >");
document.write("<table border=0><tr><td colspan='3' height='3'></td></tr><tr><td width='5' rowspan='2'></td><td height='5'></td></tr><tr><td><table style='cursor:hand' border='0' cellspacing='1' cellpadding='0' width='100%' height='100%'><tr><td valign='top' bgcolor='white'><table border='0' cellspacing='0' cellpadding='0' width='100%' height='100%' style='border:1px solid #888888;'>");
document.write("<tr onclick=\"zbLayer_GoMyBs(gstrTargetName);\" onmouseover=\"na_change_img_src('image1b_3', 'document', '" + AFREECA + "/mybs/img_btn/context_w2.gif', true);\" onmouseout=\"na_restore_img_src('image1b_3', 'document', '" + AFREECA + "/mybs/img_btn/context_w.gif')\"><td><img name='image1b_3' id='image1b_3' border='0' src='" + AFREECA + "/mybs/img_btn/context_w.gif' width='120' height='25' alt='¹æ¼Û±¹ ±¸°æ°¡±â'/></td></tr>");
document.write("<tr onclick=\"zbLayer_IdSearch(gstrNickName);\" onmouseover=\"na_change_img_src('image1b_1', 'document', '" + AFREECA + "/mybs/img_btn/context_nic2.gif', true);\" onmouseout=\"na_restore_img_src('image1b_1', 'document', '" + AFREECA + "/mybs/img_btn/context_nic.gif')\"><td><img name='image1b_1' id='image1b_1' border='0' src='" + AFREECA + "/mybs/img_btn/context_nic.gif' width='120' height='25' alt='´Ð³×ÀÓÀ¸·Î°Ë»ö'/></td></tr>");
document.write("<tr onclick=\"zbLayer_SendNote(gstrTargetName);\" onmouseover=\"na_change_img_src('image1b_2', 'document', '" + AFREECA + "/mybs/img_btn/context_memo2.gif', true);\" onmouseout=\"na_restore_img_src('image1b_2', 'document', '" + AFREECA + "/mybs/img_btn/context_memo.gif')\"><td><img name='image1b_2' id='image1b_2' border='0' src='" + AFREECA + "/mybs/img_btn/context_memo.gif' width='120' height='25' alt='ÂÊÁöº¸³»±â'/></td></tr>");
document.write("</table></td></tr></table></td><td width='5' rowspan='2'></td></tr><tr><td colspan='3' height='10'></td></tr></table>");
document.write("</div>");

//°Ô½ÃÆÇ ¾Æ´Ï¸é¼­ ³²¿¡²¨ viewCode=0b
document.write("<div id=\"dropmenu02\" style='position:absolute; left:10px; top:0px; width:120px; height:0px; z-index:1000; visibility: hidden' >");
document.write("<table border=0><tr><td colspan=3  height=3></td></tr><tr><td width=5 rowspan=2>&nbsp;</td><td height=5></td></tr><tr><td><table style=cursor:hand border='0' cellspacing='1' cellpadding='0' width=100% height=100%><tr><td valign=top bgcolor=white><table border=0 cellspacing=0 cellpadding=0 width=100% height=100% style='border:1px solid #888888;'>");
document.write("<tr onclick=\"zbLayer_GoMyBs(gstrTargetName);\" onmouseover=\"na_change_img_src('image0b_3', 'document', '" + AFREECA + "/mybs/img_btn/context_w2.gif', true);\" onmouseout=\"na_restore_img_src('image0b_3', 'document', '" + AFREECA + "/mybs/img_btn/context_w.gif')\"><td><img name='image0b_3' id='image0b_3' border='0' src='" + AFREECA + "/mybs/img_btn/context_w.gif' width='120' height=25 alt='¹æ¼Û±¹ ±¸°æ°¡±â'/></td></tr>");
document.write("<tr><td><img name='image0b_1' id='image0b_1' border='0' src='" + AFREECA + "/mybs/img_btn/context_nic3.gif' width='120' height='25' alt='´Ð³×ÀÓÀ¸·Î°Ë»ö'/></td></tr>");
document.write("<tr onclick=\"zbLayer_SendNote(gstrTargetName);\" onmouseover=\"na_change_img_src('image0b_2', 'document', '" + AFREECA + "/mybs/img_btn/context_memo2.gif', true);\" onmouseout=\"na_restore_img_src('image0b_2', 'document', '" + AFREECA + "/mybs/img_btn/context_memo.gif')\"><td><img name='image0b_2' id='image0b_2' border='0' src='" + AFREECA + "/mybs/img_btn/context_memo.gif' width='120' height='25' alt='ÂÊÁöº¸³»±â'/></td></tr>");
document.write("</table></td></tr></table></td><td width=5 rowspan=2>&nbsp;</td></tr><tr><td colspan=3 height=10></td></tr></table>");
document.write("</div>");

//°Ô½ÃÆÇÀÌ¸é¼­ ³»²¨ viewCode=1a
document.write("<div id=\"dropmenu03\" style='position:absolute; left:10px; top:0px; width:120px; height:0px; z-index:1000; visibility: hidden' >");
document.write("<table border=0><tr><td colspan=3  height=3></td></tr><tr><td width=5 rowspan=2>&nbsp;</td><td height=5></td></tr><tr><td><table style=cursor:hand border='0' cellspacing='1' cellpadding='0' width=100% height=100%><tr><td valign=top bgcolor=white><table border=0 cellspacing=0 cellpadding=0 width=100% height=100% style='border:0px solid #888888;'>");
document.write("<tr onclick=\"zbLayer_GoMyBs(gstrTargetName);\" onmouseover=\"na_change_img_src('image1a_3', 'document', '" + AFREECA + "/mybs/img_btn/context_w2.gif', true);\" onmouseout=\"na_restore_img_src('image1a_3', 'document', '" + AFREECA + "/mybs/img_btn/context_w.gif')\"><td><img name='image1a_3' id='image1a_3' border='0' src='" + AFREECA + "/mybs/img_btn/context_w.gif' width='120' height='25' alt='¹æ¼Û±¹ ±¸°æ°¡±â'/></td></tr>");
document.write("<tr onclick=\"zbLayer_IdSearch(gstrNickName);\" onmouseover=\"na_change_img_src('image1a_1', 'document', '" + AFREECA + "/mybs/img_btn/context_nic2.gif', true);\" onmouseout=\"na_restore_img_src('image1a_1', 'document', '" + AFREECA + "/mybs/img_btn/context_nic.gif')\"><td><img name='image1a_1' id='image1a_1' border='0' src='" + AFREECA + "/mybs/img_btn/context_nic.gif' width='120' height='25' alt='´Ð³×ÀÓÀ¸·Î°Ë»ö'/></td></tr>");
document.write("<tr><td><img name='image1a_2' id='image1a_2' border='0' src='" + AFREECA + "/mybs/img_btn/context_memo3.gif' width='120' height='25' alt='ÂÊÁöº¸³»±â'/></td></tr>");
document.write("</table></td></tr></table></td><td width=5 rowspan=2>&nbsp;</td></tr><tr><td colspan=3 height=10></td></tr></table>");
document.write("</div>");

//°Ô½ÃÆÇ ¾Æ´Ï¸é¼­ ³»²¨ viewCode=0a
document.write("<div id=\"dropmenu04\" style='position:absolute; left:10px; top:0px; width:120px; height:0px; z-index:1000; visibility: hidden' >");
document.write("<table border=0 cellspacing=0 cellpadding=0><tr><td colspan=3  height=3></td></tr><tr><td width=5 rowspan=2>&nbsp;</td><td height=5></td></tr><tr><td><table style=cursor:hand border='0' cellspacing='1' cellpadding='0' width=100% height=100%><tr><td valign=top bgcolor=white><table border=0 cellspacing=0 cellpadding=0 width=100% height=100% style='border:1px solid #888888;'>");
document.write("<tr onclick=\"zbLayer_GoMyBs(gstrTargetName);\" onmouseover=\"na_change_img_src('image0a_3', 'document', '" + AFREECA + "/mybs/img_btn/context_w2.gif', true);\" onmouseout=\"na_restore_img_src('image0a_3', 'document', '" + AFREECA + "/mybs/img_btn/context_w.gif')\"><td><img name='image0a_3' id='image0a_3' border='0' src='" + AFREECA + "/mybs/img_btn/context_w.gif' width='120' height='25' alt='¹æ¼Û±¹ ±¸°æ°¡±â'/></td></tr>");
document.write("<tr><td><img name='image0a_1' id='image0a_1' border='0' src='" + AFREECA + "/mybs/img_btn/context_nic3.gif' width='120' height='25' alt='´Ð³×ÀÓÀ¸·Î°Ë»ö'/></td></tr>");
document.write("<tr><td><img name='image0a_2' id='image0a_2' border='0' src='" + AFREECA + "/mybs/img_btn/context_memo3.gif' width='120' height='25' alt='ÂÊÁöº¸³»±â'/></td></tr>");
document.write("</table></td></tr></table></td><td width=5 rowspan=2>&nbsp;</td></tr><tr><td colspan=3 height=10></td></tr></table>");
document.write("</div>");


if (document.all)
{
    document.body.onclick=hidemenu;
}

function zbLayer_IdSearch(uid)
{
	try				// À¥ °Ô½ÃÆÇ
	{
		cbox = document.searchFrm.elements;
		for(var i = 0; i<cbox.length;i++) {
			if(cbox[i].value=="u_nickname" || cbox[i].value=="u_id")
			{
				cbox[i].checked = true;
			}
			else
			{
				cbox[i].checked = false;
			}
		}
		document.searchFrm.search_word.value=uid;
		document.searchFrm.submit();
	}
	catch (e)		// °³ÀÎ¹æ¼Û±¹
	{
		document.frmSearch.nWriterTog.value=1;
		document.frmSearch.szSearchWord.value = uid;
		document.frmSearch.iWriter.src = "http://www.afreeca.com/mybs/img_btn/on_id.gif";
		doSearch();
	}
}


function zbLayer_GoMyBs(uid)
{
	var org_id = "";
    // kbbs °Ë»ö
    if(uid.substring(0,1)=='@')
    {
        cbox = document.searchFrm.elements;
        for(var i = 0; i<cbox.length;i++) {
        if(cbox[i].value=="u_id")
        {
        cbox[i].checked = true;
            }
        else
        {
        cbox[i].checked = false;
            }
        }
        org_id = uid.substring(1,uid.length);
    }
	else
	{
		org_id = uid;
	}

	strRequest_uri = AFREECA_ISAPI + org_id;

    var objPopup = window.open(strRequest_uri,"", "");
    if (objPopup == null)
    {
        alert("Â÷´ÜµÈ ÆË¾÷À» Çã¿ëÇØ ÁÖ½Ê½Ã¿ä.");
        return;
    }
    document.getElementById(gstrMenuName).style.visibility="hidden";
}


function zbLayer_SendNote(uid)
{
    // kbbs¿ë
    if(uid.substring(0,1)=='@')
    {
		uid = uid.substring(1,uid.length);
    }

	try
	{
		goSendNote( uid );	// common.js ·Î ¸ô¾Æ³ùÀ½
	}
	catch (e)
	{
		if( uid == 'undefined' || uid == null )
		{
			uid = '';
		}

		var oWindow = window.open(NOTE_8133 + "/app/index.php?page=write&id_list=" + uid, 'noteWriteWindow','left=10,top=10,width=400,height=440,marginwidth=0,marginheight=0,resizable=0,scrollbars=no');
		if( !oWindow ) alert( "Â÷´ÜµÈ ÆË¾÷À» Çã¿ëÇØÁÖ¼¼¿ä.");
		else    oWindow.focus();
	}
	document.getElementById(gstrMenuName).style.visibility="hidden";
}


function na_restore_img_src(name, nsdoc, rpath)
{
	try
	{
		document.getElementById(name).src = rpath;
	}
	catch (e)
	{
	}
}


function na_change_img_src(name, nsdoc, rpath, preload)
{
	try
	{
		document.getElementById(name).src = rpath;
	}
	catch (e)
	{
	}
}


// cookie°ü·Ã ÇÔ¼öµéÀ» Á¤ÀÇÇÑ´Ù.
var pdboxCookie1 = new Array();

function Parse_Cookie_ICT(doc)
{
    var cookieList = doc.cookie.split("; ");

    for(var i = 0; i < cookieList.length; i++)
    {
        var name = cookieList[i].split("=");
        pdboxCookie1[unescape(name[0])] = unescape(name[1]);
    }

    return cookieList.length;
}

function Read_Cookie_ICT(name)
{
    for(cookie in pdboxCookie1)
    {
        if(cookie == name)
        {
            if(pdboxCookie1[cookie] != "undefined")
                return pdboxCookie1[cookie];
        }
    }

    return "";
}

