var CK_MEMBERID  =  0;
var CK_PASSWORD  =  1;
var CK_NAME      =  2;
var CK_SEX       =  3;
var CK_AGE       =  4;
var CK_VALID     =  5;
var CK_AVATARID  =  6;
var CK_IDVALID   =  7;
var CK_NICKNAME  =  8;
var CK_SOCIALID  =  9;
var CK_ABSUID    = 10;
var CK_ABSSTATUS = 11;
var CK_PLUSLINK  = 12;
var CK_SERVICE   = 13;
var CK_SUBUPDATE = 14;
var CK_PLUSIP    = 15;
var CK_EMAIL     = 16;
var	CK_LASTDATE  = 17;
var	CK_LOCCODE   = 18;
var	CK_ABSTYPE   = 19;
var	CK_USERGRADE = 20;
var	CK_ADULTADYN = 21;
var	CK_VIP       = 22;
var	CK_PLUSITEM  = 23;
var	CK_PU		 = 24;
var	CK_HCODE		 = 25;
var	CK_PLUSCODE		 = 26;

var JS_IDVALID   =  0;
var JS_AGE 		 =  1;
var JS_SEX       =  2;
var JS_ADULTADYN =  3;
var JS_GRC       =  4;
var JS_PBK       =  5;
var JS_PBS       =  6;
var JS_EVENT     =  7;
var JS_6MONTH    =  8;
var JS_PHEJIRES  =  9;
var JS_PROMOTION = 10;
var JS_PUBILL	 = 11;
var JS_IDI_CD	 = 12;

var MAX_PASSWORD_LEN = 4;

var GMT_KOREA = -540;

var __ndsFrame;
var __ndsChange;

/////////////////////////////////////////////////////////
/* IE5.0 ¿¡¼­ encodeURIComponent °¡ Á¸ÀçÇÏÁö ¾ÊÀ½  by moon   */
/////////////////////////////////////////////////////////
if (typeof(encodeURIComponent) != "function")
{
        encodeURIComponent = function (s)
        {
                function  toHex (n)
                {
                        var hexchars = "0123456789ABCDEF" ;
                        return  "%" + hexchars.charAt(n>>4) + hexchars.charAt(n&0xF) ;
                }
                var es  = "" ;
                for (var i = 0; i < s.length;)
                {
                        var c = s.charCodeAt(i++) ;
                        if ((c&0xF800) == 0xD800)
                        {
                                var sc = s.charCodeAt(i++) ;
                                c = ((c-0xD800)<<10) + (sc-0xDC00) + 0x10000 ;
                        }
                        if (!(c&~0x7F))
                        {
                                if ((c>=65&&c<=90) || (c>=97&&c<=122) || (c>=48&&c<=57) || (c>=45&&c<=46) || c==95 || c==33 || c==126 || (c>=39&&c<=42))
                                        es += String.fromCharCode(c) ;
                                else
                                        es += toHex(c) ;
                        }
                        else if (!(c&~0x7FF))
                                es += toHex(0xC0+(c>>6)) + toHex(c&0x3F) ;
                        else if (!(c&~0xFFFF))
                                es += toHex(0xE0+(c>>12)) + toHex(0x80+(c>>6&0x3F)) + toHex(0x80+(c&0x3F)) ;
                        else    es += toHex(0xF0+(c>>18)) + toHex(0x80+(c>>12&0x3F)) + toHex(0x80+(c>>6&0x3F)) + toHex(0x80+(c&0x3F)) ;
                }

                return  es ;
        }
}

/////////////////////////////////////////////////////////////////////
// sWindowName¿¡ ÇÑ±Û»ç¿ë±ÝÁö/¿µ¹®»ç¿ë

function openWin(sURL, sWindowName, w, h, sScroll, reSize, status)
{
	// È­¸é Áß¾ÓÀ¸·Î Popup ¶ç¿ì±â.. ½ºÅ©·Ñ¹Ù´Â ¿É¼Ç..
	// ex)
	//			openWin("test.asp", "winTest", 400, 300);			¢Ñ ½ºÅ©·Ñ¹Ù ¾øÀ½
	//			openWin("test.asp", "winTest", 400, 300, "yes");	¢Ñ ½ºÅ©·Ñ¹Ù ÀÖÀ½
	//			openWin("test.asp", "winTest", 400, 300, "auto");	¢Ñ ½ºÅ©·Ñ¹Ù ÀÚµ¿

	//var _sWindowName = typeof(sWindowName) != "undefined" ? sWindowName : "";
	
	var x = (screen.width - w) / 2;
	var y = (screen.height - h) / 2;

	if (sScroll==null) sScroll = "no";
	if (screen.width == 800 && screen.height== 600 ) sScroll = "yes"; // ÇØ»óµµ 800*600ÀÏ ¶§ ½ºÅ©·Ñ »ý±âµµ·Ï ÇÔ 
	
	var sOption = "";
	sOption = sOption + "toolbar=no, channelmode=no, location=no, directories=no, menubar=no";
	sOption = sOption + ", scrollbars=" + sScroll + ", resizable=" + reSize + ", status=" + status +", left=" + x + ", top=" + y + ", width=" + w + ", height=" + h;

	//var win = controlOpenWindow(sURL, sWindowName, sOption);
	var win = window.open(sURL, sWindowName, sOption);
	win.focus();
	return win;
}

function openWinFreePos(sURL, sWindowName, w, h, x, y, sScroll)
{
	// È­¸é Æ¯Á¤À§Ä¡·Î Popup ¶ç¿ì±â.. ½ºÅ©·Ñ¹Ù´Â ¿É¼Ç..
	// ex)
	//			openWin("test.asp", "winTest", 400, 300, 0, 0);			¢Ñ ½ºÅ©·Ñ¹Ù ¾øÀ½
	//			openWin("test.asp", "winTest", 400, 300, 0, 0 "yes");	¢Ñ ½ºÅ©·Ñ¹Ù ÀÖÀ½
	//			openWin("test.asp", "winTest", 400, 300, 0, 0 "auto");	¢Ñ ½ºÅ©·Ñ¹Ù ÀÚµ¿

	if (sScroll==null) sScroll = "no";
	if (screen.width == 800 && screen.height== 600 ) sScroll = "yes"; // ÇØ»óµµ 800*600ÀÏ ¶§ ½ºÅ©·Ñ »ý±âµµ·Ï ÇÔ 
	
	var sOption = "";
	sOption = sOption + "toolbar=no, channelmode=no, location=no, directories=no, resizable=no, menubar=no";
	sOption = sOption + ", scrollbars=" + sScroll + ", left=" + x + ", top=" + y + ", width=" + w + ", height=" + h;

	//var win = controlOpenWindow(sURL, sWindowName, sOption);
	var win = window.open(sURL, sWindowName, sOption);
	return win;
}

function openWinNative(sURL, sWindowName, width, height, x, y) {
	var left = (typeof(x) != "undefined") ? x : (screen.availWidth - width) / 2;
	var top = (typeof(y) != "undefined") ? y : (screen.availHeight - height) / 2;

	var features = "toolbar=no, channelmode=no, location=no, directories=no, resizable=no, menubar=no";
	features = features + ", scrollbars=no, left=" + left + ", top=" + top + ", width=" + width + ", height=" + height;

	var wndPopup = window.open( sURL, sWindowName, features);
	return wndPopup;	
}


// ÀÌº¥Æ® ÇÚµé·¯ wrapper function
// addEventHandler("onload", function) or addEventHandler("load", function)
function addEventHandler( eventName, handler ) {
	if( window.addEventListener ) {
		var qEventName = eventName.toLowerCase();
		if( qEventName.substring(0,2) == "on" ) {
			qEventName = eventName.substring(2);
		}
		window.addEventListener( qEventName, handler, false );
	} else if( window.attachEvent ) {	// for IE
		var qEventName = eventName.toLowerCase();
		if( qEventName.substring(0,2) == "on" ) {
			qEventName = eventName;
		} else {
			qEventName = "on" + eventName;
		}
		window.attachEvent( qEventName, handler );
	}
}


function getCookie(n)
{
	// ÄíÅ° - ·Î±×ÀÎ Á¤º¸ ÀÐ±â..
	// ex)
	//			id = getCookie(CK_MEMBERID);		¢Ñ ¾ÆÀÌµð ÀÐ±â

	var ckLogin = getStrCookie("login");
	if (ckLogin=="" || ckLogin=="undefined" || ckLogin==null) return "";

	var sList = ckLogin.split("%2C");
	if (n < sList.length) return sList[n];

	return "";
}

function getJsCookie(n)
{
	//	age = getJsCookie(JS_AGE);		¢Ñ ³ªÀÌ  ÀÐ±â
	var ckLogin = getStrCookie("HG_JS");
	if (ckLogin=="" || ckLogin=="undefined" || ckLogin==null) return "";

	var sList = ckLogin.split("%5E");
	if (n < sList.length) return sList[n];

	return "";
}
function isPlusHejiResType(plustype){
	// È¸¿øÁ¦ ÇØÁö¿¹¾à»óÅÂÃ¼Å© - plustype : TOTAL/GOSTOP/POKER
	var typelist = getJsCookie(JS_PHEJIRES);
	if(typelist=="" || typelist.length==0)return false;
	var aType=typelist.split("%23");
	plustype = plustype.toUpperCase(); 
	for(var idx=0;idx<aType.length;idx++){
		if(plustype=="TOTAL") {	if(aType[idx]>=10 && aType[idx]<15) return true; }
		if(plustype=="GOSTOP"){	if(aType[idx]>=15 && aType[idx]<20) return true; }
		if(plustype=="POKER") {	if(aType[idx]>=20 && aType[idx]<25) return true; }
	}
	return false;
}
function isPlusItemCookie(nCookie, plusItemName)
{
	var plusItemCookie = getCookie(nCookie);
	if(plusItemCookie == "" || plusItemCookie.length == 0 )	return false;
	
	var aPlusItem = plusItemCookie.split("%23");
	for(var plusItemIdx = 0; plusItemIdx <= aPlusItem.length; plusItemIdx++){
		if(aPlusItem[plusItemIdx] == plusItemName)	return true;
	}
	return false;
}

