// right > U-OTP ¹è³Ê
function setOTPLogin() {
	window.open(url_cs +"/content/security/otp.do");
}

function goBadukFaq() {
	openWin(url_cs +"/popup/faq/miniFaqList.do?nodeId=NODE0000000133&parentNodeId=NODE0000000038", 'faq',630, 508);
}

function Page(mnu, pageurl, lnbSub, lnbIndex) {
	this.mnu = mnu;
	this.pageurl = pageurl;
	this.lnbSub = lnbSub;
	this.lnbIndex = lnbIndex;
}
var arrPage = new Array(
	new Page("dummy", "", "", "-1")
	, new Page("baduk", "/index.nhn", "", "-1")
	// °ÔÀÓ½ÇÇà
	, new Page("baduk.client", "/game.nhn?m=launchbzbaduk", "", "-1")
	
	//¹Ìµð¾î > ´º½º
	, new Page("media.news", "/news.nhn", "Media", "0")
	, new Page("media.news.hangame", "/news.nhn?subtype=2", "Media", "0")
	, new Page("media.news.baduk", "/news.nhn?subtype=1", "Media", "0")
	, new Page("media.pressnews", "/pressnews.nhn", "Media", "0")
	//¹Ìµð¾î > ±âº¸
	, new Page("media.gibo", "/gibo.nhn", "Media", "1")
	, new Page("media.gibo.pro", "/gibo.nhn?kind=1", "Media", "1")
	, new Page("media.gibo.hangame", "/gibo.nhn?kind=2", "Media", "1")
	//¹Ìµð¾î > ¸¸È­
	, new Page("media.cartoon", "/cartoon.nhn", "Media", "2")
	, new Page("media.cartoon.lang", "/cartoon.nhn?m=cartoonlist&mastcode=CARTOON&subcode=LANG", "Media", "2")
	, new Page("media.cartoon.ttang", "/cartoon.nhn?m=cartoonlist&mastcode=CARTOON&subcode=TTANG", "Media", "2")
	, new Page("media.cartoon.king", "/cartoon.nhn?m=cartoonlist&mastcode=CARTOON&subcode=KING", "Media", "2")
	//¹Ìµð¾î > Ä®·³
	, new Page("media.column", "/column.nhn", "Media", "3")
	, new Page("media.column.joung", "/column.nhn?m=columnlist&mastcode=COLUMN&subcode=JOUNG", "Media", "3")
	, new Page("media.column.theme", "/column.nhn?m=columnlist&mastcode=COLUMN&subcode=THEME", "Media", "3")
	, new Page("media.column.talk", "/column.nhn?m=columnlist&mastcode=COLUMN&subcode=TALK", "Media", "3")
	, new Page("media.column.diary", "/column.nhn?m=columnlist&mastcode=COLUMN&subcode=DIARY", "Media", "3")
	//¹Ìµð¾î > Áß°èÀÏÁ¤
	, new Page("media.schedule", "/schedule.nhn", "Media", "4")
	//¹Ìµð¾î > ¹ÙµÏÁ¤º¸
	, new Page("media.badukinfo.people", "/people.nhn?kind=1", "Media", "5")
	, new Page("media.badukinfo.people.tmp", "/people.nhn", "Media", "5") //LNB¶§¹®¿¡ Ãß°¡
	, new Page("media.badukinfo.league", "/league.nhn", "Media", "5")
	//°­ÁÂ
	, new Page("lecture", "/lecture.nhn?m=lecturelist&maincode=MC0401&subcode=SC0401001", "Media", "6")												//°­ÁÂ > default ÆäÀÌÁö
	, new Page("lecture.kimslecture", "/lecture.nhn?m=lecturelist&maincode=MC0401&subcode=SC0401001", "Media", "6")						//±è¼º·æ°­ÁÂ > ¿ÕÃÊº¸°ø·«
	, new Page("lecture.kimslecture.kingchobo", "/lecture.nhn?m=lecturelist&maincode=MC0401&subcode=SC0401001", "Media", "6")			//±è¼º·æ°­ÁÂ > ¿ÕÃÊº¸°ø·«
	, new Page("lecture.kimslecture.choboexit", "/lecture.nhn?m=lecturelist&maincode=MC0401&subcode=SC0401002", "Media", "6")			//±è¼º·æ°­ÁÂ > ÃÊº¸Å»Ãâ100
	, new Page("lecture.kimslecture.ggomsu", "/lecture.nhn?m=lecturelist&maincode=MC0401&subcode=SC0401003", "Media", "6")			//±è¼º·æ°­ÁÂ > ²Ä¼öÅ»Ãâ 50
	, new Page("lecture.kimslecture.socsu", "/lecture.nhn?m=lecturelist&maincode=MC0401&subcode=SC0401004", "Media", "6")			//±è¼º·æ°­ÁÂ > ¼Ó¼öÅ»Ãâ 30
	, new Page("lecture.protech", "/lecture.nhn?m=lecturelist&maincode=MC0402&subcode=SC0402001", "Media", "6")							//ÇÁ·ÎÀÇ±â¼ú > ±èÈ¿Á¤ÀÇ ½ÇÀü¸Æ
	, new Page("lecture.protech.core", "/lecture.nhn?m=lecturelist&maincode=MC0402&subcode=SC0402001", "Media", "6")						//ÇÁ·ÎÀÇ±â¼ú > ±èÈ¿Á¤ÀÇ ½ÇÀü¸Æ
	, new Page("lecture.protech.primary", "/lecture.nhn?m=lecturelist&maincode=MC0402&subcode=SC0402002", "Media", "6")					//ÇÁ·ÎÀÇ±â¼ú > Çö¹ÌÁøÀÇ ÃÊ±Þ»çÈ°
	, new Page("lecture.protech.formula", "/lecture.nhn?m=lecturelist&maincode=MC0402&subcode=SC0402003", "Media", "6")					//ÇÁ·ÎÀÇ±â¼ú > À±¿µ¼±ÀÇ Á¤¼®
	, new Page("lecture.protech.ending", "/lecture.nhn?m=lecturelist&maincode=MC0402&subcode=SC0402004", "Media", "6")					//ÇÁ·ÎÀÇ±â¼ú > ÀÌ¿ë¼öÀÇ ³¡³»±â

	//¹ÙµÏ»óÁ¡
	, new Page("shop", "/shop.nhn", "Shop", "0")
	, new Page("shop.avatar","/shop.nhn?m=avatar", "Shop", "1")
	, new Page("shop.item", "/shop.nhn?m=item", "Shop", "2")
	, new Page("shop.plus","/shop.nhn?m=plus", "Shop", "3")
	, new Page("shop.endorphinavatar", "/shop.nhn?m=endorphinavatar", "Shop", "4")
	
	//´ëÈ¸/ÀÌº¥Æ®
	, new Page("match", "/event.nhn", "EventMatch", "0")
	, new Page("matching", "/event.nhn?m=matching", "EventMatch", "0")
	, new Page("matching.badukleague", "/evttpl.nhn?m=badukleague&evtcode=205&evtno=1", "EventMatch", "0")
	, new Page("match.schedule", "/event.nhn?m=matchschedule", "EventMatch", "0")
	, new Page("match.history", "/history.nhn?m=matchlist", "EventMatch", "0")
	, new Page("event", "/event.nhn?m=evtlist", "EventMatch", "1")

	//ÀÌº¥Æ®ÅÛÇÃ¸´
	, new Page("evttpl.match", "/evttpl.nhn?m=tlp&", "EventMatch", "0")
	, new Page("evttpl.match.badukleague", "/evttpl.nhn?m=badukleague&", "EventMatch", "0")
	, new Page("evttpl.event", "/evttpl.nhn?m=event", "EventMatch", "1")

	//·©Å·
	, new Page("ranking", "/mygamerecord.nhn", "Ranking", "0")
	, new Page("ranking.betting", "/myhistory.nhn?m=betting", "Ranking", "0")
	, new Page("ranking.gamble", "/myhistory.nhn?m=gamble", "Ranking", "0")
	, new Page("ranking.badukranking", "/ranking.nhn?m=baduk&kind=M00", "Ranking", "1")
	, new Page("ranking.badukranking.monthly", "/ranking.nhn?m=baduk&kind=M01", "Ranking", "1")
	, new Page("ranking.badukranking.8~", "/ranking.nhn?m=baduk&kind=M02", "Ranking", "1")
	, new Page("ranking.moneyranking", "/ranking.nhn?m=money&kind=D01", "Ranking", "2")
	, new Page("ranking.moneyranking.9~8", "/ranking.nhn?m=money&kind=D02", "Ranking", "2")
	, new Page("ranking.moneyranking.7~", "/ranking.nhn?m=money&kind=D03", "Ranking", "2")
	, new Page("ranking.bettinguser", "/ranking.nhn?m=bettinguser&kind=D09", "Ranking", "3")
	, new Page("ranking.bettinguser.success", "/ranking.nhn?m=bettinguser&kind=D10", "Ranking", "3")
	, new Page("ranking.bettinguser.successrate", "/ranking.nhn?m=bettinguser&kind=D11", "Ranking", "3")
	, new Page("ranking.halloffame", "/ranking.nhn?m=halloffame&kind=D12", "Ranking", "4")
	, new Page("ranking.halloffame.bestwin", "/ranking.nhn?m=halloffame&kind=D13", "Ranking", "4")

	//Ä¿¹Â´ÏÆ¼
	, new Page("bbs", "/bbs.nhn?gameid=BADUK_NOTICE", "Bbs", "0")
	, new Page("bbs.notice", "/bbs.nhn?gameid=BADUK_NOTICE", "Bbs", "0")
	, new Page("bbs.free", "/bbs.nhn?gameid=BADUK_FREE", "Bbs", "1")
	, new Page("bbs.powerup", "/bbs.nhn?gameid=BADUK_GIBO05", "Bbs", "2")

	// ¼­ºñ½º ¹Ù·Î°¡±â
	, new Page("qna", "/qna.nhn", "", "")
	, new Page("guild", "/guild.nhn", "", "-1")
	
	// ¸Å´Ï¾Æ, ¶óÀÌÆ®
	, new Page("membership.myinfo", "/membership/myinfo.nhn", "", "-1")
	, new Page("membership.moneybonus", "/membership/moneybonus.nhn", "", "-1")
	, new Page("membership.avatar", "/membership/avatar.nhn", "", "-1")
	, new Page("membership.benefit", "/membership/benefit.nhn", "", "-1")
	
	// ¹ÙµÏTV
	, new Page("media.baduktv", "/baduktv.nhn", "", "-1")
	, new Page("media.baduktv.recent", "/baduktv.nhn?m=recent", "", "-1")
	, new Page("media.baduktv.match", "/baduktv.nhn?m=match&tb=1&mseq=123", "", "-1")
	, new Page("media.baduktv.lecture", "/baduktv.nhn?m=lecture&tb=2&mseq=16", "", "-1")
	, new Page("media.baduktv.special", "/baduktv.nhn?m=special", "", "-1")
	, new Page("media.baduktv.program", "/baduktv.nhn?m=program", "", "-1")

);

