//¼­¹öÈ£½ºÆ®¸í¿¡ µû¶ó URLÀ» ´Þ¸®ÇÔ
var sCurrenUrl = location.href;
var bFkiller1 = (location.href.indexOf("fkiller") >= 0 || location.href.indexOf("dev-") >= 0 || location.href.indexOf("alpha-") >= 0);
var bBeta = (location.href.indexOf("beta-") >= 0);
if(bFkiller1){
	sAvatarShopURL = "http://alpha-avatar.hangame.com";
	sItemShopURL = "http://alpha-item.hangame.com";
	sLoginURL = "http://alpha-www.hangame.com";
	sJspLoginURL = "http://alpha-id.hangame.com";
	sBBSURL = "http://fkiller1www.hangame.com";
	sStaticURL = "http://fkiller1www.hangame.com";
	sGameURL = "http://alpha-game.hangame.com";
	sQuaURL = "http://fkiller7.hangame.com";
	sMyinfoURL = "http://fkiller1www.hangame.com";
	sPlusURL = "http://alpha-member.hangame.com";
	sMileageURL = "http://alpha-mileage.hangame.com";
	sBbsURL = "http://fkiller1www.hangame.com";
	sHompyURL = "http://alpha-hompy.hangame.com";
	sHbbsURL = "http://alpha-hbbs.hangame.com";
	sEventURL = "http://alpha-event.hangame.com";
	sEventParkURL = "http://alpha-eventpark.hangame.com";
	CONTEXTMENU = true;
} else if(bBeta) {
	sAvatarShopURL = "http://beta-avatar.hangame.com";
	sItemShopURL = "http://beta-item.hangame.com";
	sLoginURL = "http://beta-www.hangame.com";
	sJspLoginURL = "http://beta-id.hangame.com";
	sBBSURL = "http://bbs.hangame.com";
	sStaticURL = "http://static.hangame.com";
	sGameURL = "http://beta-game1.hangame.com";
	sQuaURL = "http://hanqua.hangame.com";
	sMyinfoURL = "http://myinfo.hangame.com";
	sPlusURL = "http://beta-member.hangame.com";
	sMileageURL = "http://beta-mileage.hangame.com";
	sBbsURL = "http://prewww.hangame.com";
	sHompyURL = "http://beta-hompy.hangame.com";
	sHbbsURL = "http://beta-hbbs.hangame.com";
	sEventURL = "http://beta-event.hangame.com";
	sEventParkURL = "http://beta-eventpark.hangame.com";
	CONTEXTMENU = true;
} else {
	sAvatarShopURL = "http://avatar.hangame.com";
	sItemShopURL = "http://item.hangame.com";
	sLoginURL = "http://www.hangame.com";
	sJspLoginURL = "http://id.hangame.com";
	sBBSURL = "http://bbs.hangame.com";
	sStaticURL = "http://static.hangame.com";
	sGameURL = "http://game1.hangame.com";
	sQuaURL = "http://hanqua.hangame.com";
	sMyinfoURL = "http://myinfo.hangame.com";
	sPlusURL = "http://member.hangame.com";
	sMileageURL = "http://mileage.hangame.com";
	sBbsURL = "http://bbs.hangame.com";
	sHompyURL = "http://hompy.hangame.com";
	sHbbsURL = "http://hbbs.hangame.com";
	sEventURL = "http://event.hangame.com";
	sEventParkURL = "http://eventpark.hangame.com";
	CONTEXTMENU = false;
}