// author : monarchi
// desc : login info for publishing game client (billing module)
function getStrCookieForPubGameString() {
	var retStr = "";
	var arrCookieName = new Array("HG_LOGIN", "HG_CP_LOGIN", "login");
	
	for(var i=0;i<arrCookieName.length;i++){	
	
		retStr += arrCookieName[i] + "=" + getStrCookie(arrCookieName[i]) + ";";
	}
	return retStr;
}

function getStrCookie(sName)
{
	// ÄíÅ°ÀÐ±â..

	var aRec, aCook = document.cookie.split("; ");

	for (var i=0; i<aCook.length; i++) {
		aRec = aCook[i].split("=");
		if (sName.toLowerCase()==unescape(aRec[0].toLowerCase())) return getRealContents(aRec);
	}

	return "";
}

// ÄíÅ° ÆÄ½Ì ¹ö±× ¼öÁ¤ : ÄíÅ° ³»¿ë¿¡ = ÀÌ ÀÖ´Â °æ¿ì Contents À¯½ÇµÇ´Â °æ¿ì¸¦ ¸·À½
// 20080718 ÀÌÁ¤Àº
function getRealContents(aRec) {
		if (aRec.length > 2) {
			var	strContents = aRec[1];			
			for (var i=2;i<aRec.length;i++) {
				strContents = strContents + "=" + aRec[i];
			}
			return strContents;
		}
		return aRec[1];

}

function setStrCookie(sName, sValue)
{
	// ÄíÅ°¾²±â..

	//var exDate = new Date;
	//exDate.setMonth(exDate.getMonth() + 6);
	//document.cookie = sName + "=" + sValue + ";expires=" + exDate.toGMTString();
	document.cookie = sName + "=" + sValue + ";domain=" + getFixDomain();
	return "";
}

function setMenuURL(sValue)
{
	setStrCookie("menuurl", sValue);
}

function numberFormat(nVar, nSize)
{
	// 0000000123 Çü½ÄÀ¸·Î ¹ÝÈ¯ÇÏ´Â ÇÔ¼ö, nSize »ý·«½Ã 00 ~ 99
	// ex)
	//			n = 2;
	//			s = numberFormat(n, 5);				¢Ñ s = "00002"
	//			s = numberFormat(n);				¢Ñ s = "02"

	if (nSize==null) nSize = 2;

	var s = "0000000000" + nVar;
	var n = s.length;

	return s.substring(n - nSize, n);
}

function isNum(sVal)
{
	// ¼ýÀÚÇü½ÄÀÎÁö °Ë»ç..
	// ex)
	//			b = isNum("123")					¢Ñ b = true
	//			b = isNum("123°¡³ª´Ù")				¢Ñ b = false

	if (sVal=="") return false;
	for (var i=0; i<sVal.length; i++) {
		if (sVal.charAt(i) < "0") return false;
		if (sVal.charAt(i) > "9") return false;
	}
	return true;
}

function isErrorID_Char(sBuf)
{
	// ¹®ÀÚ¿­¿¡ Æ¯¼ö±âÈ£°¡ ÀÖ´Ù¸é true ¸¦ return...

	var sChk = "!@#$%&*()|'[];:\" ^|><~`=+-\\/{}^_,.?	";
	for ( var i=0; i<sBuf.length; i++ ) {
		if (sChk.indexOf(sBuf.charAt(i)) >= 0) {
			return true;
		}
	}
	return false;
}

function isErrorID_tab(sBuf)
{
	// ¹®ÀÚ¿­¿¡ tab±âÈ£°¡ ÀÖ´Ù¸é true ¸¦ return...

	var sChk = "	";
	for ( var i=0; i<sBuf.length; i++ ) {
		if (sChk.indexOf(sBuf.charAt(i)) >= 0) {
			return true;
		}
	}
	return false;
}


function isErrorAddress(sBuf)
{
	// ¹®ÀÚ¿­¿¡ Æ¯¼ö±âÈ£°¡ ÀÖ´Ù¸é true ¸¦ return...( °ø¹éÇã¿ë )

	var sChk = "!@#$%&*()|'[];:\"^|><~`=+-\\/{}^_,.?";
	for ( var i=0; i<sBuf.length; i++ ) {
		if (sChk.indexOf(sBuf.charAt(i)) >= 0) {
			return true;
		}
	}
	return false;
}

function isErrorID_Word(sBuf)
{
	// ¹®ÀÚ¿­¿¡ Æ¯¼öID°¡ ÀÖ´Ù¸é true ¸¦ return...
	var stopIdList = "";

	stopIdList += "ÇÑ°ÔÀÓ,Å×½ºÆ®,µµ¿ì¹Ì,µµ¿À¹Ì,°ü¸®,¿î¿µ,¸¶½ºÅÍ,¸¶½ºÅ¸,admin,root,doumi,ubnf,qlor,anbf,mouky,";
	stopIdList += "°ü¸®ÀÚ,¿î¿µÀÚ,ÁöÅ´ÀÌ,´ã´ç,Ã¥ÀÓÀÚ,¼¾ÅÍ,¹®ÀÇÃ³¸®,»ó´ã,ÁöÅ°¹Ì,¸Å´ÏÀú,ÇïÆÛ,µ¥½ºÅ©,¾È³»,½Å°í,Á¦¾È,";
	stopIdList += "Ã³¸®,µµ¿òÀÌ,¾Æ¹ÙÅ¸,¾ÆÀÌµð,¾îµå¹Î,¿£ÅäÀÌ,¿£¿¡ÀÌÄ¡¿£,³×ÀÌ¹ö,naver,nhn,hangame,entoi,id,adm,desk,";
	stopIdList += "help,helper,doumi,master,119,gÅë½Å,GÅë½Å";

	var sChk = stopIdList.split(",");
	for ( var i=0; i<sChk.length; i++ ) {
		if (sBuf.indexOf(sChk[i]) >= 0) {
			return true;
		}
	}
	return false;
}

String.prototype.trim = function()
{
	// ¹®ÀÚ¿­¿¡ °ø¹éÁ¦°Å..
	// ex)
	//		s = "       ÃÖº¸À±     ".trim();	¢Ñ s = "ÃÖº¸À±"

    return this.replace(/(^\s*)|(\s*$)/g, "");
}

String.prototype.replaceA = function(a, b)
{
	// ¹®ÀÚ¿­ ¹Ù²Ù±â..
	// ex)
	//		s = "abcÃÖº¸À±def".replace("ÃÖº¸À±", "");	¢Ñ s = "abcdef"

	var s = this;
	var n1, n2, s1, s2;

	while (true) {
		if ( s=="" || a=="" ) break;
		n1 = s.indexOf(a);
		if ( n1 < 0 ) break;
		n2 = n1 + a.length;
		if ( n1==0 ) {
			s1 = b;
		}
		else {
			s1 = s.substring(0, n1) + b;
		}
		if ( n2 >= s.length ) {
			s2 = "";
		}
		else {
			s2 = s.substring(n2, s.length);
		}
		s = s1 + s2;
	}
	return s;
}

function checkEmail(EmailForm)
{
	//email Ã¼Å©
	var strEmail = EmailForm.value;
    var i;
    var strCheck1 = false;
    var strCheck2 = false;
	var iEmailLen = strEmail.length
	//var emailDomain = "";

	if (iEmailLen > 0) {
		// strEmail ¿¡ '.@', '@.' ÀÌ ÀÖ´Â °æ¿ì ¿¡·¯¸Þ½ÃÁö.
		// strEmailÀÇ ¸Ç¾Õ ¶Ç´Â ¸ÇµÚ¿¡  '@', '.' ÀÌ ÀÖ´Â °æ¿ì ¿¡·¯¸Þ½ÃÁö.
		if ((strEmail.indexOf(".@") != -1) || (strEmail.indexOf("@.") != -1) ||  (strEmail.indexOf(",") != -1) ||
			(strEmail.substring(0,1) == ".") || (strEmail.substring(0,1) == "@") ||
			(strEmail.substring(iEmailLen-1,iEmailLen) == ".") || (strEmail.substring(iEmailLen-1,iEmailLen) == "@"))
		{
	        alert("EmailÀ» Á¤È®ÇÏ°Ô ÀÔ·ÂÇÏ½Ê½Ã¿À.");
	        EmailForm.focus();
			return false;
		}
	    for ( i=0; i<iEmailLen; i++ ) {
	        if ( (strEmail.substring(i,i+1) == ".") || (strEmail.substring(i,i+1) == "-") || (strEmail.substring(i,i+1) == "_") ||
				((strEmail.substring(i,i+1) >= "0") && (strEmail.substring(i,i+1) <= "9")) ||
				((strEmail.substring(i,i+1) >= "@") && (strEmail.substring(i,i+1) <= "Z")) ||
				((strEmail.substring(i,i+1) >= "a") && (strEmail.substring(i,i+1) <= "z")) ) {
	                if (strEmail.substring(i,i+1) == ".")
						strCheck1 = true;
	                if (strEmail.substring(i,i+1) == "@")
						strCheck2 = true;
	        }
	        else {
	            alert("EmailÀ» Á¤È®ÇÏ°Ô ÀÔ·ÂÇÏ½Ê½Ã¿À.");
	            EmailForm.focus();
				return false;
	        }
	    }

	    if ((strCheck1 == false) || (strCheck2 == false)) {
	        alert("\nEmailÀ» Á¤È®ÇÏ°Ô ÀÔ·ÂÇÏ½Ê½Ã¿À.");
	        EmailForm.focus();
			return false;
	    }
		//emailDomain = strEmail.substring(strEmail.indexOf("@")+1,strEmail.length);
		
	    /*if ((emailDomain.indexOf("hanmail") >= 0) || (emailDomain.indexOf("daum") >= 0)) {
		    alert("¢ß´ÙÀ½Ä¿¹Â´ÏÄÉÀÌ¼ÇÀÇ ¸ÞÀÏ°èÁ¤ÀÎ 'hanmail.net'ÀÌ³ª 'daum.net'Àº\n'´ÙÀ½'ÀÇ ¿Â¶óÀÎ ¿ìÇ¥Á¦·Î ÀÎÇÏ¿© »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.\n ´Ù¸¥ ¸ÞÀÏÀ» µî·ÏÇØ ÁÖ¼¼¿ä.");
	        EmailForm.focus();
	 		return false;
	     }*/
	}
    return true;
}

