document.title="::: MGame ½Å³ª´Â ÀÎÅÍ³Ý ³îÀÌÅÍ :::";
//document.write('<meta http-equiv="page-enter" content="blendtrans(duration=0.3)"> ');
//document.write('<meta http-equiv="page-exit" content="blendtrans(duration=0.3)"> ');

//############################# °¢ ¸Þ´º URL ÁÖ¼Ò ##############################
var wwwurl = location.host;

if(wwwurl == "newbeta.mgame.com")
	wwwurl = "newbeta.mgame.com";
else if(wwwurl == "beta.mgame.com")
	wwwurl = "beta.mgame.com";
else{

	// ÇØ´ç½Ã°¢¿¡ Á¡°Ë ÆäÀÌÁö·Î ÀÌµ¿(¿µÈ­ Á¤±âÁ¡°Ë 2008-5-14 00:00~06:00)
	var musicUrl = "http://music.mgame.com";
	var gongsa_d=new Date();
	var gongsa_yy=gongsa_d.getYear();
	var gongsa_mm=gongsa_d.getMonth()+1;
	var gongsa_dd=gongsa_d.getDate();
	var gongsa_h=gongsa_d.getHours();
	if(gongsa_yy == 2008 && gongsa_mm == 5 && gongsa_dd == 14) {
		if(gongsa_h >= 0 && gongsa_h < 7) {
			musicUrl ="http://event.mgame.com/emergency_service/index.mgame";
		}
	}

	//musicUrl ="http://event.mgame.com/emergency_service/index.mgame";

	// log.mgame.com cp ¾÷Ã¼ ·Î±× ¼öÁý
	var isCp = false;
	switch (wwwurl)
	{
		case "mcine.mgame.com":
			isCp = true;
		case "fortune.mgame.com":
			isCp = true;
		case "pcziggy.mgame.com":
			isCp = true;
		case "music.mgame.com":
			isCp = true;
		case "mmsg3.mgame.com":
			isCp = true;
		case "comic.mgame.com":
			isCp = true;
		case "edu.mgame.com":
			isCp = true;

	}

	if(isCp){
		document.write('<script language=javascript src="http://www.mgame.com/cp/scriptLogger.js"></script>');
	}

	wwwurl = "www.mgame.com";
}

wwwurl="http://"+wwwurl;


//¹öÁ¯Ã¼Å©
function isOverXPSP2()
{
  var arrVerStr = window.navigator.appVersion.split('; ');
  if( arrVerStr.length >= 4 )
  {
    var arrOsVer = arrVerStr[2].split(' ');
    if( arrOsVer.length >= 3 && arrOsVer[0] == "Windows" )
    {
      var osVerNum = new Number(arrOsVer[2]);
      if( osVerNum >= 5.1 && arrVerStr[3].indexOf("SV1") >= 0 ) // »õ·Î¿î Windows Version ³ª¿Ã¶§ ¼öÁ¤ÇÊ¿ä
        return true;
    }
  }
  return false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// ºñ½ºÅ¸ È®ÀÎ ÇÔ¼ö
function isWindowsVista() {
	var retchk = false;

	try {
		var userAgent = navigator.userAgent;
		userAgent = userAgent.substring(userAgent.indexOf('(')+1, userAgent.indexOf(')'));
		var arruser = userAgent.split('; ');
		var arrOS = arruser[2].split(' ');
		var userOSName = arrOS[0] + ' ' + arrOS[1];
		var userOSVersion = arrOS[2].split('.');
		var userOSMajorVersion = eval(userOSVersion[0]);
		var userOSMinorVersion = eval(userOSVersion[1]);

		if(userOSName == 'Windows NT' && userOSMajorVersion > 5) {
			retchk = true;
		}
	} catch(ex) {
	}

	return retchk;
}

function getCookie_1DIM(Name) {
  var search = Name + "="
  if (document.cookie.length > 0) { // ÄíÅ°°¡ ¼³Á¤µÇ¾î ÀÖ´Ù¸é
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // ÄíÅ°°¡ Á¸ÀçÇÏ¸é
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset)
      // ÄíÅ° °ªÀÇ ¸¶Áö¸· À§Ä¡ ÀÎµ¦½º ¹øÈ£ ¼³Á¤
      if (end == -1)
        end = document.cookie.length
      return unescape(document.cookie.substring(offset, end))
    }
  }
}

