
var NS4 = (document.layers);
var IE4 = (document.all);
var isWin = (navigator.appVersion.indexOf("Win") != -1)

if (NS4) {
	document.captureEvents(Event.CLICK)
	document.onclick = MouseDown;
} else if (IE4) {
	document.onclick = MouseDown;
}

var show_switch = false;

var curShowId = "";

var scrap_switch_idx = 0;

var recommend_switch_idx = 0;

function MouseDown(e) {
	if(!show_switch && curShowId != "") {
		eval("document.all['" + curShowId + "'].style.visibility = 'hidden'");
	}
	else
	{
		if (curShowId != ""){
			eval("document.all['" + curShowId + "'].style.visibility = 'visible'");
			eval("document.all['" + curShowId + "'].style.pixelLeft = posX");
			eval("document.all['" + curShowId + "'].style.pixelTop = posY");
		}
		show_switch = false;
	}
}	

var writer_id;
var user_id;
var menuLocBod, screen_height, screen_width, mouse_x, mouse_y, scroll_left, scroll_top, posX, posY;

function offsetLeft(el)
  {
    x = el.offsetLeft
    for (e = el.offsetParent; e; e = e.offsetParent)
      x += e.offsetLeft;
    return x
  }

function offsetTop(el)
  {
    y = el.offsetTop
    for (e = el.offsetParent; e; e = e.offsetParent)
      y += e.offsetTop;
    return y
  }


function id_show_menu1(uid,wid){
  
  if (curShowId != "")
  	eval("document.all['" + curShowId + "'].style.visibility = 'hidden'");	
  	
  show_switch = true;
  curShowId = "id_show1";
  
  menuWin = eval("document.all['" + curShowId + "']");
  menuLocBod = window.document.body;
  screen_height = window.document.body.offsetHeight;
  screen_width = window.document.body.offsetWidth;

  mouse_x = window.event.x;
  mouse_y = window.event.y;
  scroll_left = menuLocBod.scrollLeft;
  scroll_top  = menuLocBod.scrollTop;

   if (mouse_x+menuWin.scrollWidth > screen_width)
		mouse_x = screen_width - menuWin.scrollWidth;
  if (mouse_y+menuWin.scrollHeight > screen_height)
	mouse_y = screen_height - menuWin.scrollHeight;

  posX = mouse_x + scroll_left;
  posY = mouse_y + scroll_top;
  
  writer_id = wid;
  user_id = uid;

  if (user_id == "")
	 user_id =  GetCookie ("Joins_MemID")
}


function show_scrap(no){
  if (curShowId != "")
  	eval("document.all['" + curShowId + "'].style.visibility = 'hidden'");	
  	
  show_switch = true;
  scrap_switch_idx = no;
  curShowId = "scrapShow" + scrap_switch_idx;
  
  menuLocBod = window.document.body;
  screen_height = window.document.body.offsetHeight;
  screen_width = window.document.body.offsetWidth;

  mouse_x = window.event.x;
  mouse_y = window.event.y;
  scroll_left = menuLocBod.scrollLeft;
  scroll_top  = menuLocBod.scrollTop;

  posX = mouse_x + scroll_left;
  posY = mouse_y + scroll_top;

}

function show_recommend(no){
  if (curShowId != "")
  	eval("document.all['" + curShowId + "'].style.visibility = 'hidden'");	
  	
  show_switch = true;
  recommend_switch_idx = no;
  curShowId = "recommendShow" + recommend_switch_idx;
  
  menuLocBod = window.document.body;
  screen_height = window.document.body.offsetHeight;
  screen_width = window.document.body.offsetWidth;

  mouse_x = window.event.x;
  mouse_y = window.event.y;
  scroll_left = menuLocBod.scrollLeft;
  scroll_top  = menuLocBod.scrollTop;

  posX = mouse_x + scroll_left;
  posY = mouse_y + scroll_top;
}

function goUserBlog() {
	top.document.location.href = "http://blog.joins.com/" + writer_id + "/"; 
}

function viewMyself() {
//	document.location.href = "/media/myProfileInfo.asp?uid=" + writer_id;
	window.open("http://blog.joins.com/media/myProfileInfo.asp?uid=" + writer_id,"profile","width=616 height=600 scrollbars=yes menubar=no");
}

function memoSend() {
	var url = "http://memo.joins.com/src/Memo_Write_Form.asp?userid=" + writer_id + "&siteid=blog";
	var target = "writememo";
	var status = "scrollbars=no,resizable=no,width=360,height=335";
	var win = window.open(url, target, status);
	win.focus();
}

function inviteFriend() {
	var url = "http://cafe.joins.com/cafe/PopCafeInviteLayer.asp?uid=" + writer_id;
	var target = "invite";
	var status = "scrollbars=no,resizable=no,width=410,height=220";
	var win = window.open(url, target, status);
	win.focus();
}