function getTimezone()
{
	// Client GMT..

	now = new Date();
	return now.getTimezoneOffset();
}

function getTargetString()
{
	var ag, sx;
	if (getCookie(CK_MEMBERID).length > 0 ){
		ag = getCookie(CK_AGE);
		sx = getCookie(CK_SEX) == 'M' ? '1' : '2';
	}else{
		ag = "";
		sx = "";
	}
	
	return "&t2=" + sx + ag;
}

var poker = /hoola2|poker7|duelpoker|sudda|highlow|baduki/g;
var gostop = /msduelgo|ssduelgo|duelgo|gostop|dxgostop|whatu|sambong|doublego/g;
var casual = /tetris|diff|cross|solcard|nomo/g;
var puzzle = /mahjong|reverse|solitaire|same|bby|bingo|hexadlx|mine|bbuster|panpan/g;
var board = /janggi|omok|yutnori2|chess|onecard|bridge|sinyutnori/g;
var sports = /billiard4|billiard3|billiardj|pocket8|pocket9|pocketc8|billiards/g;


function getUnitString(sGameid)
{
	var unitid = "";
	var gm = "";
	if ( location.href.indexOf("game1.hangame.com") >= 0 || location.href.indexOf("game3.hangame.com") >= 0) {
		gm = (sGameid==null) ? getStrCookie("gameid") : sGameid;
	}	
	if(gm.search(gostop) >= 0) {
		unitid = "338A";
	}else if(gm.search(poker) >= 0) {	
		unitid = "339A";	
	}else if(gm.search(casual) >= 0) {
		unitid = "340A";	
	}else if(gm.search(puzzle) >= 0) {
		unitid = "341A";	
	}else if(gm.search(board) >= 0) {
		unitid = "342A";	
	}else if(gm.search(sports) >= 0) {
		unitid = "343A";	
	}
		
	return unitid ;
}

/* ad ÆäÀÌÁö url À» ¸®ÅÏ */
function getAdvurl(sAdunit, sGameid, userid)
{
	var sTarget = getTargetString();
	//alert(sTarget);
	//var sKor = "http://hangamead.naver.com/ad?loc=hangame." + sAdcase + sTarget + "&refresh=5";
	//¼öÁ¤ Àü ¿¹ : http://hangamead.naver.com/ad?loc=hangame.148600ss&showme=html&gm=duelgo&ag=27&sx=m
	//¼öÁ¤ ÈÄ ¿¹: http://ad.hangame.com/adshow?unit=338A&ag=27&sx=m&hgid=shawm
	
	//?t1=[ÀÓÀÇ¹ßÇàµÈ À¯Àú ½Äº°ÀÚ optional]&t2=[³²ÀÚ¸é 1 ¿©ÀÚ¸é 2][³ªÀÌ]
	//¼öÁ¤ ÈÄ ¿¹: http://ad.hangame.com/adshow?unit=338A&t2=130
	
				
	var sKor = "http://ad.hangame.com/adshow?unit=" + sAdunit + sTarget;
 	
	return sKor;
}

function errPassword(sPassword, sBirth)
{
	// ÆÐ½º¿öµå °Ë»ç..
	// ex)
	//		bErr = errPassword("abcd");		¢Ñ ÆÐ½º¿öµå·Î »ç¿ë ºÒ°¡´ÉÇÑ ¹®ÀÚ¿­ÀÌ¸é bErr ¡ç true

	var ch, i, nLen, sSocialID;

	nLen = sPassword.length;
	if (nLen < MAX_PASSWORD_LEN) return true;

	ch = sPassword.substring(0, 1);
	for ( i=0; i<nLen; i++ ) {
		if (ch != sPassword.substring(i, i + 1)) break;
	}
	if (i >= nLen) return true;
	if (sBirth && sBirth.indexOf(sPassword) >= 0) return true;
	if (sPassword=="1234") return true;

	return false;
}

function chkPwdjohap(sPassword)
{
	// ¿µ¹®, ¼ýÀÚ È¥ÇÕ
	var d1=new Array(10);
	var s1=0;
	var s2=0;
	
	for(i=0;i<sPassword.length;i++) {
		d1[i]=sPassword.substring(i,i+1);
	}
	for(i=0;i<sPassword.length;i++) {
		if('A'<=d1[i] && d1[i]<='Z'||'a'<=d1[i] && d1[i]<='z') s1++;
		if('0'<=d1[i] && d1[i]<='9') s2++;
	}
	
	if(s1 < 1 || s2 < 1) return true;
	
	return false;
}

function errChar(ch)
{
	// ¼ýÀÚ, ¿µ¹®, ÇÑ±Û ÀÌ¿ÜÀÇ ¹®ÀÚÀÌ¸é true ¸®ÅÏÇÔ

	if ( ch >= "0" && ch <= "9" ) return false;
	if ( ch >= "a" && ch <= "z" ) return false;
	if ( ch >= "A" && ch <= "Z" ) return false;

	var sEncode = encodeURI(ch);
	if ( sEncode.length==9 ) {
		var sHex = sEncode.substring(1, 3);
		if ( sHex >= "EA" && sHex <= "ED" ) return false;
	}

	return true;
}

function errStandard(sChk)
{
	// ½ºÆ®¸µ¿¡ ¼ýÀÚ, ¿µ¹®, ÇÑ±Û ÀÌ¿ÜÀÇ ¹®ÀÚ°¡ µé¾îÀÖÀ¸¸é true ¸®ÅÏÇÔ

	var ch;

	for (var i=0; i<sChk.length; i++) {
		ch = sChk.substring(i, i + 1);
		if ( errChar(ch) ) return true;
	}

	return false;
}

function getFixDomain()
{
	var s = document.domain;

	if ( s.indexOf("naver.com") >= 0 ) {
		return "naver.com";
	}
	else if ( s.indexOf("hangame.com") >= 0 ) {
		return "hangame.com";
	}
	else {
		var n = s.indexOf(".");
		var test = s.split(".");
		if (test.length > 2)
		{
			return s.substring(n + 1, s.length);
		}else{
			return s;
		}
		
	}
}

function setDomain()
{
	document.domain = getFixDomain();
}

setDomain();


// HTML MUST incluse this code
//<body ONLOAD="page_resize()">    or     window.onload=page_resize
//<div id='page_content'>
// ...
//</div>
//</body>
function page_resize(page_content){
	try{

		if(this.window.name!='') 
		{
			page_content=(page_content==null)?'page_content':page_content;
			var dataobj=document.getElementById(page_content) ;
			dataobj.style.top=0 ;
			dataobj.style.left=0 ;
			var iframe_main;
			if(iframe_main=parent.document.getElementById(this.window.name)) {
				iframe_main.height=dataobj.offsetHeight ;
			}
		}
	}
	catch(e){}
}
// ºü¸£°Ô ¶ç¿ì´Â ÆË¾÷/////////////////////////////////////////
// »ç¿ë¿¹ var win = controlOpenWindow("notice","/notice.jsp","...");

var arrWndOpenWindow = new Array();

function push(array, arg){
	array[array.length] = arg;
}
function pop(array){
	var obj = array[0];
	var temp = new Array();
	for ( i = 1; i < array.length; i++ ){
		temp[i-1] = array[i];
	}
	array = temp;
	return obj;
}
function controlOpenWindow(strURL, strWndName, strOptions) {
	var arrTemp = new Array();
	var wndTemp;
	var wndName;
	
	var arrWndOpenWindow = getArrWndOpenWindow();
	if ( arrWndOpenWindow == null) {
		arrWndOpenWindow = this.arrWndOpenWindow;
	}
	for ( i = 0; i < arrWndOpenWindow.length; i++ ) {
		wndTemp = arrWndOpenWindow[i];
		if ( wndTemp == null) {
			continue;
		}
		if ( !wndTemp['window'] ) {
			continue;
		}
		
		if ( wndTemp['window'].closed ) {
			arrWndOpenWindow[i] = null;
			continue;
		}
		
		wndName = wndTemp['name'];
		if ( wndName != "" && strWndName == wndName ) {
			wndTemp['window'].location.replace(strURL);

			push(arrTemp, wndTemp);
			for ( j = 0; j < arrTemp.length; j++ ) {
				push(arrWndOpenWindow, arrTemp[j]);
			}
			return null;
		}
		push(arrTemp, wndTemp);
	}
	for ( i = 0 ; i < arrTemp.length; i++ ) {
		push(arrWndOpenWindow, arrTemp[i]);
	}

	var	wndNewWindow = window.open(strURL, '', strOptions);
	
	var wndSaveWindow = new Array();
	wndSaveWindow['name'] = strWndName;
	wndSaveWindow['window'] = wndNewWindow;

	push(arrWndOpenWindow, wndSaveWindow);
	return wndNewWindow;
}

function getArrWndOpenWindow() {
	return top.arrWndOpenWindow;
}
// ºü¸£°Ô ¶ç¿ì´Â ÆË¾÷°ü·Ã ³¡//////////////////////////////////

//''''''''''''''''''''''''''''''''''''''''''''
// Menu Implement
//
//''''''''''''''''''''''''''''''''''''''''''''
function popsizectl() {
	var appname = navigator.appName;
	var useragent = navigator.userAgent;
	// firefox°¡ ¾Æ´Ò °æ¿ì¿¡¸¸  ¸®»çÀÌÁî¸¦ ÇÏµµ·Ï ÇÔ 
	if(appname.indexOf("Netscape")==-1 && useragent.indexOf("Firefox")==-1) {
		document.getElementById('page_content').style.position="absolute";
		document.getElementById('page_content').style.left="0";
		document.getElementById('page_content').style.top="0";
		document.getElementById('page_content').style.width="0";
		fitPopupSize();		
	}
}