function getCookie_2DIM(name0,name1) {

   if (name0=='MGAMEJS'||name0=='MGAME')
   {
	   if(name1=='AGE'||name1=='SEX'||name1=='TYPE')
	   {
			var cookieValue_Name0 = getCookie_1DIM('MGAMEIF');
			if (cookieValue_Name0 == null||cookieValue_Name0=='undefined') {
				return "";
			}
			if(name1=='AGE')
		   {
			   return cookieValue_Name0.substring(11,13);
		   }
		   /* Ã¼Çè¾ÆÀÌµð Ã¼Å©¿ë Ãß°¡ - 2007.05.08 ¹Ú¼º¿í */
		   else if(name1=='TYPE')
		   {
			   return cookieValue_Name0.substring(18,22);
		   }
		   else
		   {
			   return cookieValue_Name0.substring(1,2);
		   }
	   }
   }

   var cookieValue_Name0 = getCookie_1DIM(name0);

   if (cookieValue_Name0 == null) {
	   return;
   }

   var cookieValue_Name1 = cookieValue_Name0.split("&");
   var repStr = name1 + "=";
   for (var i = 0; i < cookieValue_Name1.length; i++) {
		if (cookieValue_Name1[i].indexOf(repStr) >= 0) {
			var tmpStr = new RegExp(repStr, "gi");
			return cookieValue_Name1[i].replace(tmpStr,"");
		}
   }
}

function getCookie(name1, name2) {
   var cname = name1 + "=";
   if (name1=='MGAMEJS'||name1=='MGAME')
   {
	   if(name2=='AGE'||name2=='SEX')
	   {
			var cookieValue_Name0 = getCookie_1DIM('MGAMEIF');
			if (cookieValue_Name0 == null||cookieValue_Name0=='undefined') {
				return "";
			}
		   if(name2=='AGE')
		   {
			   return cookieValue_Name0.substring(11,13);
		   }
		   else
		   {
			   return cookieValue_Name0.substring(1,2);
		   }
	   }
		else if(name2=='ID')
		{
			var cookieValue_Name0 = getCookie_1DIM('MGAMEEF');
			if (cookieValue_Name0 == null||cookieValue_Name0=='undefined') {
				return "";
			}
			if(name2 == 'ID')
			{
				return getExactID(cookieValue_Name0);
			}
		}
   }

	var vars = document.cookie;
 	if (vars.length > 0) {
		begin = vars.indexOf(cname);
		if (begin != -1) {
			if ((name2 == null) || (name2.length == 0)) {
		   		begin += cname.length;
		   		end = vars.indexOf(";", begin);
		  		if (end == -1) end = vars.length;
					return unescape(vars.substring(begin, end));
			} else {
				cname = name1 + "=" + name2 + "=";
				begin = vars.indexOf(cname, begin);
				if (begin == -1) {
					cname = "&" + name2 + "=";
					begin = vars.indexOf(cname, begin);
				}
				if (begin != -1) {
					begin += cname.length;
					end = vars.indexOf("&", begin);
					if (end == -1) {
				   		end = vars.indexOf(";", begin);
				  		if (end == -1) end = vars.length;
					}
					return unescape(vars.substring(begin, end));
				}
			}

	   	}
 	}
	return null;
}