//°ÔÀÓ Âü¿© Á¦ÇÑ °ü·Ã Function ..
function diffalert(str) {
	//alert(str);
	if (LoginError()) {
		if (str == "slevel") {
			alert ("ÀÚ½ÅÀÇ µî±Þ¿¡ ¸Â´Â Ã¤³Î¿¡¸¸ Âü¿©ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
		} else if (str == "money") {
			alert ("ÀÚ½ÅÀÇ º¸À¯±Ý¾×¿¡ ¸Â´Â °æ±âÀå¿¡¸¸ Âü¿©ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
		} else if (str == "age") {
			alert ("ÀÚ½ÅÀÇ ³ªÀÌ¿¡ ¸Â´Â °æ±âÀå¿¡¸¸ Âü¿©ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
		} else if (str == "dberror") {
			alert ("DB»óÅÂ°¡ ÁÁÁö ¾Ê½À´Ï´Ù. Àá½Ã ÈÄ ÀÌ¿ëÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
		} else if (str == "recharge") {
			alert ("¸Ó´Ï°¡ ºÎÁ·ÇÏ¿© °ÔÀÓ¿¡ Âü¿©ÇÒ ¼ö ¾ø½À´Ï´Ù.\n¹«·áÃæÀü ¹öÆ°À» ´©¸£¼¼¿ä!");
		} else {
			alert ("Âü¿©ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
		}
	}
}

//game rating Function ..
function goGame(nRating,nMin,nMax,sLink,sTarget){
	var sRating = "¹Ùº¸,¾à°ñ,ÇÏ¼ö,Æò¹Î,Áß¼ö,°í¼ö,¿µ¿õ,ÁöÁ¸,ÃÊÀÎ,½Å,";
	var minRate = "0,900,1100,1300,1500,1700,1900,2100,2300,2500,";
	var maxRate = "899,1099,1299,1499,1699,1899,2099,2299,2499,100000,";

	var minRating = minRate.split(",");
	var maxRating = maxRate.split(",");

	if ( LoginError() ) {
		if((nRating >= minRating[nMin]) && (nRating <= maxRating[nMax])){
			if(typeof(sTarget) == "string"){
				goRoom(sLink);
			}
			else {
				document.location.href = sLink;
			}
		}
		else
			diffalert('slevel');
	}
}

//game menu Function..
var menuCnt=0;

//game button(over/out) Function ..
function overBtnMenu(gameid, n){
	document.all.gamemenu[n].style.fontWeight = "bold";
	document.all.gamemenu[n].style.textDecoration = "none";
}

function outBtnMenu(gameid, n){
	if ( n==menuCnt ) return;
	document.all.gamemenu[n].style.fontWeight = "normal";
}

function changeBtnMenu(gameid, n){
	var old_menuCnt = menuCnt;
	menuCnt = n;
	overBtnMenu(gameid, n);
	if (old_menuCnt != -1) outBtnMenu(gameid, old_menuCnt);
}

//game menu Function..
function clickBtnMenu(gameid, n){

	var current_url = location.href;
	var re = /poker7|highlow|baduki|duelpoker|sudda|hoola2|laspoker|hoola3/g;

	switch (n) {
		case 0: //°ÔÀÓÈ¨
			top.location.href = "/"+gameid+".nhn";

			//click Åë°è(2004-08-26)
			if(gameid == "duelgo") clickPageCount('duelgostop-duelhome');
			else if(gameid == "msduelgo") clickPageCount('menu-home','4.0s','1000001387','5575','');
			else if(gameid == "poker7") clickPageCount('7poker-pokerhome');
			else if(gameid == "tetris") clickPageCount('tetris-tetrishome');
			else if(gameid == "diff") clickPageCount('picturepuzzle-puzzlehome');

			break;
		case 1: //°ÔÀÓ¹æ¹ý
			sURL = "/game/game_help/"+ gameid +"/"+ gameid + "_intro_01.htm";
			if( gameid == "hoola3" ) {
				sURL = "/game/game_help/hoola3/hoola3_intro_01.jsp?bc=1&sc=1";
			}
			if(gameid == "doublego") openWin(sURL,"gamehelp",616,600,'yes');
			else mainDisplay(sURL);

			//click Åë°è(2004-08-26)
			if(gameid == "duelgo") clickPageCount('duelgostop-way');
			else if(gameid == "msduelgo") clickPageCount('menu-how','4.0s','1000001389','13980','');
			else if(gameid == "poker7") clickPageCount('7poker-way');
			else if(gameid == "tetris") clickPageCount('tetris-way');
			else if(gameid == "diff") clickPageCount('picturepuzzle-way');

			break;
		case 2: //¾ÆÀÌÅÛ
			//2005.02.17 ¾ÆÀÌÅÛ ±¸¸Å °æ·Î ÃßÀû
			if (typeof(sGAMEID)=='string') {
				traceid = "ITEM_GP_" + sGAMEID.toUpperCase() + "_1";
			} else if (typeof(traceid)=='string') {
				// nothing
			} else {
				traceid = "";
			}
			var idx=2;
			if(gameid.search(re)>=0) idx=3;
			sURL = sItemShopURL + "/itemMain.nhn?m=subMenuSet&idx="+idx+"&traceid="+traceid;
			mainDisplay(sURL);

			//click Åë°è(2004-08-26)
			if(gameid == "duelgo") clickPageCount('duelgostop-item');
			else if(gameid == "msduelgo") clickPageCount('menu-item','4.0s','1000001390','34361','');
			else if(gameid == "poker7") clickPageCount('7poker-item');

			break;
		case 3: //°×¹ÙÅ¸(gnp)
			//2005.02.17 ¾ÆÀÌÅÛ ±¸¸Å °æ·Î ÃßÀû
			if (typeof(sGAMEID)=='string') {
				traceid = "ITEM_GP_" + sGAMEID.toUpperCase() + "_3";
			} else if (typeof(traceid)=='string') {
				// nothing
			} else {
				traceid = "";
			}
			var gemvatar="gostop";
			if(gameid.search(re)>=0) gemvatar="poker";
			sURL = sAvatarShopURL + "/gamvatar.nhn?gameid=" + gemvatar + "&traceid=" + traceid + "&from=game";
			if (LoginError()) {
				mainDisplay(sURL);
			}

			//click Åë°è(2005-07-30)
			if(gameid == "msduelgo") clickPageCount('menu-gemvata','4.0s','1000001391','18571','');

			break;
		case 4: //ÇÃ·¯½º
			sURL = sPlusURL + "/plus/hanplus.nhn?menu=main";
			top.location.href = sURL;

			//click Åë°è(2004-08-26)
			if(gameid == "duelgo") clickPageCount('duelgostop-plus');
			else if(gameid == "msduelgo") clickPageCount('menu-plus','4.0s','1000001392','44207','');
			else if(gameid == "poker7") clickPageCount('7poker-pokerhome');

			break;
		case 5: //¹ö±×½Å°í
			var bBBS = false; //(diff,tetris,cross,bby:ÀÌ¿ëÈÄ±â·Î..)
			if (gameid == "tetris") bBBS = true;
			sBoard = (bBBS) ? sHbbsURL+"/bbsForm.nhn?m=insertForm&gameid="+gameid.toUpperCase()+"_OPINION" : "/game/bug_board.jsp?gameid="+gameid;

			if (LoginError()) {
				mainDisplay(sBoard);
			}

			//click Åë°è(2004-08-26)
			if(gameid == "duelgo") clickPageCount('duelgostop-bug');
			else if(gameid == "msduelgo") clickPageCount('menu-bug','4.0s','1000001393','57963','');
			else if(gameid == "poker7") clickPageCount('7poker-bug');
			else if(gameid == "tetris") clickPageCount('tetris-bug');
			else if(gameid == "diff") clickPageCount('picturepuzzle-bug');

			break;
	}
	if ( !(n==0 || n==4) && ( n==1 || getCookie(CK_MEMBERID) != "") ) changeBtnMenu(gameid, n);
}

function mainDisplay(sURL,gameid){
	if ( typeof(maintd) == "object" || typeof(gamemain) == "object") {
		showframe();
		gamemain.location.href = sURL;
	} else {
		location.href = sURL;
	}

	if (typeof(sGAMEID)=='string') {
		if(sGAMEID=='msduelgo') game_clicknds(gameid,'',sURL);
	}
}

function showframe() {
	document.all.maintd.style.display = "none";
	document.all.gamemain.style.display = "inline";
}

//game button(over/out) Function ..
function overImage(it){
	it.src=it.src.substr(0,it.src.lastIndexOf("."))+"2"+it.src.substr(it.src.lastIndexOf("."));
}

function outImage(it){
	it.src=it.src.substr(0,it.src.lastIndexOf("2"))+it.src.substr(it.src.lastIndexOf("."));
}

//avatar buy
function buyAvatar(code, str)
{
	if (typeof(sGAMEID)=='string') {
		traceId = sGAMEID.toUpperCase();
	} else if (typeof(traceId)=='string') {
		// nothing
	} else {
		traceId = "";
	}

	if( LoginError() ) {
		var re = /@/g;
		code = code.replace(re,"_");
		//openWin(sItemURL + "/avatar/popAvitem.asp?proc=buy&lstItem=" + code + "@", "avItem", 380, 460);
		//openWin(sAvatarShopURL+'/tradeNew.nhn?m=purchasingForm&itemCodes='+code+'&traceId='+traceId,'avItem',420,600);
		openWin(sAvatarShopURL+'/tradeNew.nhn?m=form&actionType=buy&itemCodes='+code+'&traceId='+traceId,'avItem',420,600);
		if (typeof(sGAMEID)=='string') {
			if(sGAMEID=='msduelgo') game_clicknds("buyavatar",'',sAvatarShopURL+'/tradeNew.nhn?m=form&actionType=buy&itemCodes=D1F033&traceId=MSDUELGO');
		}
	}
}

//avatar gift
function giftAvatar(code, str)
{
	if (typeof(sGAMEID)=='string') {
		traceId = sGAMEID.toUpperCase();
	} else if (typeof(traceId)=='string') {
		// nothing
	} else {
		traceId = "";
	}

	if( LoginError() ) {
		var re = /@/g;
		code = code.replace(re,"_");
		//openWin(sItemURL + "/avatar/popAvitem.asp?proc=gift&lstItem=" + s + "@", "avItem", 380, 460);
		//openWin(sAvatarShopURL + '/tradeNew.nhn?m=purchasingGiftForm&itemCodes='+code+'&traceId='+traceId,'avItem',420,600);
		openWin(sAvatarShopURL+'/tradeNew.nhn?m=form&actionType=gift&itemCodes='+code+'&traceId='+traceId,'avItem',420,600);
	}
}

//item Detail Notice
function itemNotice(code)
{
	//2005.02.17 ¾ÆÀÌÅÛ ±¸¸Å °æ·Î ÃßÀû
	if (typeof(sGAMEID)=='string') {
		traceid = "ITEM_GP_" + sGAMEID.toUpperCase() + "_2";
	} else if (typeof(traceid)=='string') {
		// nothing
	} else {
		traceid = "";
	}
	if ( LoginError() ) {
		//openWin(sItemURL+'/itemshop/itemshop_'+code+'_notice.htm','itemnotice',450,500);
		openWin(sItemShopURL+'/itemDetailView.nhn?m=showItemDetailPop&itemcode='+code+'&status=W&gameid=&traceid='+traceid,'itemnotice',390,600);
	}
}

//item use
function useItem(code, gameid){
	if ( LoginError() ) {
		//openWin(sItemURL+'/itemshop/itemshop_'+code+'_notice.htm','itemnotice',450,500);
		openWin(sItemShopURL+'/itemUse.nhn?m=itemUseGate&status=W&itemcode='+code,'itemuse',390,600);
	}
}

//item buy
function buyItem(code, gameid){
	//2005.02.17 ¾ÆÀÌÅÛ ±¸¸Å °æ·Î ÃßÀû
	if (typeof(sGAMEID)=='string') {
		traceid = "ITEM_GP_" + sGAMEID.toUpperCase() + "_1";
	} else if (typeof(traceid)=='string') {
		// nothing
	} else {
		traceid = "";
	}
	if ( LoginError() ) {
		docref = encodeURI(top.location.href);
		//openWin(sItemURL+'/itemshop/itemshop_'+code+'_notice.htm','itemnotice',450,500);
		openWin(sItemShopURL+'/itemBuy.nhn?=itemBuyi&status=W&itemcode='+code+'&traceid='+traceid+'&docref='+docref,'itemnotice', 540, 540);

		if (typeof(sGAMEID)=='string') {
			if(sGAMEID=='msduelgo') game_clicknds("buyitem",'',sItemShopURL+'/itemBuy.nhn?=itemBuyi&status=W&itemcode=T20&traceid=ITEM_GP_MSDUELGO_1');
		}
	}
}

//item gift
function giftItem(code, gameid){
	//2005.02.17 ¾ÆÀÌÅÛ ±¸¸Å °æ·Î ÃßÀû
	if (typeof(sGAMEID)=='string') {
		traceid = "ITEM_GP_" + sGAMEID.toUpperCase() + "_1";
	} else if (typeof(traceid)=='string') {
		// nothing
	} else {
		traceid = "";
	}
	if ( LoginError() ) {
		//openWin(sItemURL+'/itemshop/itemshop_'+code+'_notice.htm','itemnotice',450,500);
		openWin(sItemShopURL+'/itemPreShop.nhn?m=itemPreShopi&status=W&itemcode='+code+'&traceid='+traceid,'itemnotice', 540, 606);

		if (typeof(sGAMEID)=='string') {
			if(sGAMEID=='msduelgo') game_clicknds("giftitem",'',sItemShopURL+'/itemPreShop.nhn?m=itemPreShopi&status=W&itemcode=T20&traceid=ITEM_GP_MSDUELGO_1');
		}
	}
}

//Login(gameid.htm)..
function loginStatus(gameid) {

var sidvalid = getCookie(CK_IDVALID);
	if( getCookie(CK_MEMBERID) == "" ) {
		location.href = sJspLoginURL + "/wlogin.nhn?nxtURL=" + sGameURL + "/game/" + gameid + ".htm";
	}
	else if ( !(sidvalid == "Y" || sidvalid == "D" || sidvalid == "J" || sidvalid == "A" || sidvalid == "R" || sidvalid == "S") ) {
		location.href = sLoginURL + "/forbidden.nhn?param=4";
	}
}

function go_recharge(gameid) {
	openWin('/game/recharge.nhn?gameid='+gameid,'recharge',387,500);
	//URLº¯°æ½Ã lent_message.jsp ¼öÁ¤
}

function go_lent(lentnum,gameid) {
	openWin('/game/recharge.nhn?m=lentrecharge&lentnum='+lentnum+'&gameid='+gameid,'recharge',387,230);
}

function go_ticket() {
	openWin(sItemShopURL+'/itemUse.nhn?m=useGpageLadderItem_i','ticket',387,230);
}

function go_poker7recharge(gameid) {
	if( gameid == null ) { gameid = 'poker7'; }
	openWin('/poker7/recharge.nhn?gameid=' + gameid,'recharge',387,500);
}
// hoola3 °ü·Ã ÀÓ½Ã ÀÛ¼º. Refactoring ÇÊ¿ä.
function go_pokerCommonRecharge(gameid) {
	openWin('/poker7/recharge.nhn?gameid=' + gameid,'recharge',387,500);
}

// È¸¿øÁ¦ °³Æí °ü·Ã ¹«·áÃæÀü ½ºÅ©¸³Æ® º¯°æ
function set_recharge(gameid){
	openWin('/recharge/'+gameid+'.nhn','recharge',387,500);
}

function gostop_lent(lentnum){
	openWin('/recharge/gostop.nhn?x=lentrecharge&lentnum='+lentnum,'recharge',387,500);
}

function go_Category(str,section) {
	var sURL = "";
	if ( str == "avatar" ) sURL = sAvatarShopURL + "/main.nhn?sub=new100";
	else if ( str == "item" ) sURL = sItemShopURL + "/itemMain.nhn?m=menu_set&idx=0";
	else if ( str == "plus" ) sURL = sPlusURL + "/plus/hanplus.nhn?menu=main";
	else if ( str == "sponsor" ) sURL = sMileageURL + "/default.nhn?forward=sponsor";
	else if ( str == "redcan" ) sURL = sAvatarShopURL + "/main.nhn?sub=redcan";
	else if ( str == "bluecan" ) sURL = sPlusURL + "/plus/hanplus.nhn?menu=bluecan";
	else if ( str == "mileage" ) sURL = sMileageURL + "/default.nhn?forward=lottery";
	else if ( str == "daebak" ) sURL = sAvatarShopURL + "/main.nhn?sub=daebak";
	else if ( str == "plus_gold" ) sURL = sPlusURL + "/plus/hanplus.nhn?menu=gold";
	else if ( str == "plus_red" ) sURL = sPlusURL + "/plus/hanplus.nhn?menu=redcan";

	location.href = sURL;

	if(typeof(sGAMEID) == 'string') {
		if(sGAMEID == 'msduelgo') game_clicknds(str,section,sURL);
	}
}

function game_clicknds(str,section,sURL) {
	var arrService = new Array("avatar","item","redcan","plus","mileage","daebak","note","clothes","gameitem","myinfo","homepi","bonusmoney","sponsor","security","banner1","banner2","banner3","recharge","moneychannel","notice","buyavatar","buyitem","giftitem");
	var arrIcode   = new Array("1000001420","1000001421","1","1","1000001415","1000001419","1000001436","1000001437","1000001438","1000001440","1000001441","1000001442","1000001443","1000001455","1000001417","1000001418","1000001444","1000001439","1000001416","1000001445","1000001423","1000001425","1000001426");
	var arrCcode   = new Array("29989","58807","2","2","9164","64348","11653","41454","28568","53779","38581","29445","55572","50148","58210","14770","48233","29891","12744","57606","47630","4629","21678");
	var arrSurl    = new Array(sURL,sURL,sPlusURL+'/plus/hanplus.nhn?menu=redcan',sPlusURL+'/plus/hanplus.nhn?menu=redcan',sURL,sURL,sPlusURL+'/myinfo/receivememo.nhn',sAvatarShopURL+'/myBox.nhn',
					 sItemShopURL+'/itemMain.nhn?m=itemBagFrame&idx=1',sPlusURL+'/myinfo.nhn',sHompyURL+'/index.nhn?userid=lalala32&msg=hangame',sEventURL+'/plus/bonusMoney.nhn?menu=plususer',
					 sEventParkURL+'/eventpark/sponsor.nhn?menu=ingSponsorEvent',sPlusURL+'/myinfo/smsLoginGuide.jsp',sItemShopURL+'/itemMain.nhn?m=menu_set&idx=-1&itemcode=C30&traceid=ITEM_ALL',
					 sItemShopURL+'/itemBuy.nhn?m=itemBuyi&gameid=gostop&status=W&itemcode=C12&traceid=ITEM_CLIENT',sEventURL+'/vip/preEvent.nhn','http://gostop.hangame.com/game/recharge.nhn?m=lentrecharge&lentnum=4&gameid=msduelgo',sURL,sURL,sURL,sURL,sURL);

	if(typeof(sGAMEID) == 'string') {
		if(sGAMEID == 'msduelgo') {
			for(i=0; i<arrService.length; i++) {
				if(str == arrService[i]) {
					if(str == "redcan" || str == "plus") {
						if(section == '1') clickPageCount(section,'4.0s','1000001427','10527',arrSurl[i]); //°í½ºÅé¸Å´Ï¾ÆÀü¿ë-ÀÚ¼¼È÷º¸±â
						else if(section == '2') clickPageCount(section,'4.0s','1000001428','35091',arrSurl[i]); //°í½ºÅé·¹µåÄµ±×¸²-°¡ÀÔÇÏ±â
						else if(section == '3') clickPageCount(section,'4.0s','1000001429','50105',arrSurl[i]); //ÇÃ·¯½ºÈ¸¿øÁ¦°³Æí¹è³Ê
					} else clickPageCount(section,'4.0s',arrIcode[i],arrCcode[i],arrSurl[i]);
				}
			}
		}
	}
}

// Naver °ÔÀÓ ¹Ù·Î°¡±â:Login Error Ã³¸®(2003-12-09)
// ÇØ´ç°ÔÀÓ : poker7, duelgo, tetris, baduk
function LoginError() {
	if ( getCookie(CK_MEMBERID) == "" ) {
		alert('·Î±×ÀÎÀ» ÇÏ¼¼¿ä!');
		return false;
	} else { return true; }
}


function click_contextmenu() {
	return CONTEXTMENU;
}

//oncontextmenu..
document.oncontextmenu = click_contextmenu;


//GameAvatar / GameItem Rolling°ü·Ã..
var rollCnt_it = 0;
var rollCnt_av = 0;

function game_rollMain()
{
	try{
		var sty  = document.all.rollItem;
		var sty1 = document.all.avatartd;

		rollCnt_it = sty.length-1;
		rollCnt_av = sty1.length-1;
		//alert(typeof(sty));

		for(var i=0;i<sty.length;i++){
			sty[i].style.display =  "none";
		}
		for(var j=0;j<sty1.length;j++){
			sty1[j].style.display =  "none";
		}
		roll_baby();
	}
	catch(e){}
}

function roll_baby(){

	var sty  = document.all.rollItem;
	var sty1 = document.all.avatartd;

	if ( typeof(sty1) == "object" && typeof(sty) == "object" ) {
		sty[rollCnt_it].style.display =  "none";
		sty1[rollCnt_av].style.display =  "none";

		rollCnt_it++;
		rollCnt_av++;
		if (rollCnt_it >= sty.length) rollCnt_it = 0;
		if (rollCnt_av >= sty1.length) rollCnt_av = 0;

		sty[rollCnt_it].style.display =  "inline";
		sty1[rollCnt_av].style.display =  "inline";

		setTimeout("roll_baby()", 5000);

	} else {
		setTimeout("roll_baby()", 500);
	}
}

//¾Æ¹ÙÅ¸ ÀÔ¾îº¸±â ÇÔ¼ö
function clickAVItem(sCode)
{
	if( getCookie(CK_MEMBERID) == "" ){
	}else{
		if ( _avShowItem && sCode )
			_avShowItem.clickItem(sCode);
	}
}
function setRecentHangameCookie( gameid ){
 /*
 	// ÀÌ¹Ì »ç¿ëÇÏÁö ¾Ê´Â ÄíÅ°¶ó¼­ ±¸ÇöºÎºÐ ÁÖ¼®Ã³¸® ÇÕ´Ï´Ù.
 	// RECENT_HANGAME Àº ´Ù¸¥ ¿ëµµ·Î »ç¿ëµÉ ¿¹Á¤ÀÔ´Ï´Ù.
 	// È¤½Ã ¹®Á¦°¡ ¹ß»ýÇÏ¸é ¿ÀÁ¾È­ È¤Àº È«ÁöÇü´Ô¿¡°Ô ¿¬¶ôÁÖ¼¼¿ä.
	var DELIM = "&";
	var sGameid = gameid.toLowerCase();
	var recentHangame = unescape(getStrCookie("RECENT_HANGAME"));

	if(recentHangame == ""){
		recentHangame = sGameid;
		setRHangameCookie("RECENT_HANGAME", recentHangame, 10, "hangame.com");
		return;
	}

	var rgamelist = recentHangame.split(DELIM);

	for(var i=0;i<rgamelist.length;i++){
		if (rgamelist[i]==sGameid){
			return;
		}
	}

	recentHangame = sGameid + DELIM + recentHangame;

	var rHangameList = recentHangame.split(DELIM);

	if(rHangameList.length <= 5 ){
		setRHangameCookie("RECENT_HANGAME", recentHangame, 10, "hangame.com");
		return;
	}

	var resultCookieValue = "";

	resultCookieValue = rHangameList[0]  + DELIM + rHangameList[1]  + DELIM + rHangameList[2]  + DELIM + rHangameList[3]  + DELIM + rHangameList[4];
	setRHangameCookie("RECENT_HANGAME", resultCookieValue, 10, "hangame.com");
*/
//	alert(resultCookieValue);

}
function setRHangameCookie( name, value, expiredays, domain )
{
    var todayDate = new Date();
    todayDate.setDate( todayDate.getDate() + expiredays );
    document.cookie = name + "=" + escape( value ) + "; path=/; domain="+ domain +"; expires=" + todayDate.toGMTString() + ";"
}

// È¨ÇÇ È£Ãâ
function escapeHompy(str)
{
	if( str == null || str.length == 0 ) return "";
	var result = "";
	var reserved = ";/?:@&=+$,%";
	var ch = "";
	for(i = 0; i < str.length; i++)
	{
		ch = str.charAt(i);
		if( reserved.indexOf(ch) != -1 )
			result += "%"+ ch.charCodeAt(0).toString(16);
		else if( ch == " " )
			result += "+";
		else
			result += ch;
	}
	return result;
}

function goBlogPage(userid, url){
	window.open(sHompyURL + '/index.nhn?userid='+userid + '&url=' + escapeHompy(url),'_blank','resizable=yes,width=920,height=620, status=yes');
}

function callWbers(gameid,memberid,pageid,subject) {
	wbers.location.href="http://wbers1.hangame.com/wbers/post.php?project="+gameid+"&subject="+subject+"&id="+memberid+"&value=" + pageid;
}