function popresize(objId) {
	var objOut,popw,poph;

	if ( typeof(objId)=="undefined" || objId==null )
		objId = "page_content";
		
	objOut=document.all(objId);  // ¿Ü°û divÀÇ id·Î objectÃ£±â
	if ( objOut==null || typeof(objOut)=="undefined" )
		return;
		
	popw=objOut.clientWidth+10;	// 10 px : window border
	poph=objOut.clientHeight+29;	// 29 px : windwo border & title bar
	// windowXP SP2 ÆË¾÷ ¹Ù Å©±â °í·Á
	//if(navigator.appVersion.indexOf("Windows NT 5.1; SV1") != -1){
	//	poph=poph+25;
	//}
	if ( isXPSP2() ) {
		poph += 25;
	}

	if( objOut.style.overflowY == "scroll" ) // ¼¼·Î scrollÇÊ¿äÇÑ °æ¿ì¸¦ À§ÇÑ Á¶°Ç¹®
	{
		popw += 16;  // scroll bar ¸¸Å­ pixel°ª
	}

	if(isXP())	poph += 6; //XP ÀÎ°æ¿ì Ã¢ÀÌ Å­.

	this.resizeTo(popw,poph);
	this.focus();
}

//°ÔÀÓ Å¬¶óÀÌ¾ðÆ® Ã¢¿¡¼­ popup µÇ´Â °æ¿ì
function clientPopResize(objId, addWidth, addHeight) {
	var objOut,popw,poph;

	if (typeof(objId)=="undefined" || objId==null)
		objId = "page_content";
		
	objOut=document.all(objId);  // ¿Ü°û divÀÇ id·Î objectÃ£±â
	if (objOut==null || typeof(objOut)=="undefined")
		return;
		
	popw=objOut.clientWidth+22;		// 10 px : window border
//	poph=objOut.clientHeight+29;	// 29 px : windwo border & title bar
	poph=objOut.clientHeight+10;	// 29 px : windwo border & title bar

	if (objOut.style.overflowY == "scroll") { // ¼¼·Î scrollÇÊ¿äÇÑ °æ¿ì¸¦ À§ÇÑ Á¶°Ç¹®
		popw += 16;  // scroll bar ¸¸Å­ pixel°ª
	}

  	if (addWidth != null && typeof(addWidth)!="undefined" && addWidth > 0)
    	popw += addWidth;
    
  	if (addHeight != null && typeof(addHeight)!="undefined" && addHeight > 0)
    	poph += addHeight;
    
    if (poph >= 600)
    	poph = 599; //600À» ³ÑÀ¸¸é °ÔÀÓ Å¬¶óÀÌ¾ðÆ® ÂÊ¿¡¼­ ¹öÆ°ÀÌ º¸ÀÌÁö ¾Ê´Â ¹®Á¦ ÀÖÀ½.
    
	this.resizeTo(popw,poph);
	this.focus();
}

function fitPopupSize_calcSize( arg1, arg2, arg3 ) {
	var toWidth = null;
	var toHeight = null;
	var objOut = null;
	var positionRequired = true;

	var typeArg1 = typeof(arg1);
	var typeArg2 = typeof(arg2);
	var typeArg3 = typeof(arg3);
	
	if( typeArg1 == "undefined" || typeArg1 == "boolean" ) {
		objOut = document.getElementById("page_content");
		
		if( typeArg1 == "boolean" ) {
			positionRequired = arg1;
		}
	}
	if( typeArg1 == "string" ) {
		objOut = document.getElementById(arg1);
		if( objOut == null ) { return null; }
				
		if( typeArg2 == "boolean" ) {
			positionRequired = arg2;
		}
	}

	if( typeArg1 == "object" ) {
		objOut = arg1;
				
		if( typeArg2 == "boolean" ) {
			positionRequired = arg2;
		}
	}
	
	if( objOut != null ) {
		var objParent = objOut.parentNode;
		var getStyle = function(obj) {
			if( obj.currentStyle ) {
				return obj.currentStyle;
			} else if( document.defaultView.getComputedStyle ) {
				return document.defaultView.getComputedStyle(obj, null);
			}
		}

		if( objParent != null && objParent.tagName == "BODY" && getStyle(objOut).position == "absolute" ) {
			try {
				var bodyPaddingTop = 0; var outerPaddingTop = 0;
				var bodyPaddingBottom = 0; var outerPaddingBottom = 0;
				var bodyPaddingLeft = 0; var outerPaddingLeft = 0;
				var bodyPaddingRight = 0; var outerPaddingRight = 0;
				
				if( document.body.currentStyle ) {
					var bodyCurrentStyle = document.body.currentStyle;
					bodyPaddingTop = parseInt(bodyCurrentStyle.paddingTop);
					bodyPaddingBottom = parseInt(bodyCurrentStyle.paddingBottom);
					bodyPaddingLeft = parseInt(bodyCurrentStyle.paddingLeft);
					bodyPaddingRight = parseInt(bodyCurrentStyle.paddingRight);
					
					var outerCurrentStyle = objOut.currentStyle;
					outerPaddingTop = parseInt(outerCurrentStyle.paddingTop);
					outerPaddingBottom = parseInt(outerCurrentStyle.paddingBottom);
					outerPaddingLeft = parseInt(outerCurrentStyle.paddingLeft);
					outerPaddingRight = parseInt(outerCurrentStyle.paddingRight);
					
				} else if( document.defaultView.getComputedStyle ) {
					var objBodyStyle = document.defaultView.getComputedStyle(document.body, null);
					bodyPaddingTop = parseInt(objBodyStyle.getPropertyValue("padding-top"));
					bodyPaddingBottom = parseInt(objBodyStyle.getPropertyValue("padding-bottom"));
					bodyPaddingLeft = parseInt(objBodyStyle.getPropertyValue("padding-left"));
					bodyPaddingRight = parseInt(objBodyStyle.getPropertyValue("padding-right"));
					
					var outerCurrentStyle = document.defaultView.getComputedStyle(objOut, null);
					outerPaddingTop = parseInt(outerCurrentStyle.getPropertyValue("padding-top"));
					outerPaddingBottom = parseInt(outerCurrentStyle.getPropertyValue("padding-bottom"));
					outerPaddingLeft = parseInt(outerCurrentStyle.getPropertyValue("padding-left"));
					outerPaddingRight = parseInt(outerCurrentStyle.getPropertyValue("padding-right"));
				}
				
				var adjustHeight = bodyPaddingTop + bodyPaddingBottom;
				var adjustWidth = bodyPaddingLeft + bodyPaddingRight;
				
				var oWidth = objOut.clientWidth;
				var oHeight = objOut.clientHeight;
				
				// objOut.style.height = oHeight + adjustHeight;				
				objOut.style.paddingTop = outerPaddingTop + bodyPaddingTop;
				objOut.style.paddingBottom = outerPaddingBottom + bodyPaddingBottom;

				// objOut.style.width = oWidth + adjustWidth;
				objOut.style.paddingLeft = outerPaddingLeft + bodyPaddingLeft;
				objOut.style.paddingRight = outerPaddingRight + bodyPaddingRight;
			} catch(e) {
				// do nothing
				// alert( e.message );
			}
		}
		toWidth = objOut.clientWidth;
		toHeight = objOut.clientHeight;
	}

	if( typeArg1 == "number" && typeof(arg2) == "number" ) {
		toWidth = arg1;
		toHeight = arg2;
		
		if( typeArg3 == "boolean" ) {
			positionRequired = arg3;
		}
	}

	//	if( toWidth == null && toHeight == null ) { return {}; }
	
	if (toWidth > screen.availWidth) toWidth = screen.availWidth;
	if (toHeight > screen.availHeight) toHeight = screen.availHeight;
	
	return { "width":toWidth, "height":toHeight, "positionRequired":positionRequired };
}

/**
 * example:
 *  fitPopupSize( [doMove] );                  <- ID°¡ 'page_content'ÀÎ objectÀÇ clientWidth, clientHeight °ª¿¡ µû¶ó »çÀÌÁî Á¶Àý
 *  fitPopupSize( object, [doMove] );          <- ÁÖ¾îÁø objectÀÇ clientWidth, clientHeight°ª¿¡ µû¶ó »çÀÌÁî Á¶Àý
 *  fitPopupSize( "pageOuter", [doMove] );     <- ID°¡ 'pageOuter'ÀÎ objectÀÇ clientWidth, clientHeight °ª¿¡ µû¶ó »çÀÌÁî Á¶Àý
 *  fitPopupSize( 300, 400, [doMove] );        <- ÆË¾÷ Å©±â¸¦ 300 x 400À¸·Î Á¶Àý
 */
function fitPopupSize( arg1, arg2, arg3 ) {
	var calcResult = fitPopupSize_calcSize(arg1, arg2, arg3);
	if( calcResult === null ) {
		return;
	}
	if( calcResult.positionRequired ) {
		fitPopupSize_adjustPosition( calcResult.width, calcResult.height );
	}

	fitPopupSize_resize( calcResult.width, calcResult.height );
}

function fitPopupSize_adjustPosition( toWidth, toHeight ) {
	var posLeft = (window.screenLeft) ? window.screenLeft : window.screenX;
	var posTop = (window.screenTop) ? window.screenTop : window.screenY;
	var adjustLeft = 0;	var marginWidth = 50;
	var adjustTop = 0;	var marginHeight = 50;
	var movingRequired = false;

	if( posTop + toHeight + marginHeight > screen.availHeight ) {
		adjustTop = -(posTop + toHeight + marginHeight - screen.availHeight);
		movingRequired = true;
	}
	if( posLeft + toWidth + marginWidth > screen.availWidth ) {
		adjustLeft = -(posLeft + toWidth + marginWidth - screen.availWidth);
		movingRequired = true;
	}
	if( movingRequired ) {
		window.moveBy( adjustLeft, adjustTop );
	}
}

function fitPopupSize_resize( toWidth, toHeight ) {
	var oBody = document.body;
	if( oBody == null ) { return; }

	if( typeof(window.innerHeight) != "undefined" && typeof(window.innerWidth) != "undefined" ) {
		window.innerHeight = toHeight;
		window.innerWidth = toWidth;
	} else {
		var clientWidth = Math.max( document.documentElement.clientWidth, oBody.clientWidth );
		var clientHeight = Math.max( document.documentElement.clientHeight, oBody.clientHeight );
	
		var diffX = toWidth - clientWidth;
		var diffY = toHeight - clientHeight;

		window.resizeBy( diffX, diffY );
	}
/*	
	var posLeft = (window.screenLeft) ? window.screenLeft : window.screenX;
	var posTop = (window.screenTop) ? window.screenTop : window.screenY;

	if( oBody.clientHeight > screen.availHeight ) {
		var adjustHeight = screen.availHeight - (oBody.clientHeight + 50);
		window.moveTo(posLeft, 0);
		window.resizeBy( 0, adjustHeight );
	}
*/	
}