function gopage(mnu, pageurl, target) {
	var pageurl = "";

	//pageurl±îÁö ³Ñ±ä °æ¿ì´Â ¹Ù·Î ÀÌµ¿
	if (typeof(pageurl) == "string" && pageurl != "") {
		location.href = pageurl;
	}

	//mnu¸¦ ±â¼úÇÑ °æ¿ì´Â Ã£¾Æ¼­ ÀÌµ¿
	pageurl = getPageUrl(mnu);

	if (pageurl != "") {
		if (typeof(target) == "string") {
			if (typeof(eval("top."+target)) == "object") {
				var obj = eval("top." + target);
				obj.location.href = pageurl;
			}
		} else {
		location.href = pageurl;
		}
	}
}

//mnu¿¡ ÇØ´çÇÏ´Â URL ¸®ÅÏ
function getPageUrl(mnu) {
	for (var i=0; i<arrPage.length;i++) {
		if (arrPage[i].mnu == mnu) {
			return arrPage[i].pageurl;
		}
	}
}

//»õÃ¢À¸·Î mnu ¶ç¿ì±â
function openPage(mnu) {
	window.open(getPageUrl(mnu));
}

document.title = "ÇÑ°ÔÀÓ - Áñ°Å¿î ¹Ý»ó¿©Çà, ÇÑ°ÔÀÓ ¹ÙµÏ";

