var wwwurl = location.host;
var udomain = location.host;
document.title="::: MGame ½Å³ª´Â ÀÎÅÍ³Ý ³îÀÌÅÍ :::";

wwwurl = "www.mgame.com";

wwwurl="http://"+wwwurl;

if ( location.host.indexOf("buddybuddy.co.kr") > 0 ) {  //BUDDYBUDDY
	if(location.host == "hon.buddybuddy.co.kr"){
		document.title="±ÍÈ¥ - Ä³ÁÖ¾ó ¹«Çù RPG ÁöÁ¸";
	}else {
		document.title="¿ì¸®µéÀÇ ³×Æ®¿öÅ© - ¹öµð¹öµð";
	}
	document.write('<script language="Javascript" src="http://game.buddybuddy.co.kr/Common/Js/GNB.aspx"></script>');

} else if ( location.host.indexOf("gameon.nate.com") > 0 ) {  //NATE ON
	pageUrl = URLEncode('http://'+location.host);
	if(getCookie("CFN")){
		pageUrl = URLEncode('http://mgsign.gameon.nate.com/logout.mgame?rtnurl=http://'+location.host);
	}

	document.title="³×ÀÌÆ®¿Â °ÔÀÓ";
	document.write('<script type="text/javascript" src="http://nateonweb.nate.com/share/menu/js/gnb_gameon_js.php?pageurl='+pageUrl+'"></script>');

} else if ( location.host.indexOf("daum.net") > 0 ) {  //´ÙÀ½
	titleName = "Daum °ÔÀÓ";

	switch(location.host){
		case "hero.game.daum.net":		gameName="hero";	titleName = "¿µ¿õ - Daum °ÔÀÓ";			break;
		case "wffm.game.daum.net":		gameName="wffm";	titleName = "Ç³¸²È­»ê - Daum °ÔÀÓ";			break;
		case "yulgang.game.daum.net":	gameName="yulgang"; titleName = "¿­Ç÷°­È£ - Daum °ÔÀÓ";			break;
		case "js.game.daum.net":			gameName="js";		titleName = "Àú½ºÆ¼¼î - Daum °ÔÀÓ";			break;
	}

	pageUrl = 'http://'+location.host;

	document.title=titleName;
	document.write('<div id ="DAUM_GAME_HEADER_AREA"></div><div id="DaumUI__minidaum" style="display:none;"></div>');
	document.write('<script type="text/javascript" src="http://game.daum.net/js/header.js" charset="utf-8"></script>');
	document.write('<script type="text/javascript" src="http://go.daum.net/bin/minidaum.cgi?category=game&logout_url=http%3a%2f%2fgame%2edaum%2enet%2f" charset="euc-kr"></script>');

}else if ( location.host.indexOf("hangame.com") > 0 ){ 
	document.title= "ÇÑ°ÔÀÓ - ±ÍÈ¥" ;
	document.write('<script language="javascript" src="http://www.hangame.com/common/js/informalheader.js"></script>');
	document.write('<script language="javascript" src="http://www.hangame.com/common/js/gnb_informal.js"></script>');
} else if(location.host.indexOf("tooniland.com") > 0){
	document.write('<script language="javascript"> var gc_gid ="js";</script>');
	document.write('<script language="javascript" src="http://www.tooniland.com/ext/main2/js/common.js" charset="utf-8"></script>');
	document.write('<script language="javascript" src="http://www.tooniland.com/etc/channeling/js/gc_header.js" charset="utf-8"></script>');
	document.title='Åõ´Ï·£µå - [Àú½ºÆ¼¼î]';
}else{
		//¹öÁ¯Ã¼Å©
		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;
*/


		/*************************************************************************************/
			var cname	=	name2 ? name1+'_'+name2 : name1;
			var vars	=	document.cookie;
			var parm;
			var parms		= new Array();
			if (vars.length > 0) {
				parm	= vars.split(';');
				for(i=0; i<parm.length; i++){

					var cookie_key		=	parm[i].slice(0,parm[i].indexOf('=')).replace(/^\s+|\s+$/g, "");
					var cookie_val		=	unescape( parm[i].slice(parm[i].indexOf('=')+1,parm[i].length).replace(/^\s+|\s+$/g, "") );

					if(cookie_val.indexOf('=')>-1 && name2){
						var mgameCookie = cookie_val.split('&');

						for(j=0; j<mgameCookie.length; j++){
							parms[cookie_key+'_'+mgameCookie[j].slice(0,mgameCookie[j].indexOf('=')).replace(/^\s+|\s+$/g, "")]	= unescape( mgameCookie[j].slice(mgameCookie[j].indexOf('=')+1,mgameCookie[j].length).replace(/^\s+|\s+$/g, "") );
						}
					}else{
						parms[cookie_key]	= cookie_val;
					}
				}
				parm		= null;

				return parms[cname.replace(/(MGAMEIF|MGAMEJS)/i,'MGAME')];

			} else {
				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);
		}

		function GUEST_POPUP2(reqtype){
			document.domain="mgame.com";
			//billing : À¯·á°áÁ¦ Á¦ÇÑ
			//billing_pop : À¯·á°áÁ¦ Á¦ÇÑ ÆË¾÷ÀÏ °æ¿ì window.openÀÌ ¾Æ´Ï¶ó location
			//gamestart : °ÔÀÓ½ÇÇà Á¦ÇÑ
			//default : ¼­ºñ½º Á¦ÇÑ
			//default_pop : ¼­ºñ½º Á¦ÇÑ  ÆË¾÷ÀÏ °æ¿ì

			if(reqtype != "billing" &&  reqtype != "gamestart" &&  reqtype != "billing_pop" &&  reqtype != "default_pop"){
				reqtype = "default";
			}

			var url = "http://www.mgame.com/member/guest_msg.mgame?reqtype="+reqtype;

			if(reqtype == "billing_pop" || reqtype == "default_pop"){
				location.href=url;
			}else {
				Mgame_CommonLayerOpen_trans(url, 450, 590, true);
			}
		}
		//#############################################################################

		//############################# °¢ ¸Þ´º URL ÁÖ¼Ò ##############################
		var	g_href			= location.href;		// ÆäÀÌÁöÁÖ¼Ò
		var	g_hostname		= location.hostname;	// È£½ºÆ®³×ÀÓ

		var url_mgame		= wwwurl+"/";
		var url_avatar		= url_mgame+"avatar";							//¾Æ¹ÙÅ¸
		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 url_flash =  "http://flash.mgame.com";

		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		= "#";		//·Î±×ÀÎ


		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' onfocus='this.blur();'><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;
		}

		function mcashOpen(){
			if (getCookie("MGAME","LGNKEY") != null)
				window.open('https://bill.mgame.com/mbank/default.asp','cash','width=600,height=560,left=10,top=10');
			else
				top.location.href = "http://www.mgame.com/member/login_form_big.mgame";		
		}
		//#############################################################################

		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'>");
		document.write("  <tr>");
		document.write("	<td height='34' background='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0709_gamegnb_bg.gif'>");
		document.write("	<table width='100%'  border='0' cellspacing='0' cellpadding='0'>");
		document.write("	  <tr>");
		document.write("		<td width='120' align='center'><a href='http://www.mgame.com/' target='_top' onfocus='this.blur();'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0709_gamegnb_logo.gif' width='76' height='34' border='0'></a></td>");
		document.write("		<td width='347'>");
		document.write("		<table width='347'  border='0' cellspacing='0' cellpadding='0'>");
		document.write("		  <tr>");
		for(i=0; i<8; i++){
		document.write("			<td><a href='' onClick=\"mainMenuLink('"+topMenuUrl[i]+"'); return false;\" onMouseOut='subGNB_swapImgRestore("+i+")'; onMouseOver=subGNB_swapImage('subGNB"+i+"','"+i+"','http://image.mgame.com/mgamezzang/contents/main_2007/menu/0709_gamegnb_m0"+(i+1)+"_o.gif',1) target='_top' onfocus='this.blur()'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0709_gamegnb_m0"+(i+1)+".gif' name='subGNB"+i+"' border='0'></a></td>");
			if(i!=7){
			document.write("			<td width='15'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0709_gamegnb_mline.gif' width='15' height='16'></td>");
			}
		}
		document.write("		  </tr>");
		document.write("		</table>");
		document.write("		</td>");
		document.write("		<td>&nbsp;</td>");
		document.write("		<td width='250' align='left'>");
		document.write("		<table width='237' height='14'  border='0' cellpadding='0' cellspacing='0'>");
		document.write("		  <tr>");
		document.write("			<td valign='bottom'><a href='#' onClick='mcashOpen(); return false;' onMouseOut='MM_swapImgRestore()' onMouseOver=MM_swapImage('Image115','','http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_01_o.gif',1) target='_top' onfocus='this.blur()'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_01.gif' name='Image115' width='51' height='12' border='0'></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+"' onMouseOut='MM_swapImgRestore()' onMouseOver=MM_swapImage('Image116','','http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_02_o.gif',1) target='_top' onfocus='this.blur()'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_02.gif' name='Image116' width='30' height='12' border='0'></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+"' onMouseOut='MM_swapImgRestore()' onMouseOver=MM_swapImage('Image117','','http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_03_o.gif',1) target='_top' onfocus='this.blur()'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_03.gif' name='Image117' width='25' height='12' border='0'></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+"' onMouseOut='MM_swapImgRestore()' onMouseOver=MM_swapImage('Image118','','http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_04_o.gif',1) target='_top' onfocus='this.blur()'><img src='http://image.mgame.com/mgamezzang/contents/main_2007/menu/0726_gnb_smenu_04.gif' name='Image118' width='41' height='12' border='0'></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:208px; top:1px; 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)
				{
					//È¸¿ø°¡ÀÔ ¼­¹ö¿¡¼­´Â ¾Æ·¡ ½ºÅ©¸³Æ®¸¦ »ç¿ëÇÏÁö ¾Ê½À´Ï´Ù.
				}
				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

		if(location.host == 'jjman.mgame.com') {
			document.write('<script language="javascript" src="http://jjman.mgame.com/common/include/scriptLogger.js"></script>');	// Nethru °ü·Ã JS
		}

		//***************************************************************************************************************************************
		// ±èÇüÅ¹ ¼öÁ¤ 2005-08-10
		// IRC ¸¦ À§ÇÑ ·Î±×¾Æ¿ô
		//***************************************************************************************************************************************
		function logoutforirc()
		{
			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
		//2009.02.17 ¼öÁ¤ ÀÌ½ÂÈÆ
		try{
			for (var e = window.event.toElement; e.tagName != 'BODY'; e = e.parentElement) {
				if (e == document.all[divName]) return;
			}
		}catch(e){
		}
		//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

			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:72px; top:23px; width:787; height:225; 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:255px; top:23px; width:87px; height:88px; 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:344px; top:23px; width:85px; height:107px; 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:380px; top:26px; width:111px; height:70px; z-index:1000; display: none;'>");
		document.write('<iframe scrolling="no" name="topsubcontent" id="topsubcontent" width="111" height="100" 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:454px; top:26px; 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>");
		//#############################################################################################
		
}


function URLEncode(plaintext)
{
 // The Javascript escape and unescape functions do not correspond
 // with what browsers actually do...
 var SAFECHARS = "0123456789" +     // Numeric
     "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic
     "abcdefghijklmnopqrstuvwxyz" +
     "-_.!~*'()";     // RFC2396 Mark characters
 var HEX = "0123456789ABCDEF";

 var encoded = "";
 for (var i = 0; i < plaintext.length; i++ ) {
  var ch = plaintext.charAt(i);
     if (ch == " ") {
      encoded += "+";    // x-www-urlencoded, rather than %20
  } else if (SAFECHARS.indexOf(ch) != -1) {
      encoded += ch;
  } else {
      var charCode = ch.charCodeAt(0);
   if (charCode > 255) {
    encoded += "+";
   } else {
    encoded += "%";
    encoded += HEX.charAt((charCode >> 4) & 0xF);
    encoded += HEX.charAt(charCode & 0xF);
   }
  }
 } // for

 return encoded;
};

function URLDecode(encoded)
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
    if (ch == "+") {
        plaintext += " ";
     i++;
    } else if (ch == "%") {
   if (i < (encoded.length-2) 
     && HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
     && HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
    plaintext += unescape( encoded.substr(i,3) );
    i += 3;
   } else {
    plaintext += "%[ERROR]";
    i++;
   }
  } else {
     plaintext += ch;
     i++;
  }
 } // while
   return plaintext;
 };