//¼³Á¤ÇÑ ³¯Â¥¸¸Å­ ÄíÅ°°¡ À¯ÁöµÇ°Ô. expiredays°¡ 1ÀÌ¸é ÇÏ·çµ¿¾È À¯Áö
function setCookie(name, value, expiredays)	{
	var expire_date = new Date();
	expire_date.setDate(expire_date.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; expires=" + expire_date.toGMTString() + "; path=/; domain=mgame.com";
 }

//################################ Ã¼Çè¾ÆÀÌµð #################################
var mgameIfCookie = getCookie_1DIM('MGAMEIF');
var expCookieType = "1000";

if (mgameIfCookie != null && mgameIfCookie != undefined) {
	expCookieType = mgameIfCookie.substring(18,22);
}
//#############################################################################

//############################# °¢ ¸Þ´º URL ÁÖ¼Ò ##############################
var	g_href			= location.href;		// ÆäÀÌÁöÁÖ¼Ò
var	g_hostname		= location.hostname;	// È£½ºÆ®³×ÀÓ
var url_mgame		= wwwurl+"/";
var url_avatar		= url_mgame+"avatar/default_gamemall.mgame?purl=gmoney_mgamezone.mgame&game=sdpo5";								//¾Æ¹ÙÅ¸
var url_community	= "http://blog.mgame.com";						//Ä¿¹Â´ÏÆ¼
var url_knowlage	= "http://know.mgame.com";						//Áö½Ä
var url_live		= "http://liveucc.mgame.com";						//¶óÀÌºê
var url_premium		= "http://premium.mgame.com/cardpremium2008/";		//ÇÁ¸®¹Ì¾ö
var url_cp			= "#";												//CP
var mcineUrl = "http://mcine.mgame.com";
//var mcineUrl = "http://event.mgame.com/emergency_service/index.mgame";//¼­¹öÁ¡°Ë

if (getCookie("MGAME","LGNKEY") != null)
	var url_mcash		= "javascript:MM_openBrWindow('https://bill.mgame.com/mbank/default.asp','cash','width=600,height=560,left=10,top=10');";		//¿¥Ä³½¬ ÃæÀü
else
	var url_mcash		= "http://www.mgame.com/member/login_form_big.mgame";

var url_myinfo		= url_mgame+"myinfo/main/";							//³»Á¤º¸
var url_customer	= "http://csweb.mgame.com/csagent/helpdesk/index.jsp";		//°í°´¼¾ÅÍ
var url_mgamepc		= "http://pcbang.mgame.com";						//PC¹æ
var url_login		= "#";		//·Î±×ÀÎ
var url_flash = "http://flash.mgame.com";

if (getCookie("MGAME","LGNKEY") != null)
	url_login		="<a href='javascript:logoutforirc()';><img src=http://image.mgame.com/mgamezzang/contents/main_2007/menu/sub_gnb/subtop_s_logout.gif border=0 align=absmiddle ></a>";
else
	url_login		="<a href='"+wwwurl+"/member/login_form_big.mgame?tu="+escape(g_href)+"' target='_top'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/sub_gnb/subtop_s_login.gif' align='absmiddle' border='0'></a>";

if (expCookieType == "9000" || expCookieType == "7777"){
	url_myinfo  = "javascript:GUEST_POPUP2();";
	url_mcash	= "javascript:GUEST_POPUP2();";
	url_avatar  = "javascript:GUEST_POPUP2();";
	url_premium = "javascript:GUEST_POPUP2();";
}

var topMenuUrl = new Array(url_mgame,url_flash,url_avatar,url_community,url_knowlage,url_live,url_premium,url_cp);

function mainMenuLink(strUrl){
	if (strUrl == "#") return;
	top.location.href = strUrl;
}
//#############################################################################

if (location.host=="chat.mgame.com"){
	//Ã¤ÆÃ, ¹æ¼ÛÀº µµ¸ÞÀÎÀ» ¼³Á¤ÇÏÁö ¾Ê½À´Ï´Ù.
} else {
	document.domain = "mgame.com";
}

document.write("<link href='http://www.mgame.com/css/sub_gnb.css' rel='stylesheet' type='text/css'>");
document.write("<table width='100%'  border='0' cellspacing='0' cellpadding='0'bgcolor='#FFFFFF'>");
document.write("  <tr>");
document.write("    <td height='46'>");
document.write("	 <table width='970' border='0' cellspacing='0' cellpadding='0'>");
document.write("      <tr>");
document.write("        <td width='11'>&nbsp;</td>");
document.write("        <td width='178'  align='center'><a href='"+wwwurl+"' target='_top'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/sub_gnb/080414_subtop_logo.gif' width='100' height='46' border='0'></a></td>");
document.write("        <td width='360' align='left' valign='bottom' style='padding:0px 0px 11px 0px;'>");
document.write("		<table width='100%'  border='0' cellspacing='0' cellpadding='0'>");
document.write("          <tr>");
for(i=0; i<8; i++){
	document.write("            <td><a href=javascript:mainMenuLink('"+topMenuUrl[i]+"'); onMouseOut=\"subGNB_swapImgRestore("+i+")\" onMouseOver=subGNB_swapImage('subGNB"+i+"','"+i+"','http://image.mgame.com/mgamezzang/contents/main_2007/menu/sub_gnb/0709_subgnb_m0"+(i+1)+"_o.gif',1)><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/sub_gnb/0709_subgnb_m0"+(i+1)+".gif' name='subGNB"+i+"' border='0' id='subGNB"+i+"'></a></td>");
	if(i!=7){
	document.write("            <td><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/sub_gnb/080414_subgnb_mline.gif' width='17' height='16' align='absmiddle'></td>");
	}
}
document.write("          </tr>");
document.write("        </table>");
document.write("		</td>");
document.write("		<td align='center'>");
document.write("			<iframe id='gnbbanner' name='gnbbanner' width='174' height='46' src='http://www.mgame.com/main_js/sub_gnbbanner_img.mgame' scrolling='no' marginwidth='0' marginheight='0' frameborder='No' allowtransparency='true'></iframe>");
document.write("		</td>");
document.write("        <td width='240' align='right' valign='bottom' style='padding:0px 3px 11px 0px;'>");
document.write("		<table width='237' height='14'  border='0' cellpadding='0' cellspacing='0'>");
document.write("          <tr>");
document.write("            <td valign='bottom'><a href="+url_mcash+" target='_top' onMouseOut='MM_swapImgRestore()' onMouseOver=MM_swapImage('subgnbsm01','','http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_01_o.gif',1)><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_01.gif' name='subgnbsm01' width='51' height='12' border='0' id='subgnbsm01'></a></td>");
document.write("            <td valign='middle'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0709_subgnb_sline.gif' width='13' height='10' align='absmiddle'></td>");
document.write("            <td valign='bottom'><a href='"+url_myinfo+"' target='_top' onMouseOut='MM_swapImgRestore()' onMouseOver=MM_swapImage('subgnbsm02','','http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_02_o.gif',1)><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_02.gif' name='subgnbsm02' width='30' height='12' border='0' id='subgnbsm02'></a></td>");
document.write("            <td valign='middle'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0709_subgnb_sline.gif' width='13' height='10' align='absmiddle'></td>");
document.write("            <td valign='bottom'><a href='"+url_mgamepc+"' target='_top' onMouseOut='MM_swapImgRestore()' onMouseOver=MM_swapImage('subgnbsm03','','http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_03_o.gif',1)><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_03.gif' name='subgnbsm03' width='25' height='12' border='0' id='subgnbsm03'></a></td>");
document.write("            <td valign='middle'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0709_subgnb_sline.gif' width='13' height='10' align='absmiddle'></td>");
document.write("            <td valign='bottom'><a href='"+url_customer+"' target='_top' onMouseOut='MM_swapImgRestore()' onMouseOver=MM_swapImage('subgnbsm04','','http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_04_o.gif',1)><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_04.gif' name='subgnbsm04' width='41' height='12' border='0' id='subgnbsm04'></a></td>");
document.write("            <td width='54' align='right'>"+url_login+"</td>");
document.write("          </tr>");
document.write("        </table>");
document.write("		</td>");
document.write("      </tr>");
document.write("     </table>");
document.write("	</td>");
document.write("  </tr>");
document.write("</table>");
//document.write('<div id="flashnewicon" style="position:absolute; left:225px; top:6px; z-index:50;">');
//document.write('<img src="http://image.mgame.com/mgamezzang/contents/main_2007/20080417_navi_new.gif">');
//document.write('</div>');

if (getCookie("MGAME","LGNKEY") != null) {
		if (location.host=="sign.mgame.com" || location.href.indexOf("xpNotice") > -1 || location.href.indexOf("vistaNotice") > -1 || location.host=="chat.mgame.com")
		{
			//È¸¿ø°¡ÀÔ, Ã¤ÆÃ ¼­¹ö¿¡¼­´Â ¾Æ·¡ ½ºÅ©¸³Æ®¸¦ »ç¿ëÇÏÁö ¾Ê½À´Ï´Ù.
		}
		else
		{
			document.write('<script language="javascript" src="http://www.mgame.com/common_js/irc_common.js"></script>');	// ÂÊÁö JS
		}
}
document.write('<script language="javascript" src="http://www.mgame.com/common_js/rc_wiselog.js"></script>');	// Nethru °ü·Ã JS

//***************************************************************************************************************************************
// ±èÇüÅ¹ ¼öÁ¤ 2005-08-10
// IRC ¸¦ À§ÇÑ ·Î±×¾Æ¿ô
//***************************************************************************************************************************************
function logoutforirc()
{
	if (location.host=="chat.mgame.com"){
		doLogInOut(1);	//Ã¤ÆÃ ¼³Á¤ ÃÊ±âÈ­
	} else {

		try {
			// 07.03.09 ÀÌÅÍ³Î ¶§¹®¿¡ Ãß°¡
			if(location.href == "http://eternalcity2.mgame.com/" || location.href == "http://eternalcity2.mgame.com/default.mgame") {
				db_update();
			}

			if(getCookie('MGAMEIRCLOGIN', '') == 'YES' || getCookie('MGAMEIRCLOGIN', '') == 'OUT')
			{
				JS_EndIRC();
			}
		} catch(ex) {
		}
		setCookie('MGAMEIRCLOGIN', null, -1);
		setCookie('PCBANGLOG', null, -1);
		top.location.href = wwwurl+'/member/logout.mgame';
	}
}
//***************************************************************************************************************************************

var overMenu = "";
var subMenu = new Array("game","","","community","","live","premium","cp");		//¼­ºê¸Þ´º ·¹ÀÌ¾î ÀÌ¸§

function subGNB_swapImgRestore(menuIdx) { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

	if (expCookieType == "9000" || expCookieType == "7777"){
	return;
	}
	overMenu = subMenu[menuIdx];

}

function subGNB_swapImage() { //v3.0
  var i,j=0,x,a=subGNB_swapImage.arguments; document.MM_sr=new Array;

  if (expCookieType == "9000" || expCookieType == "7777"){
	return;
  }

  if (overMenu)
	 document.getElementById(overMenu).style.display = "none";

  for(i=0;i<(a.length-2);i+=3){
	if ((x=subGNB_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	menuIdx = parseInt(a[i+1]);

	if(subMenu[menuIdx]){
		document.getElementById(subMenu[menuIdx]).style.display = "block";
	}
  }
}

function subGNB_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=subGNB_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function subGNB_hideLayer(divName, view){
	if (expCookieType == "9000" || expCookieType == "7777"){
	return;
	}
	//+++++++++++++++++++++++++++++++++++++++++++++ ¼Ò½ºÃß°¡ 2007-08-22 daffodil
	for (var e = window.event.toElement; e.tagName != 'BODY'; e = e.parentElement) {
		if (e == document.all[divName]) return;
	}
	//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

	if (divName){
			document.getElementById(divName).style.display = view;
	}
}

//###################################### °ÔÀÓ ¼­ºê ¸Þ´º #######################################
document.write("<div id='game' onMouseOver=subGNB_hideLayer('game','block'); onMouseOut=subGNB_hideLayer('game','none'); style='position:absolute; left:120px; top:35px; width:787px; height:225px; z-index:1000; display: none;'>");
document.write('<iframe scrolling="no" name="topsubcontent" id="topsubcontent" width="790" height="220" src="http://www.mgame.com/common_js/top_online_ifrm_game.mgame" marginheight="0" marginwidth="0" frameborder="0" align="middle" allowTransparency="true"></iframe>');
document.write("</div>");
//#############################################################################################

//#################################### Ä¿¹Â´ÏÆ¼ ¼­ºê¸Þ´º ######################################
document.write("<div id='community' onMouseOver=subGNB_hideLayer('community','block'); onMouseOut=subGNB_hideLayer('community','none'); style='position:absolute;  left:299px; top:38px; width:86px; height:94px; z-index:1000; display: none;'>");
document.write('<iframe scrolling="no" name="topsubcontent" id="topsubcontent" width="87" height="92" src="http://www.mgame.com/common_js/top_online_ifrm_community.mgame" marginheight="0" marginwidth="0" frameborder="0" align="middle" allowTransparency="true"></iframe>');
document.write("</div>");
//#############################################################################################

//#################################### ¶óÀÌºê ¼­ºê¸Þ´º ########################################
document.write("<div id='live' onMouseOver=subGNB_hideLayer('live','block'); onMouseOut=subGNB_hideLayer('live','none'); style='position:absolute; left:387px; top:38px; width:83px; height:90px; z-index:1000; display: none;'>");
document.write('<iframe scrolling="no" name="topsubcontent" id="topsubcontent" width="86" height="138" src="http://www.mgame.com/common_js/top_online_ifrm_live.mgame" marginheight="0" marginwidth="0" frameborder="0" align="middle" allowTransparency="true"></iframe>');
document.write("</div>");
//#############################################################################################

//#################################### ÇÁ¸®¹Ì¾ö ¼­ºê¸Þ´º ########################################
document.write("<div id='premium' onMouseOver=subGNB_hideLayer('premium','block'); onMouseOut=subGNB_hideLayer('premium','none'); style='position:absolute; left:427px; top:38px; width:111px; height:70px; z-index:1000; display: none;'>");
document.write('<iframe scrolling="no" name="topsubcontent" id="topsubcontent" width="111" height="70" src="http://www.mgame.com/common_js/top_online_ifrm_premium.mgame" marginheight="0" marginwidth="0" frameborder="0" align="middle" allowTransparency="true"></iframe>');
document.write("</div>");
//#############################################################################################


//#################################### CP ¼­ºê¸Þ´º ########################################
document.write("<div id='cp' onMouseOver=subGNB_hideLayer('cp','block'); onMouseOut=subGNB_hideLayer('cp','none'); style='position:absolute; left:493px; top:39px; width:78px; height:140px; z-index:1000; display: none;'>");
document.write('<iframe scrolling="no" name="topsubcontent" id="topsubcontent" width="75" height="140" src="http://www.mgame.com/common_js/top_online_ifrm_cp.mgame" marginheight="0" marginwidth="0" frameborder="0" align="middle" allowTransparency="true"></iframe>');
document.write("</div>");
//#############################################################################################