function openDeliverInfo() {
  var url = url_member  + "/myinfo/modifypopup.nhn";
  openWinFreePos( url, "deliverinfo", 400, 560, 0, 0);
}

//------------------ ÁÖ±âÀûÀÎ ¸ÞÀÎ ¹è³Ê ¹Ù²ãÁÖ´Â ÇÔ¼öµé  End  -------------------------

function gobzbaduk() {

	// ·Î±×ÀÎ
	if (isHangameLogined() == false) {
		alert("¸ÕÀú ·Î±×ÀÎ ÇØÁÖ¼¼¿ä.");
		return;
	}

	// °ÔÀÓ ½ÇÇà
	if (typeof(document.gogame) == "object") {
		document.gogame.location.href = "/game.nhn?m=launchbzbaduk";
	} else {
		top.location.href="/game.nhn?m=launchbzbaduk";
	}
}

function gobzbadukrid() {

	// ·Î±×ÀÎ
	if (isHangameLogined() == false) {
		alert("¸ÕÀú ·Î±×ÀÎ ÇØÁÖ¼¼¿ä.");
		return;
	}

	// °ÔÀÓ ½ÇÇà
	if (typeof(document.gogame) == "object") {
		document.gogame.location.href = "/game.nhn?m=launch";
	} else {
		top.location.href="/game.nhn?m=launch";
	}
}
function putgradebzbaduk() {
	if (isHangameLogined() == false) {
		alert("¸ÕÀú ·Î±×ÀÎ ÇØÁÖ¼¼¿ä.");
		return;
	}
	openWinFreePos("/popup/bzregrade.nhn?m=bzbadukputgradeform", "regradeWin", 388, 600, 0, 0);
}