function fitPopupSizeEx() {
	var oBody = document.body;
	if( oBody == null ) { return; }
	
	var idPrefix = "page_content";
	var objId = "";
	var chkResult = false;
	var objChk = null;
	
	for( var i=65; i<=90; i++ ) {
		objId = idPrefix + String.fromCharCode(i);
		objChk = document.getElementById(objId);
		if( objChk == null ) { break; }
	}
	if( objChk != null ) { return; }

	var objOut = window.document.createElement("<div id='" + objId + "' style='position:absolute;left:0;top:0;'>");

	var existNodeList = window.document.body.childNodes;
	while( existNodeList.length > 0 ) {
		objOut.appendChild( existNodeList[0] );
	}
	document.body.appendChild( objOut );

	var toWidth = objOut.clientWidth;
	var toHeight = objOut.clientHeight;
	if( toWidth == null && toHeight == null ) { return; }

	fitPopupSize_adjustPosition( toWidth, toHeight );

	fitPopupSize_resize( toWidth, toHeight );
}

function clickPageCount(section) {
    //clickframe.location.href='http://click.hangame.com/click/counter.nhn?version=4.0d&section=' + section + '&item=0000';
	var a = 0;
}

function clickPageCount(section,version) {
	if(version==null||version=='') version = "4.0d";
    //clickframe.location.href='http://click.hangame.com/click/counter.nhn?version=' + version + '&section=' + section + '&item=0000';
	var a = 0;
}

function clickPageCount(section,version,icode,ccode,url) {
	var ndsURL = "";
	if(version==null||version=='') version = "4.0d";
	if(icode!=null&&icode!='') ndsURL = "/common/ndsCount.nhn?destinationURL=/i:" + icode + "/c:" + ccode + "?";
	if(url==null||url=='') return;//ndsURL += "http://click.hangame.com/click/counter.nhn?version=" + version + "&section=" + section + "&item=0000";
	else ndsURL += url;
	
	//alert(ndsURL);
	clickframe.location.href = ndsURL;
	
	var a = 0;
}
//author : ¼ÕÁ¤¹Î
//createdt : 20061024
//¹è³ÊµîÀÇ NDS Å¬¸¯·üÀ» Àâ±â À§ÇÑ ÇÔ¼ö
//arg : NDS-Å¬¸¯ Áý°è·Î ³Ñ°ÜÁÙ ÆÄ¶ó¹ÌÅÍ°ª: id ¹ß±ÞÈÄ »ý¼ºµÇ´Â URL°ª
function setNdsClickTag(arg) {
	// arg¿¡ &°ªÀÌ µé¾î¿Ã¼öµµ ÀÖÀ½(URLÀÎÄÚµùÃ³¸® ÇÊ)	
	arg = escape(arg);
	
	if (typeof(__ndsFrame)=="undefined") {
		var s = "<iframe name='__ndsIframe' width=0 height=0 frameborder=0 style='display:none'></iframe>";
		__ndsFrame = "set";
		document.write (s);
	}
	
	__ndsLoadSub(arg);	
}
//author : ¼ÕÁ¤¹Î
//createdt : 20061024
//setNdsClickTag¿¡¼­ È£ÃâÇÏ´Â ½ÇÁúÀûÀ¸·Î NDS callÇÏ´Â ÇÔ¼ö
//arg : NDS ·Î ³Ñ°ÜÁÙ ÆÄ¶ó¹ÌÅÍ°ª, ÀÌ °ªÀ¸·Î NDSµî·ÏÇÏ¸é µÊ
function __ndsLoadSub(arg) {
	if ( document.all.__ndsIframe && typeof(document.all.__ndsIframe)=="object" ) {
		document.all.__ndsIframe.src = "/common/ndsCount.nhn?destinationURL=" + arg ;
	} else {
		setTimeout("__ndsLoadSub('"+ arg + "')",500);	
	}
}
function setPageId() {
	if (typeof(__ndsFrame)=="undefined") {
		//var s = "<iframe name='__ndsIframe' onreadystatechange='ndsChange(this);' width=0 height=0 frameborder=0 style='display:none'></iframe>";
		//s += "<script>attachEvent('onload',__ndsLoad2);</script>";
		//var s = "<iframe name='__ndsIframe' src='http://lcs.hangame.com/u{" + document.URL + "}' width=0 height=0 frameborder=0 style='display:none'></iframe>";
		var s = "<iframe name='__ndsIframe' width=0 height=0 frameborder=0 style='display:none'></iframe>";
		__ndsFrame = "set";
		document.write (s);
		setTimeout("__ndsLoadMain()",500);
	//	alert('common sepageid');
	}
	
}

function __ndsLoadMain() {
	if ( document.all.__ndsIframe && typeof(document.all.__ndsIframe)=="object" ) {
		document.all.__ndsIframe.src = "http://lcs.hangame.com/u{" + document.URL + "}";
	} else {
		setTimeout("__ndsLoadMain()",500);	
	}
}

function isXPSP2(){      
    tmp_MSIE = window.navigator.userAgent.indexOf("MSIE");   
    if(tmp_MSIE && window.navigator.userAgent.indexOf("SV1") > tmp_MSIE){     		
        return true;     //SP2   
    }else{    		
        return false;   
    }  
}

/**
 * °°Àº XP SP2 ¹öÀüÀÌ¶óµµ Æ¯Á¤ ¾ð¾î ³»Áö´Â Æ¯Á¤ ÆÐÄ¡°¡ Àû¿ëµÈ XP¿¡¼­ userAgent °ª¿¡¼­ MSIE, SV1 ¹®ÀÚ¿­ÀÇ À§Ä¡°¡ ´Ù¸¥ °æ¿ì°¡ ÀÖ¾î¼­,
 * À§ÀÇ isXPSP2() ÇÔ¼ö¸¦ ±×´ë·Î »ç¿ëÇÒ ¼ö°¡ ¾ø´Â °æ¿ì°¡ ÀÖ´Ù.
 * º¸´Ù ÀÏ¹ÝÀûÀÎ »óÈ²¿¡¼­ ¾µ ¼ö ÀÖµµ·Ï Ãß°¡µÈ ÇÔ¼ö. (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xpsp2web.asp)
 */
function isXPSP2General() {
   var chkIsSP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
   return chkIsSP2;
}

function isXP(){
	var agent = window.navigator.userAgent;
	if(agent.indexOf("MSIE")!= -1 && agent.indexOf("5.1") !=-1)
	    return true;     //SP1   
    else
        return false;   
}

///////////////////
// ·Î±×ÀÎ ¿©ºÎ Á¶»ç (2004.11.25 ½Å±Ô ÄíÅ°)
// 

function isHangameLogined() {
	var hglogin = getStrCookie("HG_LOGIN");
	if ( hglogin.length > 0 )
		return true;
	else
		return false;
}


///////////////////////////////
// ÆË¾÷ ÄíÅ° °ü·Ã (2004.11.24
///////////////////////////////



var common_POPUPCOOKIENAMEGLOBAL = "POPUP";
var common_POPUPCOOKIENAMEEVENT = "EV_POPUP";
var common_POPUPCOOKIENAMEDOMAIN = "DM_POPUP";
var common_POPUPCOOKIEDELIM = "_";
var common_POPUPCOOKIESUBDELIM = "+";

//////////////////////
// escaping, delete delims
//////////////////////
function common_escapePCID(id) {
	return id.replace(/_/g,"").replace(/\+/g,"");
}


//////////////////////
// ¼­ºñ½º µµ¸ÞÀÎº° ÆË¾÷ ¼³Á¤À» Áö¿øÇÏ±â À§ÇØ ¸¸µé¾îÁø ÄíÅ° ¼³Á¤ ÇÔ¼ö
// ±âÁ¸ ÇÔ¼öµéÀ» Âü°íÇÔ.
// DM_POPUP=name1+expiredate1_name2+expiredate2_name3+expiredate3...;
//////////////////////
function common_setDomainPopup(id, expireDays) {
	var popupCookie = unescape(getStrCookie(common_POPUPCOOKIENAMEDOMAIN));
	var pcaItem = common_parsePopupCookie(popupCookie);
	var currentHost = window.location.hostname;
	
	var todayDate = new Date();
	var tempDate = expireDays;
	todayDate.setDate( todayDate.getDate() + Math.floor(tempDate) );
	tempDate = tempDate - Math.floor(tempDate);
	todayDate.setHours(todayDate.getHours() + Math.floor(tempDate*24) );
	tempDate = tempDate*24 - Math.floor(tempDate*24);
	todayDate.setMinutes(todayDate.getMinutes() + Math.round(tempDate*60) );
	var popupDate = common_getYYYYMMDDHHmm(todayDate);

	// add
	pcaItem.add(id,popupDate);
	var finalPCStr = pcaItem.toString();
	document.cookie = common_POPUPCOOKIENAMEDOMAIN + "=" + finalPCStr + "; domain=" + currentHost + "; path=/; expires=" + pcaItem.maxExpireDate.toGMTString() + ";"
}

//////////////////////
// ¼­ºñ½º µµ¸ÞÀÎº° ÆË¾÷ ¼³Á¤À» Áö¿øÇÏ±â À§ÇØ ¸¸µé¾îÁø ÄíÅ° È®ÀÎ ÇÔ¼ö
// ±âÁ¸ ÇÔ¼öµéÀ» Âü°íÇÔ.
// return true if a cookie named "id" exists and is not expired
//////////////////////
function common_existDomainPopup(id) {
	var popupCookie = unescape(getStrCookie(common_POPUPCOOKIENAMEDOMAIN));
	var pcaItem = common_parsePopupCookie(popupCookie);
	var currentHost = window.location.hostname;
	
	// refresh
	var finalPCStr = pcaItem.toString();
	var maxExpireDate = pcaItem.maxExpireDate;
	if ( maxExpireDate == null )
		maxExpireDate = new Date(1999,11,31,23,59);
	document.cookie = common_POPUPCOOKIENAMEDOMAIN + "=" + finalPCStr + "; domain=" + currentHost + "; path=/; expires=" + maxExpireDate.toGMTString() + ";"
	
	// get
	var foundItem = pcaItem.search(id);
	if ( foundItem && !foundItem.expired ) {
		return true;
	} else {
		return false;
	}
}


