/**
* @(#)gnb_informal.js $version 2010. 12. 07
*
* Copyright 2010 NHN Corp. All rights Reserved.
* NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/

/**
* @name gnb
* @namespace
* dependency:  common.js, informalheader.js
* file encoding: MS949
* web encoding: EUC-KR ¶Ç´Â KSC5601
*/

var logger = {
		log: function(msg){
			if(typeof console != 'undefined'){
				console.log(msg);
			} else {
				//alert(msg);
			}
		},
		
		debug: function(debug){
			if(typeof console != 'undefined'){
				console.log(debug);
			} else {
				//alert(debug);
			}
		}
}

var gnb = {
		bSecureGnbFlag: false,
		bIsLoaded: false,
		bIsRecentCalled: false,
		isIE6: (navigator.userAgent.toLowerCase().indexOf('msie 6') != -1),
		loadImgPosfix:'',
		tryCnt:0,
		config: {
			login : true,
			customer : false,
			align : 'center',
			ssl : false
		}
};

gnb.setHeaderCSS = function(type, color) {
	if(typeof color != 'undefined' && color != null){
		if(color == 'black'){
			gnb.loadImgPosfix = 'gnb_s_b/'; 
		} else if (color == 'white'){
			gnb.loadImgPosfix = 'gnb_s_w/';
		}
	}
	
	var prefix = (__bDevZone || __bAlphaZone) ? "alpha-" : "";
	var cssUrl = 'http://'+prefix+'images.hangame.co.kr/hangame';
	
	if(this.bSecureGnbFlag == true){		
		var cssUrl = "https://" + prefix + "imgsec.hangame.com/images/";
	}
	
	// https ÀÌ°í ie6 ÀÏ ¶§ ÀÎÅÍ³Ý ¿É¼ÇÀÌ ÆäÀÌÁö ¿­¶§¸¶´Ù·Î µÇ¾î ÀÖÀ½ a tag  ¸¶¿ì½º½Ã ¹è°æÀ» »õ·Î ·ÎµùÇÏ´Â (https connect È£Ãâ) ÀÌ½´ Ã³¸®
	// ±Ùº»ÀûÀÎ ÇØ°áÃ¥Àº a tag¿¡ ¹è°æ ÁÖÁö ¸»°í div·Î wrap ÇØ¼­ div¿¡ ¹è°æ ÁÖ±â
	var bgImageCache = '';
	
	if(this.isIE6 && this.bSecureGnbFlag) {
		bgImageCache = 'html {filter: expression(document.execCommand("BackgroundImageCache", false, true));}';
	}
	
	var sBasic = '<style type="text/css">' +
		bgImageCache +
		'body {margin:0; padding:0; }' +
		'#gnb_hangame {position:relative; height:36px; background:url('+cssUrl+'/renewal_2010/common/gnb_hangame_bg.gif) 0 0 repeat-x; text-align:center; z-index:25555;}' +
		'#gnb_hangame * {margin:0; padding:0;  font-size:12px;  letter-spacing:-1px;  font-family:Dotum, µ¸¿ò; color:#6f6f6f; } ' +
		'#gnb_hangame .gnb_areabox  img {border:0; vertical-align:top;}' +
		'#gnb_hangame .gnb_areabox {position:relative; width:960px; height:36px; margin:0 auto; text-align:left;}' +
		'#gnb_hangame .gnb_areabox.left_a {float:left !important; margin-left:10px;}' +
		'#gnb_hangame .gnb_top {height:35px;}' +
		'#gnb_hangame .gnb_top dt {display:block; position:absolute; left:0; top:0; width:118px; height:35px;}' +
		'#gnb_hangame .gnb_top a {display:block; width:118px; height:35px; background:url('+cssUrl+'/renewal_2011/common/gnb_top_txt.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .gnb_top a span {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .gnb_top dd {position:absolute; right:0; top:0;}' +
		'#gnb_hangame .gnb_top dd li {float:left; height:35px; background:url('+cssUrl+'/renewal_2011/common/gnb_top_txt.gif) 100% 0 no-repeat; list-style:none; }' +
		'#gnb_hangame .gnb_top dd li a {display:block; height:35px; margin-right:1px; background:url('+cssUrl+'/renewal_2011/common/gnb_top_txt.gif) no-repeat;}' +
		'#gnb_hangame .gnb_top dd li span {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .gnb_top dd li.allgame a {width:66px; background-position:-200px 0;  }' +
		'#gnb_hangame .gnb_top dd li.allgame_selected a {width:66px; background-position:-300px 0;  }' +
		'#gnb_hangame .gnb_top dd li.gametak a {width:42px; background-position:-400px 0;  }' +
		'#gnb_hangame .gnb_top dd li.smartphone a {width:71px; background-position:-500px 0;  }' +
		'#gnb_hangame .gnb_top dd li.mobilegame a {width:61px;  background-position:-600px 0; }' +
		'#gnb_hangame .gnb_top dd li.last {background:none; }' +
		'#gnb_hangame .gnb_top dd li.center a {width:52px;  background-position:-700px 0; }' +
		'#gnb_hangame .gnb_top dd li.login_btn {padding:7px 0 0 7px; background:none; }' +
		'#gnb_hangame .gnb_top dd li.logout_btn {padding:7px 0 0 7px; background:none; }' +
		'#gnb_hangame .gnb_top dd li.login_btn a {width:52px; height:22px; background:url('+cssUrl+'/renewal_2010/common/gnb_btn_login.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .gnb_top dd li.logout_btn a {width:62px; height:22px; background:url('+cssUrl+'/renewal_2010/common/gnb_btn_logout.gif) 0 0 no-repeat; }' +
		'/*layer*/' +
		'#gnb_hangame .gnb_allgamelist {position:absolute; top:35px; right:0; width:960px;  border:2px solid #b1b1b1; line-height:1.0em; background:#FFF; margin:0;padding:0; z-index:100; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist {position:relative; float:left; width:136px; height:295px; border-right:1px solid #e5e5e3;  }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dt {height:25px; margin-bottom:8px; border-bottom:1px solid #cacac7; background:#f5f5f2; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dt span {display:inline-block; width:100px; padding:5px 0; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dt span em {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game1 {width:275px; background:url('+cssUrl+'/renewal_2010/common/li_y.gif) 134px 26px no-repeat #FFF;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game1 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_ly_tit.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game2 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_ly_tit.gif) -100px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game3 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_ly_tit.gif) -200px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game4 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_ly_tit.gif) -300px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game5 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_ly_tit.gif) -400px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game6 {border-right:0; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game6 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_ly_tit.gif) -500px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 {clear:both; position:absolute; right:0; top:165px; width:273px; height:129px; border-right:0;  background:url('+cssUrl+'/renewal_2010/common/li_y.gif) 136px 100% no-repeat #FFF;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dt { border-top:1px solid #cacac7;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_ly_tit.gif) -600px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dd {position:relative; clear:both; color:#c5c5c5; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dd  a {display:block; padding:4px 5px 5px 13px; line-height:1.0em !important;}' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dd img{position:absolute; margin:0; vertical-align: top; border:0; top: 3px; right: 10px; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dd .no_link {display:block; padding:4px 5px 5px 13px;  color:#c5c5c5; line-height:1.0em !important;}' +
		'.gnb_allgamelist dd a{color:#6f6f6f !important; text-decoration:none; font-family:Dotum, µ¸¿ò; }' +
		'.gnb_allgamelist dd a:hover {color:#6f6f6f; text-decoration:underline;}' +
		'.gnb_allgamelist dd a:visited {color:#6e4987 !important;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game1 dd {clear:none; float:left; width:135px;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dd {clear:none; float:left; width:136px;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dd.etc_padd a {padding-left:15px; }' +
		'#gnb_hangame .btn_close_ly {display:block; position:absolute; top:-2px; right:-22px; width:20px; height:21px; background:url('+cssUrl+'/renewal_2010/common/gnb_btn_close.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .btn_close_ly span {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .game_p {color:#f66e1c !important;  font-weight:bold; }' +
		'#gnb_hangame .gnb_allgamelist .loading_gnb {display:block; width:20px; height:20px; margin:0 0 0 468px;  padding:127px 0; }' +
		'#gnb_hangame .gnb_allgamelist .loading_gnb img {width:20px !important; height:20px !important; }' +
		'#gnb_hangame .gnb_allgamelist_backframe {position:absolute; top:35px; right:0; display:none; filter: alpha(opacity:1); opacity:1; zoom:1; background-color:#fff;   z-index:50}' +
		'</style>';
	
	// white ¾à½Ä GNB CSS
	var sWhite = '<style type="text/css">' +
		bgImageCache +
		'body {margin:0; padding:0; }' +
		'#gnb_hangame {position:relative; width:100%;  _min-wight:960px; height:25px; background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/gnb_hangame_bg.gif) 0 0 repeat-x; text-align:center; z-index:25555;}' +
		'#gnb_hangame * {margin:0; padding:0;  font-size:12px;  letter-spacing:-1px;  font-family:Dotum, µ¸¿ò; color:#6f6f6f; } ' +
		'#gnb_hangame .gnb_areabox  img {border:0; vertical-align:top; }' +
		'#gnb_hangame .gnb_areabox {position:relative; width:100%; _min-wight:960px; height:25px; margin:0 auto; text-align:left;}' +
		'#gnb_hangame .gnb_top {overflow:hidden; width:100%; min-width:960px; height:25px; }' +
		'#gnb_hangame .gnb_top dt {position:absolute; left:0; top:0; display:block; width:100px; height:25px; margin-right:500px; z-index:100;  }' +
		'#gnb_hangame .gnb_top a {display:block; width:100px; height:25px; background:url('+cssUrl+'/renewal_2011/common/gnb_s_w/gnb_top_txt.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .gnb_top a span {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .gnb_top dd {float:right; height:25px; width:500px;  margin-left:150px; }' +
		'#gnb_hangame .gnb_top dd ul {float:right; padding-right:10px; }' +
		'#gnb_hangame .gnb_top dd li {float:left; height:25px; height:25px; background:url('+cssUrl+'/renewal_2011/common/gnb_s_w/gnb_top_txt.gif) 100% 0 no-repeat; list-style:none; white-space:nowrap; }' +
		'#gnb_hangame .gnb_top dd li a {overflow:hidden; display:block; height:25px; margin-right:1px; background:url('+cssUrl+'/renewal_2011/common/gnb_s_w/gnb_top_txt.gif) no-repeat; }' +
		'#gnb_hangame .gnb_top dd li span {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .gnb_top dd li.allgame a {width:60px; background-position:-201px 0;  }' +
		'#gnb_hangame .gnb_top dd li.allgame_selected a {width:60px; background-position:-301px 0;  }' +
		'#gnb_hangame .gnb_top dd li.gametak a {width:41px; background-position:-400px 0;  }' +
		'#gnb_hangame .gnb_top dd li.smartphone a {width:70px; background-position:-500px 0;  }' +
		'#gnb_hangame .gnb_top dd li.mobilegame a {width:59px;  background-position:-600px 0; }' +
		'#gnb_hangame .gnb_top dd li.last {background:none; }' +
		'#gnb_hangame .gnb_top dd li.center a {width:50px;  background-position:-700px 0; }' +
		'#gnb_hangame .gnb_top dd li.login_btn {padding:2px 0 0 7px; background:none; }' +
		'#gnb_hangame .gnb_top dd li.logout_btn {padding:2px 0 0 7px; background:none; }' +
		'#gnb_hangame .gnb_top dd li.login_btn a {width:47px; height:20px; background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/gnb_btn_login.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .gnb_top dd li.logout_btn a {width:58px; height:20px; background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/gnb_btn_logout.gif) 0 0 no-repeat; }' +
		'/*layer*/' +
		'#gnb_hangame .gnb_allgamelist {position:absolute; top:25px; left:50% ; width:956px; margin-left:-480px;  border:2px solid #b1b1b1; line-height:1.0em; background:#FFF; z-index:100;}' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist {position:relative; float:left; width:136px; height:295px; border-right:1px solid #e5e5e3;}' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dt {height:25px; margin-bottom:8px; border-bottom:1px solid #cacac7; background:#f5f5f2; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dt span {display:inline-block; width:100px; padding:5px 0; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dt span em {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game1 {width:271px; background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/li_y.gif) 134px 26px no-repeat #FFF;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game1 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/gnb_ly_tit.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game2 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/gnb_ly_tit.gif) -100px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game3 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/gnb_ly_tit.gif) -200px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game4 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/gnb_ly_tit.gif) -300px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game5 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/gnb_ly_tit.gif) -400px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game6 {border-right:0; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game6 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/gnb_ly_tit.gif) -500px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 {clear:both; position:absolute; right:0; top:165px; width:273px; height:129px; border-right:0;  background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/li_y.gif) 136px 100% no-repeat #FFF;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dt { border-top:1px solid #cacac7;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/gnb_ly_tit.gif) -600px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dd {clear:both; color:#c5c5c5; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dd  a {display:block; padding:4px 5px 5px 13px; line-height:1.0em !important;}' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dd .no_link {display:block; padding:4px 5px 5px 13px;  color:#c5c5c5; line-height:1.0em !important;}' +
		'.gnb_allgamelist dd a{color:#6f6f6f !important; text-decoration:none; font-family:Dotum, µ¸¿ò; }' +
		'.gnb_allgamelist dd a:hover {color:#6f6f6f; text-decoration:underline;}' +
		'.gnb_allgamelist dd a:visited {color:#6e4987 !important;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game1 dd {clear:none; float:left; width:135px;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dd {clear:none; float:left; width:136px;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dd.etc_padd a {padding-left:15px; }' +
		'#gnb_hangame .btn_close_ly {display:block; position:absolute; top:-2px; right:-22px; width:20px; height:21px; background:url('+cssUrl+'/renewal_2010/common/gnb_s_w/gnb_btn_close.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .btn_close_ly span {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .game_p {color:#f66e1c !important;  font-weight:bold; }' +		
		'#gnb_hangame .gnb_allgamelist .loading_gnb {display:block; width:20px; height:20px; margin:0 0 0 468px;  padding:127px 0; }' +	
		'#gnb_hangame .gnb_allgamelist .loading_gnb img {width:20px !important; height:20px !important; }' +
		'#gnb_hangame .gnb_allgamelist_backframe {position:absolute; top:25px; left:50%; margin-left:-480px; display:none; filter: alpha(opacity:1); opacity:1; zoom:1; background-color:#fff;   z-index:50}' +
		'</style>';
	
	// black ¾à½Ä GNB CSS
	var sBlack = '<style type="text/css">' +
		bgImageCache +
		'body {margin:0; padding:0; }' +
		'#gnb_hangame {position:relative; width:100%; _min-wight:960px; height:25px; background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/gnb_hangame_bg.gif) 0 0 repeat-x; text-align:center; z-index:25555;}' +
		'#gnb_hangame * {margin:0; padding:0;  font-size:12px;  letter-spacing:-1px;  font-family:Dotum, µ¸¿ò; color:#6f6f6f; } ' +
		'#gnb_hangame .gnb_areabox img {border:0; vertical-align:top;}' +
		'#gnb_hangame .gnb_areabox {position:relative; width:100%; _min-wight:960px; height:25px; margin:0 auto; text-align:left;}' +		
		'#gnb_hangame .gnb_top {overflow:hidden; width:100%; min-width:960px; height:25px; }' +
		'#gnb_hangame .gnb_top dt {position:absolute; left:0; top:0; display:block; width:100px; height:25px; margin-right:500px; z-index:100;  }' +
		'#gnb_hangame .gnb_top a {display:block; width:100px; height:25px; background:url('+cssUrl+'/renewal_2011/common/gnb_s_b/gnb_top_txt.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .gnb_top a span {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .gnb_top dd {float:right; height:25px; width:500px;  margin-left:150px; }' +
		'#gnb_hangame .gnb_top dd ul {float:right; padding-right:10px; }' +
		'#gnb_hangame .gnb_top dd li {float:left; height:25px; background:url('+cssUrl+'/renewal_2011/common/gnb_s_b/gnb_top_txt.gif) 100% 0 no-repeat; list-style:none; white-space:nowrap; }' +
		'#gnb_hangame .gnb_top dd li a {overflow:hidden; display:block; height:25px; margin-right:1px; background:url('+cssUrl+'/renewal_2011/common/gnb_s_b/gnb_top_txt.gif) no-repeat; }' +
		'#gnb_hangame .gnb_top dd li span {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .gnb_top dd li.allgame a {width:60px; background-position:-201px 0;  }' +
		'#gnb_hangame .gnb_top dd li.allgame_selected a {width:60px; background-position:-301px 0;  }' +
		'#gnb_hangame .gnb_top dd li.gametak a {width:41px; background-position:-400px 0;  }' +
		'#gnb_hangame .gnb_top dd li.smartphone a {width:70px; background-position:-500px 0;  }' +
		'#gnb_hangame .gnb_top dd li.mobilegame a {width:59px;  background-position:-600px 0; }' +
		'#gnb_hangame .gnb_top dd li.last {background:none; }' +
		'#gnb_hangame .gnb_top dd li.center a {width:50px;  background-position:-700px 0; }' +
		'#gnb_hangame .gnb_top dd li.login_btn {padding:2px 0 0 7px; background:none; }' +
		'#gnb_hangame .gnb_top dd li.logout_btn {padding:2px 0 0 7px; background:none; }' +
		'#gnb_hangame .gnb_top dd li.login_btn a {width:47px; height:20px; background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/gnb_btn_login.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .gnb_top dd li.logout_btn a {width:58px; height:20px; background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/gnb_btn_logout.gif) 0 0 no-repeat; }' +
		'/*layer*/' +
		'#gnb_hangame .gnb_allgamelist {position:absolute; top:25px; left:50% ; width:956px; margin-left:-480px;  border:2px solid #3f3f3f; line-height:1.0em; background:#646464; z-index:100;}' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist {position:relative; float:left; width:136px; height:295px; border-right:1px solid #555;}' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dt {height:25px; margin-bottom:8px; border-bottom:1px solid #4b4a4a; background:#4e4e4e; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dt span {display:inline-block; width:100px; padding:5px 0; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dt span em {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game1 {width:271px; background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/li_y.gif) 134px 26px no-repeat #646464;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game1 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/gnb_ly_tit.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game2 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/gnb_ly_tit.gif) -100px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game3 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/gnb_ly_tit.gif) -200px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game4 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/gnb_ly_tit.gif) -300px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game5 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/gnb_ly_tit.gif) -400px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game6 {border-right:0; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game6 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/gnb_ly_tit.gif) -500px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 {clear:both; position:absolute; right:0; top:165px; width:273px; height:129px; border-right:0;  background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/li_y.gif) 136px 100% no-repeat #646464;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dt { border-top:1px solid #464545;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dt span {background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/gnb_ly_tit.gif) -600px 0 no-repeat; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dd {clear:both; color:#d2d2d2; }' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dd  a {display:block; padding:4px 5px 5px 13px; line-height:1.0em !important;}' +
		'#gnb_hangame .gnb_allgamelist .gnb_glist dd .no_link {display:block; padding:4px 5px 5px 13px;  color:#c5c5c5; line-height:1.0em !important;}' +
		'.gnb_allgamelist dd a{color:#d2d2d2 !important; text-decoration:none; font-family:Dotum, µ¸¿ò; }' +
		'.gnb_allgamelist dd a:hover {color:#f66e1c; text-decoration:underline;}' +
		'.gnb_allgamelist dd a:visited {color:#b7aecd !important;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game1 dd {clear:none; float:left; width:135px;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dd {clear:none; float:left; width:136px;}' +
		'#gnb_hangame .gnb_allgamelist .ly_game7 dd.etc_padd a {padding-left:15px; }' +
		'#gnb_hangame .btn_close_ly {display:block; position:absolute; top:-2px; right:-22px; width:20px; height:21px; background:url('+cssUrl+'/renewal_2010/common/gnb_s_b/gnb_btn_close.gif) 0 0 no-repeat; }' +
		'#gnb_hangame .btn_close_ly span {display:inline-block; text-indent:-99999px;}' +
		'#gnb_hangame .game_p {color:#f66e1c !important;  font-weight:bold; }' +
		'#gnb_hangame .gnb_allgamelist .loading_gnb {display:block; width:20px; height:20px; margin:0 0 0 468px;  padding:127px 0; }' +
		'#gnb_hangame .gnb_allgamelist .loading_gnb img {width:20px !important; height:20px !important; }' +
		'#gnb_hangame .gnb_allgamelist_backframe {position:absolute; top:25px; left:50%; margin-left:-480px; display:none; filter: alpha(opacity:1); opacity:1; zoom:1; background-color:#fff;   z-index:50}' +
		'</style>';
	
	
	if(type == 'basic'){
		this.gnbWrite(sBasic);
	} else {
		if(typeof color != 'undefined' && color == 'black'){
			this.gnbWrite(sBlack);
		} else {
			this.gnbWrite(sWhite);
		}
	}
	
}

gnb.addPrefix = function(url){
	if(typeof url == 'undefined' || !url ){
		return '';
	}
	
	var urlWithPrefix = '';
	
	if(url.indexOf('hangame.com') > -1){
		if(url.indexOf('http://') > -1){
			var arr = url.split('http://');
			urlWithPrefix = 'http://' + __urlPrefix + arr[1];
		} else if (url.indexOf('https://') > -1){
			var arr = url.split('https://');
			urlWithPrefix = 'https://' + __urlPrefix + arr[1];
		} else {
			urlWithPrefix = 'http://' + __urlPrefix + url;
		}
		
	} else {
		urlWithPrefix = url;
	}
	
	return urlWithPrefix;
}

gnb.loadGameData =  function(){
	// https ³»¿¡¼­ http¿ë ÆäÀÌÁö°¡ redirect µÇ´Â °æ¿ì Ã³¸®
	var prefUrl = location.href.split('/')[0];
	
	if(typeof prefUrl != 'undefined' && prefUrl != null && prefUrl.length > 0){
		if( prefUrl.indexOf('https:') > -1) {
			gnb.bSecureGnbFlag = true;
		}
	}
	
	var prefix = (__bDevZone || __bAlphaZone) ? "alpha-" : "";
	var filePrefix = (__bDevZone) ? "dev_" : ((__bAlphaZone) ? "alpha_" : (((location.href.indexOf("http://beta-")==0) || (location.href.indexOf("https://beta-")==0)) ? "beta_" : ""));
	var gameListUrl = 'http://'+prefix+'images.hangame.co.kr/hangame/gnb/' + filePrefix + 'gnb_gamelist.js';
	
	if(gnb.bSecureGnbFlag == true){
		gameListUrl = '/gnb/gnbapi.nhn?m=gameListForGNB';
	}
	
	var s = '<script type="text/javascript" charset="euc-kr" src="'+gameListUrl+'" ></script>';
	document.write(s);
}

gnb.loadRecentGameData = function(){
	var recentGameList = 'http://'+__urlPrefix+'www.hangame.com/lazyLoading.nhn?m=recentGameListForGNB';
	if(gnb.bSecureGnbFlag == true){
		recentGameList = '/gnb/gnbapi.nhn?m=recentGameListForGNB';
	}
	
	var elem = document.createElement('script');		
	elem.charset = "euc-kr";
	elem.type = 'text/javascript';
	elem.src = recentGameList; 
	
	document.documentElement.appendChild(elem);
	
	logger.log('recent game:loaded from server');
	
	gnb.bIsRecentCalled = true;
}

/**
 * ÀüÃ¼°ÔÀÓ¸®½ºÆ®: ³»°¡ÇÑ°ÔÀÓ lazy ·ÎµùÇÑ´Ù. try °¹¼ö°¡ 20¹ø ÀÌ»óÀÌ¸é Æ÷±â
 */
gnb.loadLayer = function() {
	if(typeof gnb.maingamelist == 'undefined' || !gnb.maingamelist){
		logger.log('gnb.maingamelist is undefined');
		return;
	}
	
	if(__bLogin){
		if(typeof gnb.recentgamelist == 'undefined' || !gnb.recentgamelist){
			gnb.loadRecentGameData();
			
			gnb.tryCnt++;
			logger.log("recent game load try cnt:"+ gnb.tryCnt);
			
			if(gnb.tryCnt < 20){
				setTimeout(gnb.loadLayer, 100);
				return;
			}
		}
	}
	
	logger.log("gamelist:"+ gnb.maingamelist.list);
	
	var maingamelist = gnb.maingamelist.list;
	var recentgamelist = null;
	
	if(__bLogin && typeof gnb.recentgamelist != 'undefined' && gnb.recentgamelist != null){
		logger.log("recentgamelist:"+ gnb.recentgamelist);
		recentgamelist = gnb.recentgamelist.list;
	}
	
	var userAge	= getCookie(CK_AGE);
	var s = '';
	var groups = ['rpg', 'action', 'sports', 'puzzle', 'gostop', 'poker', 'board'];
	
	for(var i = 0; i < groups.length; i++){
		var groupArr = maingamelist[groups[i]]; 
		var sub = '';
		for(var j = 0; j< groupArr.length; j++){
			var game = groupArr[j];
			var isRecentGame = false;
			if(__bLogin && recentgamelist){
				if(recentgamelist.length > 0){
					for(var k = 0; k < recentgamelist.length; k++ ){
						if(game.rccode == recentgamelist[k].rccode) {
							isRecentGame = true;
							break;
						}
					}
				}
			}
			
			var url = gnb.addPrefix(game.url);
			var recentClass = '';
			var ageClass = '';
			var etcPadd = '';
			
			if(isRecentGame) {
				recentClass = 'class="game_p"';
			}
			
			if(i == 6 && j%2 == 1){
				etcPadd = ' class="etc_padd"';
			}
			
			if(userAge=='' || userAge >= parseInt(game.age)){
				sub += '<dd'+etcPadd+'><a href="'+url+'" '+recentClass+' title="'+game.desc+'" onfocus="this.blur()"  target="_top">'+game.name+'</a></dd>';
			} else {
				sub += '<dd'+etcPadd+'><span class="no_link">'+game.name+'</span></dd>';
			}
		}
		
		s += '<dl class="gnb_glist ly_game'+(i+1)+'"><dt><span><em>'+groupArr[0].categname+'</em></span></dt>'+sub+'</dl>';
	}
	
	s += '<a href="#" class="btn_close_ly" onclick="gnb.layerManager.closeLayer();"><span>´Ý±â</span></a>';
	
	var elAllGameList = document.getElementById('gnb_allgamelist');
	
	elAllGameList.innerHTML = s;
	
	gnb.bIsLoaded = true;
	
	logger.log("bIsLoaded:"+ gnb.bIsLoaded);
}

/**
 * GNB Layer °ü¸® °´Ã¼
 */
gnb.layerManager = (function(){
	var obj = {};
	var _showDelay = 100; // ³ëÃâ delay
	var _closeDelay = 400; // °¨Ãã delay
	var _closeTimer = null;
	var _showTimer = null;
	var _layerEl = null; // layer DOM °´Ã¼
	var _layerFrameEl = null;
	var _btnEl = null; // ÀüÃ¼°ÔÀÓ ¹öÆ°
	
	var _showLayer = function(){
		logger.log('showed');
		
		if(_layerEl == null){
			_layerEl = document.getElementById( 'gnb_allgamelist' );
		}
		
		if(_layerFrameEl == null){
			_layerFrameEl = document.getElementById( 'gnb_allgamelist_backframe' );
		}
		
		if(_layerFrameEl) {
			_layerFrameEl.style.display = 'block';
		}
		
		_layerEl.style.visibility = 'visible';
	}
	
	var _closeLayer = function(){
		if(_layerEl == null){
			_layerEl = document.getElementById( 'gnb_allgamelist' );
		}
		
		if(_layerFrameEl == null){
			_layerFrameEl = document.getElementById( 'gnb_allgamelist_backframe' );
		}
		
		if(_layerFrameEl) {
			_layerFrameEl.style.display = 'none';
		}
		
		_highlightAllGame(false);
		_layerEl.style.visibility = 'hidden';
	}
	
	var _highlightAllGame =  function(bFlag){
		if(_btnEl == null) {
			_btnEl = document.getElementById( 'gnb_allgame_li' );
		}
		
		if(bFlag){
			_btnEl.className = 'allgame_selected';
		} else {
			_btnEl.className = 'allgame';
		}
	}
	
	// Áï½Ã ´Ý±â
	obj.closeLayer = function(){
		if(_closeTimer)
		{
			clearTimeout(_closeTimer);
			_closeTimer = null;
		}
		
		if(_showTimer)
		{
			clearTimeout(_showTimer);
			_showTimer = null;
		}
		
		_closeLayer();
	}
	
	//Ã¹ Å¬¸¯½Ã GNB lazy ·Îµù
	obj.clickLayerBtn = function(){
		if(_layerEl == null){
			_layerEl = document.getElementById( 'gnb_allgamelist' );
		}
		
		//·¹ÀÌ¾î ³ëÃâ µÇ¾î ÀÖÀ» °æ¿ì ´Ý±â
		if(_layerEl.style.visibility != 'hidden'){
			_highlightAllGame(false);
			this.closeLayer();
			return;
		}
		
		_highlightAllGame(true);
		
		// GNB µ¥ÀÌÅÍ ·Îµù (ÃÊ±â ÇÑ¹ø¸¸)
		if(!gnb.bIsLoaded) {
			gnb.loadLayer();
		}
		
		this.showLayer();
	}
	
	obj.overLayerBtn = function(){
		if(_layerEl == null){
			_layerEl = document.getElementById( 'gnb_allgamelist' );
		}
		
		if(gnb.bIsLoaded && _layerEl.style.visibility != 'hidden'){
			_highlightAllGame(true);
			
			this.showLayer();
		}
	}
	
	//³ëÃâ ¿¹¾à(delay)
	obj.showLayer = function(){
		this.cancelCloseTimer();
		
		_showTimer = setTimeout(_showLayer, _showDelay);
	} 
	
	// ´Ý±â ¿¹¾à (delay)
	obj.setCloseTimer = function(){
		if(_showTimer)
		{
			clearTimeout(_showTimer);
			_showTimer = null;
		}
		
		_closeTimer = setTimeout(_closeLayer, _closeDelay);
	}
	
	// ´Ý±â ¿¹¾à(delay) ÃÖ¼Ò
	obj.cancelCloseTimer = function(){
		if(_closeTimer)
		{
			clearTimeout(_closeTimer);
			_closeTimer = null;
		}	
	}
	
	return obj;
	
}());

gnb.setHeader = function() {
	__gnbLoaded = true;
	
	var last = '';
	var loginURL = '';
	var loginStr = '';
	var csStr = '<li class="center last"><a href="http://'+__urlPrefix+'cs.hangame.com" onclick=\'setNdsClickTag("/i:1000002021/c:55372?http://game.hangame.com/gnb_cs");\' target="_top" title="°í°´¼¾ÅÍ" onfocus="this.blur()"><span>°í°´¼¾ÅÍ</span></a></li>';
	var leftStr = '';
	var prefix = (__bDevZone || __bAlphaZone) ? "alpha-" : "";
	var imgPrefix = 'http://'+prefix+'images.hangame.co.kr/hangame';
	
	if(this.bSecureGnbFlag == true){
		var imgPrefix = "https://" + prefix + "imgsec.hangame.com/images";
	}
	
	if(gnb.config.login){
		if(__bLogin){
			var escapeNxtURL = escape(document.URL);
			var encNxtURL = escapeNxtURL.replace(/\%u/g,"\\u");
			loginURL = __urlIDS + "logout.nhn?docref=" + encNxtURL;
			// loginURL = __urlIDS + "logout.nhn?docref=" + escape(document.URL);
			loginStr = '<li class="logout_btn"><a href="'+loginURL+'" onclick=\'setNdsClickTag("/i:1000002022/c:24699?http://game.hangame.com/gnb_logout");\' target="_top" title="·Î±×¾Æ¿ô" onfocus="this.blur()"><span>·Î±×¾Æ¿ô</span></a></li>';
		} else {
			var escapeNxtURL = escape(location.href);
			var encNxtURL = escapeNxtURL.replace(/\%u/g,"\\u");
			loginURL = __urlIDS + "wlogin.nhn?popup=false&adult=false&nxtURL=" + encNxtURL;
			// loginURL = __urlIDS + "wlogin.nhn?popup=false&adult=false&nxtURL=" + escape(location.href);
			loginStr = '<li class="login_btn"><a href="'+loginURL+'" onclick=\'setNdsClickTag("/i:1000002621/c:25896?http://game.hangame.com/gnb_login");\' target="_top" title="·Î±×ÀÎ" onfocus="this.blur()"><span>·Î±×ÀÎ</span></a></li>';
		}
	}
	
	if(gnb.config.align == 'left'){
		leftStr = ' left_a';
	}
	
	if(!gnb.config.customer){
		csStr = '';
		last = ' last';
	}
	
	var sBackFrame = '<iframe name="gnb_allgamelist_backframe" id="gnb_allgamelist_backframe" class="gnb_allgamelist_backframe" src="" width="958" height="295" frameborder="0" scrolling="no" ></iframe>';
	
	var s = '' +	
		'<div id="gnb_hangame">' +
			'<div class="gnb_areabox'+leftStr+'">' +
				'<!-- top -->' +
				'<dl class="gnb_top">' +
				'<dt><a href="'+__urlWWW+'?s=logo" onclick=\'setNdsClickTag("/i:1000002011/c:59408?http://game.hangame.com/gnb_bi");\'  target="_top" onfocus="this.blur()"><span>HANGAME</span></a></dt>' +
				'<dd>' +
					'<ul>' +
					'<li class="allgame" id="gnb_allgame_li" ><a href="#" onclick="gnb.layerManager.clickLayerBtn(); return false;" onmouseover="gnb.layerManager.overLayerBtn();" onmouseout="gnb.layerManager.setCloseTimer();" id="gnb_allgame" onfocus="this.blur()" title="ÀüÃ¼°ÔÀÓ"><span>ÀüÃ¼°ÔÀÓ</span></a></li>' +
					'<li class="smartphone"><a href="http://'+__urlPrefix+'smart.hangame.com/" onfocus="this.blur()" title="½º¸¶Æ®Æù°ÔÀÓ"><span>½º¸¶Æ®Æù°ÔÀÓ</span></a></li>' +
					'<li class="gametak'+last+'"><a href="http://'+__urlPrefix+'gametalk.hangame.com" onclick=\'setNdsClickTag("/i:1000017390/c:25498?http://gametalk.hangame.com/");\' target="_top" title="°ÔÀÓÅå" onfocus="this.blur()"><span>°ÔÀÓÅå</span></a></li>' +
					// '<li class="idogame"><a href="http://'+__urlPrefix+'idogame.hangame.com" onclick=\'setNdsClickTag("/i:1000017264/c:63973?http://idogame.hangame.com/")\'; target="_blank" title="¾ÆÀÌµÎ°ÔÀÓ" onfocus="this.blur()"><span>¾ÆÀÌµÎ°ÔÀÓ</span></a></li>' +
					// '<li class="mobilegame'+last+'"><a href="http://'+__urlPrefix+'mobilepack.hangame.com" title="¸ð¹ÙÀÏ°ÔÀÓ" target="_top" onfocus="this.blur()" ><span>¸ð¹ÙÀÏ°ÔÀÓ</span></a></li>' +
					csStr +
					loginStr +		
					'</ul>' +
				'</dd>' +
				'</dl>' +
				'<!-- //top -->' +
				'<div id="gnb_allgamelist" class="gnb_allgamelist" style="visibility:hidden;" onmouseover="gnb.layerManager.cancelCloseTimer();" onmouseout="gnb.layerManager.setCloseTimer();" ><span class="loading_gnb"><img src="'+imgPrefix+'/renewal_2010/common/'+gnb.loadImgPosfix+'gnb_loading.gif" width="20" height="20" alt="loading.."></span><a href="#" class="btn_close_ly" onclick="gnb.layerManager.closeLayer();"><span>´Ý±â</span></a></div>' +
				sBackFrame +
			'</div>' +
		'</div>';
	
	if(!this.bSecureGnbFlag){
		if (typeof(__ndsFrame)=="undefined") {
			s += "<img id='__ndsIframe' width=0 height=0 frameborder=0 style='display:none'>\n";
			__ndsFrame = "set";
		}
	}
	
	this.gnbWrite(s, true);
	
	if(!this.bSecureGnbFlag){
		//setTimeout("__ndsLoadIHeader()",500);
		loadSmartPopup();
		callLcsDo();
	}
	
	callGBIE6();
}

function callLcsUndefined() {
	//console.log('### not undefined lcs_do');
	//return;
}

function callLcsDo() {
	if ( __ndsChange == "set" ) return;
	
		if (typeof(__setLcsScriptFlag) == "undefined") {
		__fromGnb = "true";
		setLcsScript();
		//setTimeout("callLcsDo()", 500); 
		callLcsDo(); 
	} else {
		var lcsDoStr = "";
		lcsDoStr += "<script type=\"text/javascript\">if(typeof(lcs_do) == \"undefined\"){callLcsUndefined();}else{lcs_do();}</script>";
		document.write(lcsDoStr);
		__ndsChange = "set";
	}
}

function callGBIE6() {
	if (__setGBIE6Flag == "set") {
		var gbie6Str = "";
		gbie6Str += "<script type=\"text/javascript\">if(typeof(GBIE6) == \"undefined\"){callLcsUndefined();}else{" 
		+ "if (GBIE6.getBrowser() == \"ie6\") {" 
		+ "if (GBIE6.getCookie(\"GBIE6\") != \"done\") {"
		+ "GBIE6.addOnLoadEvent(function() {"
		+ "GBIE6.appendBannerHTML();"
		+ "GBIE6.slideDown(\"ie6banner\", 10000);"
		+ "GBIE6.setCookie(\"GBIE6\", \"done\", undefined, \"hangame.com\");"
		+ "});"
		+ "}"
		+ "}"
		+ "}</script>";
		
		document.write(gbie6Str);
	}
}

gnb.gnbWrite = function(sContent, iframeFlag) {
	if(this.bSecureGnbFlag == true){
		var prefix = (__bDevZone || __bAlphaZone) ? "alpha-" : "";		
		var sslUrl = "https://" + prefix + "imgsec.hangame.com/images/";

		sContent = sContent.replace(/http:\/\/(alpha\-|)images.hangame.(co.kr|com)\/hangame\//gi, sslUrl);
		if(typeof iframeFlag == 'undefined' || iframeFlag == false) {
			sContent = sContent.split("<iframe").join("<!--iframe");
			sContent = sContent.split("</iframe>").join("</iframe-->");
		}
		
		sContent = sContent.split("setNdsClickTag").join("gnb.eatTags");
	}
	
	document.write(sContent);
}

//httpsÀÏ °æ¿ì setNdsClickTag µîÀ» ¸Ô¾î¹ö¸®±â À§ÇÔ.
gnb.eatTags = function() {
	
}

//__newHeaderNum							0		 1		     2		    3		   4		    5			      6			         7		        8			    9			     10		  11			      12		   13		   14			  15			      16			  17				  18			     19		    20		   21			      22			    23		  24			   25			    26
//var __newHeader		= new Array("test","game","flash","guild","avatar","gameshop","homepage","chatting","mileage","customer","notice","t_hangame","myinfo","event","story"	,"r_hangame","bonus"	,"happybean"	,"flashworld","member","shop","gamepack","eventpark","plus","flash_big", "register", "register2");

/**
* gnb setter interface ÇÔ¼ö
* @param key
* @param blank
* @param widthtype
*/
var __secureGnbFlag = false;	// https flag

function setTopMenu(key, blank, widthtype){
	var tmpCurUrl = location.href;
	if (typeof(tmpCurUrl) != 'undefined' && tmpCurUrl != null && tmpCurUrl.indexOf("https") > -1) {	
		__secureGnbFlag = true;
	}
	
	if(typeof(key) != 'undefined' && typeof(key) == 'object'){
		for(var aa in key){
			gnb.config[aa] = key[aa];
		}
	}
	
	var currentUrl = location.href;
	
	if (arguments.length >= 1){
		if(arguments[0] == "noLogin"){
			// °í°´¼¾ÅÍ ¾ø°í, ·Î±×ÀÎ ¾ø´Â ¹öÀü
			gnb.config.login = false;
			gnb.config.customer = false;
		}
	} else if(currentUrl.indexOf("pcbang.hangame.com")>-1 ){
		gnb.config.login = false;
		gnb.config.customer = false;
	} else if(currentUrl.indexOf("r2.hangame.com")>-1 || currentUrl.indexOf("pristontale.hangame.com")>-1 ){
		gnb.config.align = "left";
	}
	
	gnb.loadGameData();
	
	gnb.setHeaderCSS('basic');
	gnb.setHeader();
}

function setGameMenu(){
	gnb.loadGameData();
	
	gnb.setHeaderCSS('basic');
	gnb.setHeader();
}

function setGameHeader(){
	gnb.loadGameData();
	
	gnb.setHeaderCSS('basic');
	gnb.setHeader();
}

function setSimpleGNB(color, config){
	if(typeof(config) != 'undefined' && typeof(config) == 'object'){
		for(var aa in config){
			gnb.config[aa] = config[aa];
		}
	}
	
	gnb.loadGameData();
	
	gnb.setHeaderCSS('simple', color);
	gnb.setHeader();
}