function regradebzbaduk() {
	if (isHangameLogined() == false) {
		alert("¸ÕÀú ·Î±×ÀÎ ÇØÁÖ¼¼¿ä.");
		return;
	}
	openWinFreePos("/popup/bzregrade.nhn?m=bzbadukregradeform", "regradeWin", 388, 600, 0, 0);
}

function putnickname() {
	if (isHangameLogined() == false) {
		alert("¸ÕÀú ·Î±×ÀÎ ÇØÁÖ¼¼¿ä.");
		return;
	}
	openWinFreePos("/popup/nickname.nhn?m=form", "nickname", 400, 300, 0, 0);
}

//ÀÚ¹Ù½ºÅ©¸³Æ® ¹öÀü trim ÇÔ¼ö
function trim(strSource) {
	re = /^\s+|\s+$/g;
	return strSource.replace(re, '');
}

//ÀÏ¹ÝÀûÀÎ ÆË¾÷
function openWinNormal(sURL, sWindowName, w, h, sScroll, x, y) {
	if (typeof(x) != "number" && typeof(y) != "number") {
		x = (screen.width - w) / 2;
		y = (screen.height - h) / 2;
	}
	if (sScroll==null) sScroll = "no";
	var sOption = "";
	sOption += "toolbar=no,channelmode=no,location=no,directories=no,resizable=no,menubar=no";
	sOption += ",scrollbars="+sScroll+",left="+x+",top="+y+",width="+w+",height="+h;

	var win = window.open(sURL, sWindowName, sOption);
	return win;
}

function goguild(guildid) {
	if (guildid != "")
		window.open(url_guild + "/guild/index.nhn?guildid=" + guildid);
}

// ±âº¸ºä¾î¿¡¼­ ÇÑ°ÔÀÓ ¹ÙµÏÀ¸·Î ¸µÅ©
function clickLink() {
		window.open(url_baduk);
}

//¹ÙµÏ»çÀü
function dicPopup(value){
	
	//nclicks
	clickcr(this, 'rsg.dic', '', '', event);
		 
	if (value >= 10){
		var code = 'gnb.badukdic0' + value.toString().substring(0);
		dic = window.open('/dic/dic_dcodemain.jsp?dcode='+value, "_dic", "width=688, height=677");
	}else{ 
		dic = window.open('/dic/dic_index.jsp', "_dic", "width=688, height=677");
	}		
	dic.focus();
}