//////////////////////
// set popup cookie
// EV_POPUP=name1+expiredate1_name2+expiredate2_name3+expiredate3...;
//////////////////////
function common_setEventPopup(id, expireDays) {
	// only valid in xxx-event.hangame.com or event.hangame.com
	if ( document.location.host.indexOf("event.hangame.com") < 0 && document.location.host.indexOf("eventpark.hangame.com") < 0 ) return;
	
	var popupCookie = unescape(getStrCookie(common_POPUPCOOKIENAMEEVENT));
	var pcaItem = common_parsePopupCookie(popupCookie);
	
	var todayDate = new Date();
	var tempDate = expireDays;
	todayDate.setDate( todayDate.getDate() + Math.floor(tempDate) );
	tempDate = tempDate - Math.floor(tempDate);
	todayDate.setHours(todayDate.getHours() + Math.floor(tempDate*24) );
	tempDate = tempDate*24 - Math.floor(tempDate*24);
	todayDate.setMinutes(todayDate.getMinutes() + Math.round(tempDate*60) );
	var popupDate = common_getYYYYMMDDHHmm(todayDate);

	// add
	pcaItem.add(id,popupDate);
	var finalPCStr = pcaItem.toString();
	document.cookie = common_POPUPCOOKIENAMEEVENT + "=" + finalPCStr + "; path=/; expires=" + pcaItem.maxExpireDate.toGMTString() + ";"
}

//////////////////////
// check popup cookie
// return true if a cookie named "id" exists and is not expired
//////////////////////
function common_existEventPopup(id) {
	// only valid in xxx-event.hangame.com or event.hangame.com
	if ( document.location.host.indexOf("event.hangame.com") < 0 && document.location.host.indexOf("eventpark.hangame.com") < 0 ) return;

	var popupCookie = unescape(getStrCookie(common_POPUPCOOKIENAMEEVENT));
	var pcaItem = common_parsePopupCookie(popupCookie);
	// refresh
	var finalPCStr = pcaItem.toString();
	var maxExpireDate = pcaItem.maxExpireDate;
	if ( maxExpireDate == null )
		maxExpireDate = new Date(1999,11,31,23,59);
	document.cookie = common_POPUPCOOKIENAMEEVENT + "=" + finalPCStr + "; path=/; expires=" + maxExpireDate.toGMTString() + ";"
	
	// get
	var foundItem = pcaItem.search(id);
	if ( foundItem && !foundItem.expired ) {
		return true;
	} else {
		return false;
	}
}

//////////////////////
// set popup cookie
// POPUP=name1+expiredate1_name2+expiredate2_name3+expiredate3...;
//////////////////////

function common_setPopupCookie(id, expireDays) {
	var popupCookie = unescape(getStrCookie(common_POPUPCOOKIENAMEGLOBAL));
	var pcaItem = common_parsePopupCookie(popupCookie);
	
	var todayDate = new Date();
	var tempDate = expireDays;
	todayDate.setDate( todayDate.getDate() + Math.floor(tempDate) );
	tempDate = tempDate - Math.floor(tempDate);
	todayDate.setHours(todayDate.getHours() + Math.floor(tempDate*24) );
	tempDate = tempDate*24 - Math.floor(tempDate*24);
	todayDate.setMinutes(todayDate.getMinutes() + Math.round(tempDate*60) );
	var popupDate = common_getYYYYMMDDHHmm(todayDate);

	// add
	pcaItem.add(id,popupDate);
	var finalPCStr = pcaItem.toString();
	document.cookie = common_POPUPCOOKIENAMEGLOBAL + "=" + finalPCStr + "; domain=hangame.com; path=/; expires=" + pcaItem.maxExpireDate.toGMTString() + ";"
}

//////////////////////
// check popup cookie
// return true if a cookie named "id" exists and is not expired
//////////////////////
function common_existPopupCookie(id) {
	var popupCookie = unescape(getStrCookie(common_POPUPCOOKIENAMEGLOBAL));
	var pcaItem = common_parsePopupCookie(popupCookie);
	// refresh
	var finalPCStr = pcaItem.toString();
	var maxExpireDate = pcaItem.maxExpireDate;
	if ( maxExpireDate == null )
		maxExpireDate = new Date(1999,11,31,23,59);
	document.cookie = common_POPUPCOOKIENAMEGLOBAL + "=" + finalPCStr + "; domain=hangame.com; path=/; expires=" + maxExpireDate.toGMTString() + ";"
	
	// get
	var foundItem = pcaItem.search(id);
	if ( foundItem && !foundItem.expired ) {
		return true;
	} else {
		return false;
	}
}

//////////////////////
// return YYYYMMDDHHmm
//////////////////////
function common_getYYYYMMDDHHmm(d) {
	var year = d.getFullYear();
	var month = common_makeTwoDigits(d.getMonth()+1);
	var date = common_makeTwoDigits(d.getDate());
	var hours = common_makeTwoDigits(d.getHours());
	var mins = common_makeTwoDigits(d.getMinutes());
	return year + month + date + hours + mins;
}

//////////////////////
// "1" -> "01"
//////////////////////
function common_makeTwoDigits(val) {
	if ( eval(val) >= 10 )
		return val.toString();
	else
		return "0"+val.toString();
}

//////////////////////
// YYYYMMDDHHmm -> Date
//////////////////////
function common_makeDateFromString(str) {
	if ( str!=null && str.length==12) {
		var year = eval(str.substring(0,4));
		var month = eval(str.substring(4,6));
		var date = eval(str.substring(6,8));
		var hour = eval(str.substring(8,10));
		var min = eval(str.substring(10,12));
		return new Date(year,month-1,date,hour,min);
	} else
		return null;
}

//////////////////////
// return new common_popupCookieArrayItem from cookie string
//////////////////////
function common_parsePopupCookie(str) {
	var pcaItem = new common_popupCookieArrayItem();
	if ( str ) {
		var arr = str.split(common_POPUPCOOKIEDELIM);
		for ( var i = 0 ; i < arr.length ; i++ ) {
			var temp = arr[i].split(common_POPUPCOOKIESUBDELIM);
			if ( temp!=null ) {
				var pcItem = pcaItem.add(temp[0],temp[1]);
				// maxExpireDate
				if ( pcaItem.maxExpireDate == null )
					pcaItem.maxExpireDate = pcItem.expireDate;
				else if ( pcaItem.maxExpireDate < pcItem.expireDate )
					pcaItem.maxExpireDate = pcItem.expireDate;
			}
		}
	}
	return pcaItem;
}

//////////////////////
// used in common_parsePopupCookie()
//////////////////////
function common_popupCookieArrayItem() {
	this.arrData = new Array();
	this.maxExpireDate = null;
	this.cookieString = "";
	this.toString = common_getPopupCookieString;
	this.add = common_addPopupCookieItem;
	this.search = common_searchPopupCookieItem;
}

//////////////////////
// add item to arrData
//////////////////////
function common_addPopupCookieItem(name,expireDateYYYY) {
	var pcItem = this.search(name);
	if ( pcItem == null ) { // not found
		pcItem = new common_popupCookieItem(common_escapePCID(name),expireDateYYYY);
		this.arrData[this.arrData.length] = pcItem;
	} else { // already exist
		pcItem.expireDateYYYY = expireDateYYYY;
		pcItem.refresh();	
	}
	
	if ( this.maxExpireDate == null )
		this.maxExpireDate = pcItem.expireDate;
	else if ( this.maxExpireDate < pcItem.expireDate )
		this.maxExpireDate = pcItem.expireDate;
	return pcItem;
}

//////////////////////
// return an item named id in arrData
//////////////////////
function common_searchPopupCookieItem(id) {
	var escapedId = common_escapePCID(id);
	for ( var i = 0 ; i < this.arrData.length ; i++ ) {
		if ( this.arrData[i].name == escapedId )
			return this.arrData[i];
	}
	return null;
}

//////////////////////
// return cookie string
//////////////////////
function common_getPopupCookieString() {
	var res = "";
	for ( var i = 0 ; i < this.arrData.length ; i++ ) {
		if ( this.arrData[i] && !this.arrData[i].expired ) {
			if ( res.length > 0 ) res += escape(common_POPUPCOOKIEDELIM);
			res += escape(this.arrData[i].name + common_POPUPCOOKIESUBDELIM + this.arrData[i].expireDateYYYY);
		}
	}
	this.cookieString = res;
	return res;
}

//////////////////////
// pcItem
//////////////////////
function common_popupCookieItem(name,expireDateYYYY) {
	this.name = name;
	this.expireDateYYYY = expireDateYYYY;
	this.expireDate = null;
	this.expired = true;
	this.refresh = common_popupCookieItemRefresh;
	this.refresh();
}

//////////////////////
// refresh date
//////////////////////
function common_popupCookieItemRefresh() {
	this.expireDate = common_makeDateFromString(this.expireDateYYYY);
	var curDate = new Date();
	if ( this.expireDate == null ) {
		this.expired = true;
	} else {
		this.expired = (curDate > this.expireDate) ? true : false;
	}
}

//////////////////////
// delete popup cookie
//////////////////////
function common_delPopupCookie() {
	document.cookie = common_POPUPCOOKIENAMEGLOBAL + "=; domain=hangame.com; path=/; expires=Fri, 31 Dec 1999 23:59:59 ";
}

function common_delEventPopup() {
	document.cookie = common_POPUPCOOKIENAMEEVENT + "=; path=/; expires=Fri, 31 Dec 1999 23:59:59 ";
}


//////////////////////////
// array cookie
//////////////////////////


