function getCookieVal (offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1) endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen) {	//while open
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
         return getCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0) break; 
   }	//while close
   return null;
}

//desc = "<link rel=\"stylesheet\" href=\"http://www.chosun.com/img/200305/css/base.css\" type=\"text/css\">\n"
//	+"<style type=\"text/css\">\n"
//	+"td, body { font-size:12px; }\n"
//	+"</style>\n"
//	+"</head>\n"
//	+"<body bgcolor=\"#FFFFFF\" leftmargin=0 topmargin=3 marginwidth=0 marginheight=3>\n"
desc =	"<div align=center>\n"
	+"<b class=\"fBlack\"><a href=\"http://sports.chosun.com/\">½ºÆ÷Ã÷Á¶¼±</a><span class=\"topMuPart\"> | </span>\n"
	+"<a href=\"http://weekly.chosun.com/\">ÁÖ°£Á¶¼±</a><span class=\"topMuPart\"> | </span>\n"
	+"<a href=\"http://monthly.chosun.com/\">¿ù°£Á¶¼±</a><span class=\"topMuPart\"> | </span>\n"
	+"<a href=\"http://game.chosun.com/\">°ÔÀÓÁ¶¼±</a><span class=\"topMuPart\"> | </span></b>\n"
	+"<span class=\"topMuFont\">\n"
	+"<b><a href=\"http://forum.chosun.com/\" title=\"&#149;µ¶ÀÚ¸¶´ç &#13; &#149;1000ÀÚ Åä·Ð &#13; &#149;°æÁ¦¹Ù·Î¼¼¿ì±â &#13; &#149;Á¶¼±ÀÏº¸ ¸øÂü°Ú´Ù &#13; &#149;Á¶¼±ÀÏº¸ µ¶ÀÚÅõ°í &#13; &#149;Á¶¼±ÀÏº¸ µ¶ÀÚÁ¦º¸\">µ¶ÀÚÆ÷·³</a><span class=\"topMuPart\"> | </span></b>\n";

//¸µÅ© url
returl = document.location; 
if(returl == null || returl == ""){
	returl = "http://www.chosun.com";
}
priv_event = GetCookie('cs_event');
priv_id = GetCookie('cs_id');
priv_name = GetCookie('cs_name');
priv_message = priv_name+"("+priv_id+")´Ô";

document.write(desc);
go_url = "http://membership.chosun.com/login/protect_sso/sso_user_info.jsp?imsi=CP50&returl="+returl;

if(!GetCookie('SMSESSION') || GetCookie('SMSESSION') == "LOGGEDOFF" || !GetCookie('SM_USER'))
{    
	document.write("<a href="+go_url+">·Î±×ÀÎ</a><span class='topMuPart'> | </span><a href=http://membership.chosun.com/join/registUser.jsp?site=chosun>È¸¿ø°¡ÀÔ</a>");
}
else if(!priv_id || priv_id !=GetCookie('SM_USER'))
{
	//document.write("<script language=javascript>\nparent.location.href = "+go_url+">\n</script>");
	parent.location.href = go_url;
}
else
{
	go_url = "http://membership.chosun.com/login/logout.jsp?returl="+returl;
	document.write("<a href="+go_url+" title=" +priv_message+">·Î±×¾Æ¿ô</a><span class='topMuPart'> | </span>\n"
		+"<a href=\"http://membership.chosun.com/join/registUser.jsp?act=update&site=chosun\">È¸¿ø¼öÁ¤</a>");
}
//document.write("</div>");