function regFriendGroup(friendSection, groupCode) {
	
	if( user_id != "" )
	{
		var url = "http://blog.joins.com/media/registFriendX.asp?uid=" + user_id + "&friendUID=" + writer_id + "&friendSection=" + friendSection + "&friend_gourp=" + groupCode;
		var target = "friend";
		var status = "scrollbars=no,resizable=no,width=300,height=130";
		var win = window.open(url, target, status);
		win.focus();
	}
	else
	{
		alert("·Î±×ÀÎ ÈÄ »ç¿ëÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.")
	}
}


function GetCookie(name)
{
	var flag = document.cookie.indexOf(name+'=');
	if (flag != -1) { 
		flag += name.length + 1
		end = document.cookie.indexOf(';', flag) 
	
		if (end == -1) end = document.cookie.length
		return unescape(document.cookie.substring(flag, end))
	}
	else
	{
		return ""
	}
}

document.write( '<div id="id_show1" style="Z-INDEX: 10000; position:absolute;  visibility:hidden; width:100px; solid #cccccc; padding:0px; left: 10px; height: 100px; top: 10px"> ')
document.write( '      <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="F7F7F7"> ')
document.write( '        <tr> ')
document.write( '          <td align=center  style="border:1px solid #B5B6B5;"> ')
document.write( '            <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="F7F7F7"> ')
document.write( '              <tr>  ')
document.write( '                <td height="20" onclick="javascript:goUserBlog();" onMouseOver=style.backgroundColor="#E1FFD6" onMouseOut=style.backgroundColor="#FFFFFF" bgcolor="#FFFFFF" style="cursor:hand; font-family:µ¸¿ò; font-size: 9pt;" style="padding:6 7 2 7;line-height:15px; ">ºí·Î±× º¸±â</td> ')
document.write( '              </tr> ')
document.write( '              <tr><td style="padding:1 0 1 0;" bgcolor="#FFFFFF"><img src="http://images.joins.com/blog/common/clipping/floting_dots.gif" width="107" height="1" alt="" border="0"></td></tr> ')
document.write( '              <tr> ')
document.write( '                <td height="20" onclick="javascript:viewMyself();" onMouseOver=style.backgroundColor="#E1FFD6" onMouseOut=style.backgroundColor="#FFFFFF" bgcolor="#FFFFFF" style="cursor:hand; font-family:µ¸¿ò; font-size: 9pt;" style="padding:6 7 2 7;line-height:15px;">ÀÚ±â¼Ò°³¼­ º¸±â</td> ')
document.write( '              </tr> ')
document.write( '  			      <tr><td style="padding:1 0 1 0;" bgcolor="#FFFFFF"><img src="http://images.joins.com/blog/common/clipping/floting_dots.gif" width="107" height="1" alt="" border="0"></td></tr> ')
document.write( '              <tr> ')
document.write( '                <td height="20" onclick="javascript:memoSend();" onMouseOver=style.backgroundColor="#E1FFD6" onMouseOut=style.backgroundColor="#FFFFFF" bgcolor="#FFFFFF" style="cursor:hand; font-family:µ¸¿ò; font-size: 9pt;" style="padding:6 7 2 7;line-height:15px;">ÂÊÁö º¸³»±â</td> ')
document.write( '              </tr> ')
document.write( '              <tr><td style="padding:1 0 1 0;" bgcolor="#FFFFFF"><img src="http://images.joins.com/blog/common/clipping/floting_dots.gif" width="107" height="1" alt="" border="0"></td></tr> ')
document.write( '              <tr> ')
document.write( '                <td height="20" onclick="javascript:inviteFriend();" onMouseOver=style.backgroundColor="#E1FFD6" onMouseOut=style.backgroundColor="#FFFFFF" bgcolor="#FFFFFF" style="cursor:hand; font-family:µ¸¿ò;font-size: 9pt;" style="padding:6 7 2 7;line-height:15px;">Ä«Æä·Î ÃÊ´ë</td> ')
document.write( '              </tr> ')
document.write( '              <tr><td style="padding:1 0 1 0;" bgcolor="#FFFFFF"><img src="http://images.joins.com/blog/common/clipping/floting_dots.gif" width="107" height="1" alt="" border="0"></td></tr> ')
document.write( '              <tr> ')
document.write( '                <td height="20" onclick="javascript:regFriendGroup(1,10);" onMouseOver=style.backgroundColor="#E1FFD6" onMouseOut=style.backgroundColor="#FFFFFF" bgcolor="#FFFFFF" style="cursor:hand; font-family:µ¸¿ò;font-size: 9pt;"  style="padding:6 7 2 7;line-height:15px;">Ä£±¸·Î µî·Ï</td> ')
document.write( '              </tr> ')
document.write( '            </table> ')
document.write( '          </td> ')
document.write( '        </tr> ')
document.write( '      </table> ')
document.write( ' </div> ')