//////////////////////
// set array cookie
// COOKIENAME=name1+value1+expiredate1_name2+value2+expiredate2_name3+value3+expiredate3...;
//////////////////////
function common_setArrayCookie(cookieName, id, value, expireDays, domain) {
	var acItemList = common_parseArrayCookie(unescape(getStrCookie(cookieName)));
	
	// get expire date
	var endDate = new Date();
	common_addDate(endDate, expireDays);

	// add
	var acItem = acItemList.add(id,value,common_getYYYYMMDDHHmm(endDate));
	common_setArrayCookieReal(cookieName, acItemList.toString(), domain, acItemList.maxExpireDate.toGMTString() );
}

function common_addDate(dateObj, addedDays) {
	var tempDate = addedDays;
	dateObj.setDate( dateObj.getDate() + Math.floor(tempDate) );
	tempDate = tempDate - Math.floor(tempDate);
	dateObj.setHours(dateObj.getHours() + Math.floor(tempDate*24) );
	tempDate = tempDate*24 - Math.floor(tempDate*24);
	dateObj.setMinutes(dateObj.getMinutes() + Math.round(tempDate*60) );
}

//////////////////////
// get array cookie
//////////////////////
function common_getArrayCookie(cookieName, id, domain) {
	var acItemList = common_parseArrayCookie(unescape(getStrCookie(cookieName)));
	
	//refresh
	var maxExpireDate = acItemList.maxExpireDate;
	if ( maxExpireDate == null ) maxExpireDate = new Date(1999,11,31,23,59);
	common_setArrayCookieReal(cookieName, acItemList.toString(), domain, maxExpireDate.toGMTString() );
	
	// get
	var foundItem = acItemList.search(id);
	if ( foundItem && !foundItem.expired )
		return foundItem.value;
	return null;
}

function common_setArrayCookieReal(cookieName, cookieValue, domain, expireDateGMTString) {
	if ( domain != null && domain.length > 0  )
		document.cookie = cookieName + "=" + cookieValue + "; domain=" + domain + "; path=/; expires=" + expireDateGMTString + ";"
	else
		document.cookie = cookieName + "=" + cookieValue + "; path=/; expires=" + expireDateGMTString + ";"
}

//////////////////////
// arrayCookieItem
//////////////////////
function common_arrayCookieItem(name,value,expireDateYYYY) {
	this.name = name;
	this.value = value;
	this.expireDateYYYY = expireDateYYYY;
	this.expireDate = null;
	this.expired = true;
	this.refresh = common_arrayCookieItemRefresh;
	this.refresh();
}

//////////////////////
// refresh date
//////////////////////
function common_arrayCookieItemRefresh() {
	this.expireDate = common_makeDateFromString(this.expireDateYYYY);
	var curDate = new Date();
	if ( this.expireDate == null ) {
		this.expired = true;
	} else {
		this.expired = (curDate > this.expireDate) ? true : false;
	}
}

//////////////////////
// return new common_arrayCookieItemList from cookie string
//////////////////////
function common_parseArrayCookie(str) {
	var acItemList = new common_arrayCookieItemList();
	if ( str ) {
		var arr = str.split(common_POPUPCOOKIEDELIM);
		for ( var i = 0 ; i < arr.length ; i++ ) {
			var temp = arr[i].split(common_POPUPCOOKIESUBDELIM);
			if ( temp!=null ) {
				var acItem = acItemList.add(temp[0],temp[1],temp[2]);
				// maxExpireDate
				if ( acItemList.maxExpireDate == null )
					acItemList.maxExpireDate = acItem.expireDate;
				else if ( acItemList.maxExpireDate < acItem.expireDate )
					acItemList.maxExpireDate = acItem.expireDate;
			}
		}
	}
	return acItemList;
}


//////////////////////
// used in common_parseArrayCookie()
//////////////////////
function common_arrayCookieItemList() {
	this.arrData = new Array();
	this.maxExpireDate = null;
	this.cookieString = "";
	this.toString = common_getArrayCookieString;
	this.add = common_addArrayCookieItem;
	this.search = common_searchArrayCookieItem;
}


//////////////////////
// add item to arrData
//////////////////////
function common_addArrayCookieItem(name,value,expireDateYYYY) {
	var acItem = this.search(name);
	if ( acItem == null ) { // not found
		acItem = new common_arrayCookieItem(common_escapePCID(name),common_escapePCID(value),expireDateYYYY);
		this.arrData[this.arrData.length] = acItem;
	} else { // already exist
		acItem.value = common_escapePCID(value);
		acItem.expireDateYYYY = expireDateYYYY;
		acItem.refresh();	
	}
	
	if ( this.maxExpireDate == null )
		this.maxExpireDate = acItem.expireDate;
	else if ( this.maxExpireDate < acItem.expireDate )
		this.maxExpireDate = acItem.expireDate;
	return acItem;
}

//////////////////////
// return an item named id in arrData
//////////////////////
function common_searchArrayCookieItem(id) {
	var escapedId = common_escapePCID(id);
	for ( var i = 0 ; i < this.arrData.length ; i++ ) {
		if ( this.arrData[i].name == escapedId )
			return this.arrData[i];
	}
	return null;
}

//////////////////////
// return cookie string
//////////////////////
function common_getArrayCookieString() {
	var res = "";
	for ( var i = 0 ; i < this.arrData.length ; i++ ) {
		if ( this.arrData[i] && !this.arrData[i].expired ) {
			if ( res.length > 0 ) res += escape(common_POPUPCOOKIEDELIM);
			res += escape(this.arrData[i].name + common_POPUPCOOKIESUBDELIM + this.arrData[i].value + common_POPUPCOOKIESUBDELIM + this.arrData[i].expireDateYYYY);
		}
	}
	this.cookieString = res;
	return res;
}

function viewActiveObject(html){
	document.write(html);
}
/* Ä³Áê¾ó ¹× °íÆ÷·ù °ÔÀÓÆäÀÌÁö AD*/
function setAdPage(adCode,adGameid,adUserid)	{
  	var adUrl=getAdvurl(adCode,adGameid,adUserid);
  	_writeGameIframeAd(adUrl,250,100);
}
/* Ä³Áê¾ó ¹× °íÆ÷·ù °ÔÀÓÆäÀÌÁö ±¤°í iframe Ad ÅÂ±× */
function _writeGameIframeAd(adUrl, width, height) {
	var s="<iframe src='" + adUrl + "' width='" + width + "' height='" + height + "' frameborder=0 scrolling=no marginheight=0 marginwidth=0></iframe>";
	document.write(s);
}
/* ³»ºÎ±¤°í¿ë Iframe Ad ÅÂ±×*/
function _writeIframeAd(invenid, width, height) {
	document.write("<iframe src='http://ad.nbms.hangame.com/adshow?unit=" + invenid + "' width='" + width + "' height='" + height + "' frameborder=0 scrolling=no marginheight=0 marginwidth=0></iframe>");
}
/* ³»ºÎ±¤°í¿ë Iframe Ad ÅÂ±× (2010.01.21 ver. NBMS2)*/
function _writeIframeAd2(invenid, width, height) {
	document.write("<iframe src='http://ad2.nbms.hangame.com/adshow?slot=" + invenid + "' width='" + width + "' height='" + height + "' frameborder=0 scrolling=no marginheight=0 marginwidth=0></iframe>");
}
function pcbangSearch() {
	window.open('http://pcbang.hangame.com/intro.nhn', '_pcbang_search', '');
}