// common_toggle
function toggle(id, idx) {
	var obj = eval("document.all."+id);

	for (var i=0; i<obj.length;i++) {
		if (idx == i) {
			obj[i].style.display = "block";
		} else {
			obj[i].style.display = "none";
		}
	}
}

// ÇÃ·¡½Ã ¸µÅ©
function moneybonus() {
	gopage('ranking');
}

function flashblink() {
}

function flashnews() {
	gopage('media.news');
}

function flashlecture() {
	gopage('lecture');
}

// ¿î¿µÁ¤Ã¥ (Ä¿¹Â´ÏÆ¼)
function policy() {
	var policy = window.open('/qna.nhn?m=policy', "policy",  "scrollbars=no,resizable=no,width=753,height=645");
	policy.focus();
}

//°ÔÀÓ°¡ÀÌµå
function gameguide(id, subid, tip){
	
	//nclicks
	clickcr(this, 'rsg.howto', '', '', event);
		 
	var url = "guide.nhn";
	if (id != null) url += "?mode=" + id;
	if (subid != null) url += "&subid=" + subid;
	if (tip != null) url += "#tip" + tip;

	var badukguideWin = window.open(url, "badukguideWin",  "scrollbars=no,resizable=no,width=800,height=650");
	badukguideWin.focus();
}

// ¸Å´Ï¾Æ,¶óÀÌÆ® ¸Ó´Ïº¸³Ê½º ¹Þ±â
function goBonusMoney(){
	openWin("/membership/receivemoney.nhn", "bonusMoney", 390, 300);
}

// ¸Å´Ï¾Æ, ¶óÀÌÆ® º¸³Ê½º ¸Ó´Ï¹Þ±â - ÀÌ¹Ì ¸Ó´Ï¸¦ ¹ÞÀº °æ¿ì
function goUpgrade() {
	alert("ÀÌ´ÞÀÇ º¸³Ê½º¸Ó´Ï¸¦ ÀÌ¹Ì ¹ÞÀ¸¼Ì½À´Ï´Ù.\n¹ÙµÏPlus·Î ÀüÈ¯ÇÏ½Ã°í ´õ Å« ÇýÅÃÀ» ´©·Áº¸¼¼¿ä!");
	window.open(url_plus2 + "/baduk/introduce.nhn");
}

// Ãâ±ÝÅëÀå »ç¿ëÇÏ±â
function goUseItemBank(itemcode, membership, status, cubaMode) {
	
	if (membership == 'BM0030') {
		clickcr(this, 'rmy_aep.bank', '', '', event);
	} else if (membership == 'BM0040') {
		clickcr(this, 'rmy_sin.bank', '', '', event);
	}
	var url = url_item + "/itemUse.nhn?status=" + status + "&m=usePlusMainItem_p&itemcode=" + itemcode + "&pluscode=" + membership + "&gameid=baduk";
    url += "&docref=" + escape("http://"+location.host+location.pathname  + "?mode=" + cubaMode);
    openWin(url,"itempop",390, 600);
}

// Cuba ·Î±× Àû¿ë 2010.01.21
//target : _blank, top, ±×¿Ü´Â self
function cubaStr(url, paramtype, cubamode, target) {
	var cubaURL;
	
	/*
	if (isHangameLogined() == false) {
		if (paramtype == "?") {
			cubaURL =  url +paramtype + escape("docref=http://" + location.host + location.pathname + "?mode=" + cubamode);
		} else {
			cubaURL =  url + escape( paramtype + "docref=http://" + location.host + location.pathname + "?mode=" + cubamode);
		}
	} else {
		cubaURL =  url +paramtype +"docref=http://" + location.host + location.pathname + "?mode=" + cubamode;
	}
	*/
	cubaURL =  url +paramtype +"docref=http://" + location.host + location.pathname + "?mode=" + cubamode;
	
	if (target == '_blank') {
		window.open(cubaURL);
	} else 	if (target == 'top') {
		top.location.href = cubaURL;
	} else {
		location.href = cubaURL;
	}
}