PopupLoader=function PopupLoaderManager()	{
	this.gameid="";
	this.rating="0";
	this.hangamemoney="0";
	this.lentmoney="0";
	this.totcnt="0";
	this.wincnt="0";
	this.losecnt="0";
	this.setGameid=function(gameid)	{
		this.gameid=gameid;
	}
	this.setRating=function(rating)	{
		this.rating=rating;
	}
	this.setHangamemoney=function(hangamemoney)	{
		this.hangamemoney=hangamemoney;
	}
	this.setLentmoney=function(lentmoney)	{
		this.lentmoney=lentmoney;
	}
	this.setTotcnt=function(totcnt)	{
		this.totcnt=totcnt;
	}
	this.setWincnt=function(wincnt)	{
		this.wincnt=wincnt;
	}
	this.setDefeatcnt=function(defeatcnt)	{

		this.defeatcnt=defeatcnt;
	}
	this.hostPrefix="";
	if(document.URL.indexOf("local-")>=0)	
		this.hostPrefix="local-";
	if(document.URL.indexOf("dev-")>=0)	
		this.hostPrefix="dev-";
	if(document.URL.indexOf("alpha-")>=0)	
		this.hostPrefix="alpha-";
	if(document.URL.indexOf("beta-")>=0)	
		this.hostPrefix="beta-";				

	this.initCss=function()	{
		__css="";
		__css+="<style>";		
		__css+="#NoticeLayer {position:absolute; z-index:9000; overflow:hidden;}\n";
		__css+="\n";
		__css+="#notice_layer_top {width:279px; height:75px; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_layer_top.png) no-repeat top;}\n";
		__css+="#notice_layer_md {width:279px; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_layer_md.png) no-repeat top;}\n";
		__css+="#notice_layer_btm {width:279px; height:39px; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_layer_bttm_gray.png) no-repeat bottom;}\n";
		__css+="*html #notice_layer_top { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_layer_top.png', sizingMethod='crop');}\n";
		__css+="*html #notice_layer_md { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_layer_md.png', sizingMethod='crop');}\n";
		__css+="*html #notice_layer_btm { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_layer_bttm_gray.png', sizingMethod='crop');}\n";
		__css+="#notice_layer_top .h_notice {display:inline; float:left; width:239px; height:51px; margin:24px 0 0 20px; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/line_notice_layer.gif) no-repeat bottom;}\n";
		__css+="#notice_layer_top .h_notice img {margin-left:7px;}\n";
		__css+="#notice_layer_md .notice_cnt {width:221px; margin-left:28px; padding:20px 0 15px 0; text-align:center;}\n";
		__css+="#notice_layer_md .notice_cnt .h_txt {color:#FF6600; letter-spacing:-1px; line-height:1.3;}\n";
		__css+="#notice_layer_md .notice_cnt .txt_1 {padding-top:4px; color:#808080; line-height:1.5;}\n";
		__css+="#notice_layer_md .notice_cnt .txt_2 {padding:14px 0 1px 0; color:#808080; font-size:11px; line-height:1.4;}\n";
		__css+="#notice_layer_md .bx_cnt {width:221px; margin:11px auto 0 auto; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_gray_btm.gif) no-repeat bottom;}\n";
		__css+="#notice_layer_md .bx_cnt_in {width:221px; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_gray_tp.gif) no-repeat top; color:#333;}\n";
		__css+="#notice_layer_md .bx_cnt_in p {padding:10px 0 6px 32px; line-height:1.4;}\n";
		__css+="#notice_layer_btm .btm_gray {width:259px; height:28px; margin-left:10px; background:#F5F5F5;}\n";
		__css+="#notice_layer_btm .btm_gray p.today {display:inline; float:left; margin:10px 0 0 8px; padding-left:6px; background:url(http://images.hangame.co.kr/hangame/renewal_2007/common/ico_arw_21.gif) no-repeat left 2px; color:#464646; font-size:11px; letter-spacing:-1px;}\n";
		__css+="#notice_layer_btm .btm_gray a.btn_close {float:right; margin:6px 5px 0 0;}\n";
		__css+=".today a:link, .today a:visited {color:#464646; text-decoration:none;}\n";
		__css+=".today a:hover, .today a:active {color:#464646; text-decoration:underline;}\n";
		__css+="\n";

		__css+="/*20080407¼öÁ¤*/";
		__css+="#notice_new_top {width:293px; height:96px; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_new_top.png) no-repeat top;}";
		__css+="#notice_new_md {width:293px; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_new_md.png) no-repeat top; text-align:center;}";
		__css+="#notice_new_btm {width:293px; height:40px; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_new_bttm_gray.png) no-repeat bottom; text-align:center;}";
		__css+="*html #notice_new_top {background:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_new_top.png', sizingMethod='crop');}";
		__css+="*html #notice_new_md {background:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_new_md.png', sizingMethod='crop');}";
		__css+="*html #notice_new_btm {background:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_new_bttm_gray.png', sizingMethod='crop');}";
		__css+="#notice_new_top .h_notice {display:inline; float:left; margin:32px 0 0 16px;}";
		__css+="#notice_new_md .notice_cnt {width:235px; margin:0 auto; padding:24px 0 18px 0; text-align:left;}";
		__css+="#notice_new_md .notice_cnt .h_txt {padding:0 0 0 6px; color:#FF6600; font-size:12px; font-weight:bold; letter-spacing:-1px; line-height:1.3;}";
		__css+="#notice_new_md .notice_cnt .txt_1 {padding:2px 5px 8px 5px; color:#808080; font-size:11px; line-height:1.6; letter-spacing:-1px;}";
		__css+="#notice_new_md .notice_cnt .txt_2 {padding:12px 0 1px 6px; color:#808080; font-size:11px; line-height:1.5; letter-spacing:-1px;}";
		__css+="#notice_new_md .bx_cnt {width:235px; margin:9px auto 0 auto; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_btm.gif) no-repeat bottom;}";
		__css+="#notice_new_md .bx_cnt_in {width:235px; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/bx_notice_tp.gif) no-repeat top; text-align:center;}";
		__css+="#notice_new_md .bx_cnt_in table {margin:12px auto 7px auto;}";
		__css+="#notice_new_md .bx_cnt_in table th {width:37px; height:20px; color:#4D4D4D4; letter-spacing:-1px;}";
		__css+="#notice_new_md .bx_cnt_in table td {padding:0 6px 0 8px; background:url(http://images.hangame.co.kr/hangame/renewal_2007/pop/bar_gray_3.gif) no-repeat left 3px; color:#4D4D4D4;}";
		__css+="#notice_new_btm .btm_gray {width:274px; height:29px; margin:0 auto; background:#F3F3F3;}";
		__css+="#notice_new_btm .btm_gray p.today {display:inline; float:left; margin:11px 0 0 10px;}";
		__css+="#notice_new_btm .btm_gray a.btn_close {float:right; margin:13px 10px 0 0;}";
		__css+="/*//20080407¼öÁ¤*/		";
		__css+="</style>";	
		document.write(__css);
	}
	this.initLoader=function()	{
		this.initCss();
		if(this.gameid=="")	{
			alert("gameid ´Â ²À ¼³Á¤µÇ¾î¾ß ÇÕ´Ï´Ù.");
			return false;
		}
		//alert('<iframe name="gamepopup" src="http://' + this.hostPrefix + 'eventpark.hangame.com/popupLoader/loader.nhn?gameid=' + this.gameid + '&rating=' + this.rating + '&hangamemoney=' + this.hangamemoney + '&lentmoney=' + this.lentmoney + '&totcnt=' + this.totcnt + '&wincnt=' + this.wincnt + '&losecnt=' + this.losecnt + '" style="display:none;" frameborder=0 width="0%" height="0%" scrolling=no></iframe>');
		document.write('<iframe name="gamepopup" src="http://' + this.hostPrefix + 'eventpark.hangame.com/popupLoader/loader.nhn?gameid=' + this.gameid + '&rating=' + this.rating + '&hangamemoney=' + this.hangamemoney + '&lentmoney=' + this.lentmoney + '&totcnt=' + this.totcnt + '&wincnt=' + this.wincnt + '&losecnt=' + this.losecnt + '" style="display:none;" frameborder=0 width="0%" height="0%" scrolling=no></iframe>');	
		//document.write('http://' + this.hostPrefix + 'eventpark.hangame.com/popupLoader/loader.nhn?gameid=' + this.gameid + '&rating=' + this.rating + '&hangamemoney=' + this.hangamemoney + '&lentmoney=' + this.lentmoney + '&totcnt=' + this.totcnt + '&wincnt=' + this.wincnt + '&losecnt=' + this.losecnt );
	}
	this.closeLayerByCookie=function(cookie)	{
		common_setEventPopup(cookie,1);
 		this.closeLayer();
	}

	this.closeLayer=function()	{
		var obj=top.document.getElementById("PopupLoader");
		if(obj.style.display=="none")	{
			obj.style.display="";
		}	else	{
			obj.style.display="none";
		}
	}	
}

var __kiwi_uganda_dooli_keroro_title = (typeof(__page_specific_title)=='string'&&__page_specific_title.trim()!='')? __page_specific_title:"ÇÑ°ÔÀÓ - Áñ°Å¿î ½°Ç¥, Go ÇÑ°ÔÀÓ!";
document.title = __kiwi_uganda_dooli_keroro_title;

// SVN Å×½ºÆ®¿ë Ãß°¡

// ¹Ìµð¾îÃ¤³Î¸µ °ü·Ã Ãß°¡
function isMediaChannel() { 
	var idi_cd = getJsCookie(JS_IDI_CD);
	if (idi_cd != null && idi_cd != "" && idi_cd != "HG") {
		var nexturl = document.URL;
		openWin("/common/channeling/restrict.nhn?m=popup&nexturl="+nexturl, "restrictpopup", 490, 360);
		return true;
	}
	return false;
}

function mediaChannelYN() {
	var idi_cd = getJsCookie(JS_IDI_CD);
	if (idi_cd != null && idi_cd != "" && idi_cd != "HG") {
		return true;
	}
	return false;
}

function goPcCheck(gameid) {
	var expectedWidth = 740;
	var expectedHeight = 400;
	var WindowLeft = (screen.availWidth - expectedWidth)/2;
	var WindowTop = (screen.availHeight - expectedHeight)/2;
	openWin("/common/autospeccheck/check.nhn?gameId="+gameid+"&as_gameId="+gameid+"&action=/common/autospeccheck/check.nhn&nextm=view", "pccheck", expectedWidth, expectedHeight);
}

// ¾ÈÁ¤È­ÁöÇ¥ Ç¥ÁØÈ­
var __ssig_frame = '<iframe name="ssigFrame" width="0" height="0" frameborder="0" style="display:none"></iframe>';
var __pcinfo_frame = '<iframe name="pcinfoFrame" width="0" height="0" frameborder="0" style="display:none"></iframe>';
	
function callSSIG(gameid, step, memberid) {
	var ssigUrl = "";
	if ((document.URL.indexOf("local-")>-1) || (document.URL.indexOf("dev-")>-1) || (document.URL.indexOf("alpha-")>-1)) {
		ssigUrl = "http://alpha-lcs.ssig.hangame.com";
	} else {
		ssigUrl = "http://lcs.ssig.hangame.com";
	}		
	document.body.insertAdjacentHTML("beforeEnd", __ssig_frame);
	ssigFrame.location.href = ssigUrl + "/log.html?sub=base&step="+step+"&gid="+gameid.toUpperCase()+"&mid="+encodeURIComponent(memberid);
}

function callSSIGforGP(gameid, step, memberid) {
	var ssigUrl = "";
	if ((document.URL.indexOf("local-")>-1) || (document.URL.indexOf("dev-")>-1) || (document.URL.indexOf("alpha-")>-1)) {
		ssigUrl = "http://alpha-lcs.ssig.hangame.com";
	} else {
		ssigUrl = "http://lcs.ssig.hangame.com";
	}		
	document.write(__ssig_frame);
	ssigFrame.location.href = ssigUrl + "/log.html?sub=base&step="+step+"&gid="+gameid.toUpperCase()+"&mid="+encodeURIComponent(memberid);
}

function callSSIGandPclog(gameid, step, memberid) {
	
	try {
		callSSIG(gameid, step, memberid);
	} catch(e){}
	
	try {
		var kiwiUrl = "";
		if ((document.URL.indexOf("local-")>-1) || (document.URL.indexOf("dev-")>-1)) {
			kiwiUrl = "http://dev-kiwi.hangame.com";
		} else if (document.URL.indexOf("alpha-")>-1) {
			kiwiUrl = "http://alpha-kiwi.hangame.com";
		} else if (document.URL.indexOf("beta-")>-1) {
			kiwiUrl = "http://beta-kiwi.hangame.com";
		} else {
			kiwiUrl = "http://kiwi.hangame.com";
		}	
		
		document.body.insertAdjacentHTML("beforeEnd", __pcinfo_frame);
		pcinfoFrame.location.href = kiwiUrl + '/pcinfo.jsp?gameid=' + gameid + '&memberid=' + memberid + '&svctype=GS';
	} catch(e){}
}
