﻿jQuery.noConflict();

//사이트 코드 정의
var GNB_siteCode = 0;
var GNB_site = "";

var GNB_surl = unescape(escape(location.href)).replace(/#/gi,'');
var GNB_gotoUrl = escape(location.href);


//새로운 사이트 구축시 추가되어야 하는부분 - 1.siteCode 추가
function GNB_linkURL(){
	switch(jQuery("div[id^='JC_GNB_']").attr('id').split('_')[2]){
		case("JCE"): 	 GNB_siteCode = 20;		break;
		case("FS") :     GNB_siteCode = 30; 	break;
		case("FSF"):     GNB_siteCode = 31; 	break;
		case("FSM"):     GNB_siteCode = 32; 	break;
		case("AN") :     GNB_siteCode = 40;		break;
		case("GX") :     GNB_siteCode = 50;		break;
		case("HIS"):     GNB_siteCode = 90; 	break;
		case("VS"):      GNB_siteCode = 92; 	break;
		default : 		 GNB_siteCode = 0;		break;
	}
	return GNB_siteCode;
}
function GoUrl_site(val){
	if(val != ''){
		window.open(val, "_new");
	}
}
//링크 url정의
//새로운 사이트 구축시 추가되어야 하는부분 - 2.siteURL 생성
var siteURL_MEMBER  = 'https://member.joycity.com';  //실서버 업데이트시 반드시 https로 변경!!!!(여기한군데만 변경하면 됩니다.)
var siteURL_JCE 	= 'http://www.joycity.com';
var siteURL_FS		= 'http://fs.joycity.com';
var siteURL_GX		= 'http://gx.joycity.com';
var siteURL_AN		= 'http://an.joycity.com';
var siteURL_HIS		= 'http://his.joycity.com';
var siteURL_FSF		= 'http://fsf.joycity.com';
var siteURL_FSM		= 'http://fsm.joycity.com';
var siteURL_VS  	= 'http://vs.joycity.com';


//var siteURL_SECURE    = siteURL_MEMBER + '/security/regist_motp.do';
var siteURL_USERINFO  = siteURL_MEMBER + '/myinfo/individual.do?siteCode=';
var siteURL_ADDMEMBER = siteURL_MEMBER +'/join/main.do?siteCode=';
var siteURL_CASH 	  = 'https://payment.joycity.com/myaccount/cash_list.asp?siteCode=';

var siteURL_HELP	  	  = 'https://help.joycity.com';
var siteURL_HELP_NOMEMBER = siteURL_HELP + '/mail/exMailQuestion.jsp';
var siteURL_pcRoom  	  = 'http://pcbang.joycity.com';

//(https를 쓰는 회원가입,캐쉬충전 부분은 이미지 주소다름)
var siteURL_IMG 	= 'http://imgdg.joycity.com/th/gnb';



jQuery(function(){
	
	//패밀리 사이트(각 사이트 풋터 셀렉트 박스) 
	var myOptions= ([{value : ''						 	,text :'패밀리 사이트 가기'},
	                  {value : 'http://www.jceworld.com'	,text :'JC Entertainment'},
	                  {value : 'http://www.joycity.com'		,text :'JoyCity'},
	                  {value : 'http://fs.joycity.com'		,text :'Freestyle'},
	                  {value : 'http://fsf.joycity.com'		,text :'Freestyle Football'},
	                  {value : 'http://fsm.joycity.com'		,text :'Freestyle Manager'},
	                  {value : 'http://an.joycity.com'		,text :'Aeronauts'},
	                  {value : 'http://gx.joycity.com'		,text :'Ghost X'},
	                  {value : 'http://his.joycity.com'		,text :'HIS'},
	                  {value : 'http://vs.joycity.com'		,text :'ValkyrieSky'},
	                  {value : 'http://www.gamejoycity.com'	,text :'GameJoyCity'},
	                  {value : 'http://pcbang.joycity.com'	,text :'조이시티 프리미엄 PC방'}]);

	 jQuery.each(myOptions, function(i) {
		 jQuery('select[class^=family]').css('width','155px');
		 jQuery('select[class^=family]').append( 
			jQuery('<option></option>').val(myOptions[i].value).html(myOptions[i].text)
		 );
	 });
	 

	// GNB DOM 생성
	if(jQuery('div[id^="JC_GNB_"]').length > 0){
	
	//GNB배너 호출(https를 쓰는 회원가입,캐쉬충전 부분은 호출X)
	jQuery.getJSON("http://bannersys.joycity.com/getBanner.jce?siteCode=29&secIdGroup=GNB&callback=?");
		
	GNB_siteCode = GNB_linkURL();
	GNB_site = jQuery("div[id^='JC_GNB_']").attr('id').split('_')[2];
	
	//로그인 , 로그아웃 시 변경되는 부분 (GNB 로그아웃,회원가입/로그인 버튼,개인정보 )
	var login_str = '';
	var login_info = '';
	if(GNB_getTHCookie("JS_THCookies") != ""){
		//로그인 상태
		login_info += '<div class="bgLeft">';
		login_info += '<a href="' + siteURL_USERINFO + GNB_siteCode + '" target="_balnk">개인정보</a>';
		login_info += '<a href="' + siteURL_HELP + '" target="_blank">고객센터</a>';
		login_info += '<a href="' + siteURL_CASH + GNB_siteCode + '" target="_balnk">캐쉬충전</a>';
		login_info += '</div>';
		
		login_str += '<div class="btnGNBLogout">';
		login_str += '<a href="#" onclick="GNB_Logout(); return false;">';
		login_str += '<img src="' + siteURL_IMG + '/btn_logout.gif" alt="로그아웃" title="로그아웃" />';
		login_str += '</a></div>';
		
	}else{
		//로그아웃상태
		login_info += '<div class="bgLeft">';
		login_info += '<a href="' + siteURL_ADDMEMBER + GNB_siteCode +'" target="_balnk">회원가입</a>';
		login_info += '<a href="' + siteURL_HELP + '" target="_blank"); return false;">고객센터</a>';
		login_info += '<a href="#" onclick="openLoginLayer(); return false;">캐쉬충전</a>';
		login_info += '</div>';
		
		login_str += '<div class="btnGNBLogin">';
		login_str += '<a href="#" onclick=" return false;"><img src="'+siteURL_IMG+'/btn_login.gif" alt="로그인" title="로그인" /></a>';
		login_str += '</div>';
	}
	
	
	//GNB DOM 정의
	var gnbdom = '';
	gnbdom += '<div class="jcGNBWrap">';
	gnbdom += '<div class="jcGNB">';
	gnbdom += '<div class="gnbLogo">';
	gnbdom += '<a href="'+siteURL_JCE+'"><img src="'+siteURL_IMG+'/img_logo.jpg" alt="세상에 없던 재미" title="조이시티" /></a>';
	gnbdom += '</div>';
	gnbdom += '<div class="lstGNBMenu">';
	gnbdom += '<a href="'+siteURL_JCE+'"><img src="'+siteURL_IMG+'/btn_joycitygame.jpg" alt="조이시티 게임" title="조이시티 게임" /></a>';
	gnbdom += '<a href="'+siteURL_pcRoom+'" target="_blank"><img src="'+siteURL_IMG+'/btn_pcbang.jpg" alt="프리미엄PC방" title="프리미엄PC방" /></a>';
	gnbdom += '</div>';
	gnbdom += '<div class="lstGNBGame">';
	gnbdom += '<div class="bgLeft">';
	//새로운 사이트 구축시 추가되어야 하는부분 - 3.GNB 이미지 추가 
	gnbdom += '<a href="'+siteURL_FS+'"><img src="'+siteURL_IMG+'/btn_gnbfs.jpg" alt="프리스타일" title="프리스타일" /></a>';
	gnbdom += '<a href="'+siteURL_GX+'"><img src="'+siteURL_IMG+'/btn_gnbgx.jpg" alt="고스트X" title="고스트X" /></a>';
	gnbdom += '<a href="'+siteURL_AN+'"><img src="'+siteURL_IMG+'/btn_gnban.jpg" alt="에어로너츠" title="에어로너츠" /></a>';
	gnbdom += '<a href="'+siteURL_HIS+'"><img src="'+siteURL_IMG+'/btn_gnbhis.jpg" alt="HIS" title="HIS" /></a>';
	gnbdom += '<a href="'+siteURL_FSF+'"><img src="'+siteURL_IMG+'/btn_gnbfsf.jpg" alt="프리스타일 풋볼" title="프리스타일 풋볼" /></a>';
	gnbdom += '<a href="'+siteURL_FSM+'"><img src="'+siteURL_IMG+'/btn_gnbfsm.jpg" alt="프리스타일 매니저" title="프리스타일 매니저" /></a>';
	gnbdom += '<a href="'+siteURL_VS+'"><img src="'+siteURL_IMG+'/btn_gnbvs.jpg" alt="발키리스카이" title="발키리스카이" /></a>';
	gnbdom += '</div>';
	gnbdom += '<div class="bgRight"></div>';
	gnbdom += '</div>';
	gnbdom += '<div class="gnbBannerArea">';
	gnbdom += '<div class="gnbBanner">';
	//https를 쓰는 회원가입,캐쉬충전 버젼은 GNB 배너 없음
	gnbdom += '<div id="JC_TH_GNB"></div>';	
	//gnbdom += '<a href="#" onclick="GoUrl_site(\'' + siteURL_Gnb_BANNER + '\'); return false;"><img src="'+siteURL_IMG+'/banner/his_gnb.gif" alt="HIS 3차 CBT" title="HIS 3차 CBT" /></a>';
	gnbdom += '</div>';
	gnbdom += '<div class="lstGNBBtns">';
	gnbdom += login_info; 
	gnbdom += '<div class="bgRight"></div>';
	gnbdom += '</div>';
	gnbdom += '</div>';
	gnbdom += login_str;
	gnbdom += '</div>';
	gnbdom += '</div>';

	jQuery('div[id^="JC_GNB_"]').append(gnbdom);
	
	// CSS 적용
	jQuery('.jcGNBWrap img').css('border', '0');
	jQuery('.jcGNBWrap').css({'position':'relative', 'width':'100%', 'height':'38px', 'background':'url('+siteURL_IMG+'/bg_gnb.gif) repeat-x'});
	jQuery('.jcGNB').css({'position':'relative', 'width':'990px', 'margin':'0 auto'});
	jQuery('.gnbLogo').css({'position':'absolute', 'left':'16px', 'top':'6px'	});
	jQuery('.lstGNBMenu').css({'position':'absolute', 'left':'167px', 'top':'11px'});
	jQuery('.lstGNBMenu a').css({'display':'block', 'float':'left', 'padding':'0 5px', 'background':'url('+siteURL_IMG+'/bg_gnbmenubar.gif) no-repeat 0 4px'});
	jQuery('.lstGNBMenu a:first-child').css({'padding-left':'0', 'background':'none'});
	jQuery('.lstGNBGame').css({'display':'none', 'position':'absolute', 'left':'11px', 'top':'28px', 'height':'89px', 'padding-left':'3px', 'padding-top':'10px', 'background':'url('+siteURL_IMG+'/boxl_gamelist.gif) no-repeat 0 10px'});
	jQuery('.lstGNBGame .bgLeft').css({'float':'left', 'height':'89px', 'background':'url('+siteURL_IMG+'/boxm_gamelist.gif) repeat-x'});
	jQuery('.lstGNBGame .bgRight').css({'float':'left', 'width':'3px', 'height':'89px', 'background':'url('+siteURL_IMG+'/boxr_gamelist.gif) no-repeat'});
	jQuery('.lstGNBGame a').css({'display':'block', 'float':'left', 'padding-left':'3px', 'padding-top':'1px', 'background':'url('+siteURL_IMG+'/bg_gamelistbar.gif) no-repeat'});
	jQuery('.lstGNBGame a:first-child').css({'padding-left':'0', 'background':'none'});
	jQuery('.gnbBannerArea').css({'position':'absolute', 'right':'62px', 'top':'0px'});
	jQuery('.gnbBanner').css({'float':'left', 'padding-right':'5px'});
	jQuery('.lstGNBBtns').css({'float':'left','height':'20px','margin-top':'9px','padding-left':'3px','background':'url('+siteURL_IMG+'/boxl_gnbbtns.gif) no-repeat'});
	jQuery('.lstGNBBtns .bgLeft').css({'float':'left','height':'20px','background':'url('+siteURL_IMG+'/boxm_gnbbtns.gif) repeat-x'});
	jQuery('.lstGNBBtns .bgRight').css({'float':'left','width':'2px','height':'20px','background':'url('+siteURL_IMG+'/boxr_gnbbtns.gif) no-repeat'});
	jQuery('.lstGNBBtns a').css({'display':'block','float':'left','padding':'5px 8px 0','font':'11px 돋움','color':'#868686','text-decoration':'none','background':'url('+siteURL_IMG+'/bg_gnbbtnbar.gif) no-repeat 0 6px'});
	jQuery('.lstGNBBtns a:first-child').css('background', 'none');
	jQuery('.btnGNBLogin').css({'position':'absolute','left':'932px','top':'10px'});
	jQuery('.btnGNBLogout').css({'position':'absolute','left':'932px','top':'10px'});
	
	jQuery('div[id^="JC_GNB_"]').parents().each(function(){
		if(this.tagName != 'BODY' && this.tagName != 'HTML') {
			if (jQuery(this).css('position') == 'absolute')
				jQuery(this).css({'z-index':'999'});
			else
				jQuery(this).css({'position':'relative','z-index':'999'});
		}
	});
	
	// 이벤트 처리
	jQuery('.lstGNBBtns a').mouseover(function(){
		jQuery(this).css('color', '#000');
	});	
	jQuery('.lstGNBBtns a').mouseout(function(){
		jQuery(this).css('color', '#868686');
	});
	jQuery('.lstGNBMenu a:first-child').mouseover(function(){
		jQuery('.lstGNBGame').show();
	});
	jQuery('.lstGNBMenu a:first-child').mouseout(function(){
		jQuery('.lstGNBGame').hide();
	});
	jQuery('.lstGNBGame').mouseout(function(){
		jQuery(this).hide();
	})
	jQuery('.lstGNBGame').mouseover(function(){
		jQuery(this).show();
	})
	jQuery('.btnGNBLogin a').click(openLoginLayer);
	
	}
	
});


/* Joycity 통합 레이어 로그인 */

var openLoginLayer = function(option) {

	// 브라우저 영역 지정
	jQuery('html').css({'height': '100%', 'width':'100%'});
	jQuery('body').css({'height': '100%', 'width':'100%'});
	
	// 반투명 커버 생성
	jQuery('body').append('<iframe id="FAKEWRAP"></iframe>');
	
	jQuery('body').append('<div id="LOGINWRAP"></div>');
	jQuery('body').append('<div id="LOGINWRAP2"></div>');
	
	jQuery('#FAKEWRAP').css({
		'position':'absolute',
		'left':'0',
		'top':'0',
		'width':'100%',
		'height':'100%',
		'z-index':'999',
		'display':'none'
	});
	jQuery('#LOGINWRAP').css({
		'position':'absolute',
		'left':'0',
		'top':'0',
		'width':'100%',
		'height':'100%',
		'background-color':'#000',
		'display':'none',
		'z-index':'999'
	});
	jQuery('#LOGINWRAP2').css({
		'position':'absolute',
		'left':'0',
		'top':'0',
		'width':'100%',
		'height':'100%',
		'z-index':'999'
	});

	GNB_setPosition('FAKEWRAP');
	GNB_setPosition('LOGINWRAP');
	GNB_setPosition('LOGINWRAP2');

	// 커버 이펙트 실행후 로그인 레이어 생성
	jQuery('#FAKEWRAP').fadeTo(0,0);
	jQuery('#FAKEWRAP').show(100);
	jQuery('#LOGINWRAP').fadeTo(0, 0.5);
	jQuery('#LOGINWRAP').show(100, function(){
		GNB_createLoginLayer(option);
	});

	jQuery(window).scroll(function(){
		GNB_setPosition('FAKEWRAP');
		GNB_setPosition('LOGINWRAP');
		GNB_setPosition('LOGINWRAP2');
	})
};


//레이어 위치 유지
var GNB_setPosition = function (target) {
	var obj = document.getElementById(target);
	
	if (typeof(window.pageYOffset) == "number") {
		obj.getTop = function() {
			return window.pageYOffset;
		}
	} else if (typeof(document.documentElement.scrollTop) == "number") {
		if (document.firstChild.tagName == '!') { 			// Doctype이 있는 경우
			obj.getTop = function() {
				return document.documentElement.scrollTop;
			}
		} else {										   // Doctype이 없는 경우
			obj.getTop = function() {
				return document.body.scrollTop;
			}
		}
	} else {
		obj.getTop = function() {
			return 0;
		}
	}
	
	if (typeof(window.pageXOffset) == "number") {
		obj.getLeft = function() {
			return window.pageXOffset;
		}
	} else if (typeof(document.documentElement.scrollLeft) == "number") {
		if (document.firstChild.tagName == '!') {
			obj.getLeft = function() {
				return document.documentElement.scrollLeft;
			}
		} else {
			obj.getLeft = function() {
				return document.body.scrollLeft;
			}
		}
	} else {
		obj.getLeft = function() {
			return 0;
		}
	}
	
	obj.style.top = obj.getTop() + 'px';
	obj.style.left = obj.getLeft() + 'px';


};

// 로그인 레이어 생성
var GNB_createLoginLayer = function(option){
	var STR_LL_chkSaveid = "";
	if((escape(GNB_getTHCookie("JCE%5FcookieId")) != "") || (escape(GNB_getTHCookie("JCE_cookieId")) != "")){
		STR_LL_chkSaveid = "checked";
	}

	jQuery('#LOGINWRAP2').append('<div id="LOGINLAYER"></div>');
	jQuery('#LOGINLAYER').css({'position':'absolute', 'left':'50%', 'top':'50%', 'width':'524px', 'height':'300px', 'margin':'-150px 0 0 -262px', 'z-index':'999'});
	
	var loginLayerDOM = '';
	var displayContent = '';
	
	var loginType = option;

	switch(loginType) {
		default: // 로그인 입력 레이어
			loginLayerDOM += '<div class="LL_loginWrap">';
			loginLayerDOM += '<div class="LL_titLogin"><img src="'+siteURL_IMG+'/tit_loginlayer.gif" alt="Joycity Member Login" title="" /></div>	';
			loginLayerDOM += '<form name="gnbLoginForm" action="'+siteURL_MEMBER+'/login/login_ok.do" method="post" onsubmit="return GNB_formCheck(this);">';
			loginLayerDOM += '<fieldset>';
			loginLayerDOM += '<legend>로그인</legend>';
			loginLayerDOM += '<input type="hidden" name="surl" value="'+GNB_surl+'" />'
			loginLayerDOM += '<input type="hidden" name="rememberid" id="rememberid" value="" />' 
			loginLayerDOM += '<input type="hidden" name="gotourl" value="' + GNB_gotoUrl + '" />'
			loginLayerDOM += '<input type="hidden" name="loginfrom" value="direct_motp" />'
			loginLayerDOM += '<input type="hidden" name="frameurl" value="" />'
			loginLayerDOM += '<input type="hidden" name="rd" value="http://www.joycity.com" />'
			loginLayerDOM += '<input type="hidden" name="siteCode" value="' + GNB_siteCode + '" />'
						
			loginLayerDOM += '<input type="text" name="id" id="LL_iptID" class="LL_iptID" value="" title="아이디" onfocus="this.style.backgroundImage=\'none\';" onblur="if(this.value==\'\') this.style.backgroundImage=\'url('+siteURL_IMG+'/bg_iptid.gif)\';" />';
			loginLayerDOM += '<input type="password" name="password" id="LL_iptPass" class="LL_iptPass" title="패스워드" onfocus="this.style.backgroundImage=\'none\';" onblur="if(this.value==\'\') this.style.backgroundImage=\'url('+siteURL_IMG+'/bg_iptpass.gif)\';" />';
			loginLayerDOM += '<input type="image" class="LL_btnLogin" src="'+siteURL_IMG+'/btn_layerlogin.jpg" alt="로그인" title="로그인" />';
			loginLayerDOM += '<input type="checkbox" class="LL_chkKeyProtect" id="LL_chkKeyProtect" onclick="GNB_ProcessCheck();" />';
			loginLayerDOM += '<label for="LL_chkKeyProtect" class="LL_lblKeyProtect" >키보드보안</label>';
			loginLayerDOM += '<input type="checkbox" class="LL_chkProtect" id="LL_chkProtect" checked="checked" />';
			loginLayerDOM += '<label for="LL_chkProtect" class="LL_lblProtect">보안접속</label>';
			loginLayerDOM += '<input type="checkbox" class="LL_chkSaveid" id="LL_chkSaveid" '+STR_LL_chkSaveid+' onclick="GNB_setRememberID();" />';
			loginLayerDOM += '<label for="LL_chkSaveid" class="LL_lblSaveid">ID기억</label>';
			
			loginLayerDOM += '</fieldset>';
			loginLayerDOM += '</form>';
			loginLayerDOM += '<a href="#" class="LL_btnJoin" onclick="GNB_addMember('+GNB_siteCode+'); return false;"><img src="'+siteURL_IMG+'/btn_layerjoin_off.gif" alt="회원가입" title="회원가입" onmouseout="this.src=this.src.replace(\'_on\',\'_off\');" onmouseover="this.src=this.src.replace(\'_off\',\'_on\');" /></a>';
			loginLayerDOM += '<a href="#" class="LL_btnFindid" onclick="GNB_SearchID('+GNB_siteCode+'); return false;"><img src="'+siteURL_IMG+'/btn_layerfindid_off.gif" alt="아이디/비밀번호 찾기" title="아이디/비밀번호 찾기" onmouseout="this.src=this.src.replace(\'_on\',\'_off\');" onmouseover="this.src=this.src.replace(\'_off\',\'_on\');" /></a>';
			loginLayerDOM += '<a href="'+siteURL_HELP_NOMEMBER+'" class="LL_btnCS" target="_blank""><img src="'+siteURL_IMG+'/btn_layercs_off.gif" alt="비회원문의하기" title="비회원문의하기" onmouseout="this.src=this.src.replace(\'_on\',\'_off\');" onmouseover="this.src=this.src.replace(\'_off\',\'_on\');" /></a>';
			loginLayerDOM += '<div class="LL_bannerArea">';
			loginLayerDOM += '<div id="JC_TH_LOG"></div>';
			//loginLayerDOM += '<a href="#" onclick="GoUrl_site(\'' + siteURL_Login_BANNER + '\'); return false;"><img src="'+siteURL_IMG+'/banner/his_banner.jpg" alt="HIS 3차 CBT" title="HIS 3차 CBT" /></a>';
			loginLayerDOM += '</div>';
			loginLayerDOM += '</div>';
			loginLayerDOM += '<a href="#" id="LOGINLAYERCLOSE"><img src="'+siteURL_IMG+'/btn_loginlayerclose.gif" alt="닫기" title="닫기" style="border:0;" /></a>';
			
			loginLayerDOM += ''; 
			
			displayContent = function() {
				jQuery('.LL_loginWrap').css({'position':'relative', 'width':'507px', 'height':'300px', 'background':'url('+siteURL_IMG+'/bg_loginlayer.gif) no-repeat 0 0'});
				jQuery('.LL_loginWrap fieldset').css('border', '0');
				jQuery('.LL_loginWrap img').css('border', '0');
				jQuery('.LL_loginWrap legend').css('display', 'none');
				jQuery('.LL_titLogin').css({'position':'absolute', 'left':'46px', 'top':'38px', 'font-size':'1px'});
				jQuery('.LL_iptID').css({'position':'absolute', 'left':'65px', 'top':'114px', 'width':'120px', 'height':'15px', 'padding':'3px 0 0 3px', 'border':'1px solid #ececec', 'background':'#fff url('+siteURL_IMG+'/bg_iptid.gif) no-repeat 4px 4px', 'font':'12px 돋움', 'color':'#999'});
				jQuery('.LL_iptPass').css({'position':'absolute','left':'65px','top':'138px','width':'120px','height':'15px','padding':'3px 0 0 3px','border':'1px solid #ececec','background':'#fff url('+siteURL_IMG+'/bg_iptpass.gif) no-repeat 4px 4px','font':'12px 돋움','color':'#999'});
				jQuery('.LL_btnLogin').css({'position':'absolute', 'left':'194px', 'top':'114px'});
				jQuery('.LL_chkKeyProtect').css({'position':'absolute', 'left':'62px', 'top':'167px'});
				jQuery('.LL_chkProtect').css({'position':'absolute', 'left':'135px', 'top':'167px'});
				jQuery('.LL_chkSaveid').css({'position':'absolute', 'left':'196px', 'top':'167px'});
				jQuery('.LL_lblKeyProtect').css({'position':'absolute', 'left':'81px', 'top':'173px', 'font':'11px 돋움', 'letter-spacing':'-1px', 'color':'#929292', 'cursor':'pointer'});
				jQuery('.LL_lblProtect').css({'position':'absolute', 'left':'154px', 'top':'173px', 'font':'11px 돋움', 'letter-spacing':'-1px', 'color':'#929292', 'cursor':'pointer'});
				jQuery('.LL_lblSaveid').css({'position':'absolute', 'left':'215px', 'top':'173px', 'font':'11px 돋움', 'letter-spacing':'-1px', 'color':'#929292', 'cursor':'pointer'});
				jQuery('.LL_bannerArea').css({'position':'absolute', 'left':'283px', 'top':'26px', 'width':'198px', 'height':'248px', 'overflow':'hidden'});
				jQuery('.LL_btnJoin').css({'display':'block', 'position':'absolute', 'left':'80px', 'top':'196px', 'padding':'3px 0'});
				jQuery('.LL_btnFindid').css({'display':'block', 'position':'absolute', 'left':'131px', 'top':'196px', 'padding':'3px 0'});
				jQuery('.LL_btnCS').css({'display':'block', 'position':'absolute', 'left':'112px', 'top':'246px', 'padding':'3px 0'});
				jQuery('#LOGINLAYERCLOSE').css({'position':'absolute', 'right':'0', 'top':'5px'});
			}
			break;
			
		case 1: // 체험아이디
			loginLayerDOM += '<div class="LL_loginWrap">';
			loginLayerDOM += '<div class="LL_titLogin"><img src="'+siteURL_IMG+'/tit_loginlayer.gif" alt="Joycity Member Login" title="" /></div>	';
			loginLayerDOM += '<div class="LL_errment">체험아이디 회원께서는 통합회원으로 <br /> 전환 하셔야 사용하실 수 있습니다 .</div>';
			loginLayerDOM += '<a href="#" class="LL_btnTHLogin" onclick="GNB_THLogin('+GNB_siteCode+'); return false;"><img src="'+siteURL_IMG+'/btn_thlogin.gif" alt="통합회원전환" title="통합회원전환" /></a>';
			loginLayerDOM += '<a href="'+siteURL_HELP_NOMEMBER+'" class="LL_btnCS" target="_balnk"><img src="'+siteURL_IMG+'/btn_layercs_off.gif" alt="비회원문의하기" title="비회원문의하기" onmouseout="this.src=this.src.replace(\'_on\',\'_off\');" onmouseover="this.src=this.src.replace(\'_off\',\'_on\');" /></a>';
			loginLayerDOM += '<div class="LL_bannerArea">';
			loginLayerDOM += '<div id="JC_TH_LOG"></div>';
			//loginLayerDOM += '<a href="#" onclick="GoUrl_site(\'' + siteURL_Login_BANNER + '\'); return false;"><img src="'+siteURL_IMG+'/banner/his_banner.jpg" alt="HIS 3차 CBT" title="HIS 3차 CBT" /></a>';
			loginLayerDOM += '</div>';
			loginLayerDOM += '</div>';
			loginLayerDOM += '<a href="#" id="LOGINLAYERCLOSE"><img src="'+siteURL_IMG+'/btn_loginlayerclose.gif" alt="닫기" title="닫기" style="border:0;" /></a>';

			displayContent = function() {
				jQuery('.LL_loginWrap').css({'position':'relative', 'width':'507px', 'height':'300px', 'background':'url('+siteURL_IMG+'/bg_loginlayer.gif) no-repeat 0 0'});
				jQuery('.LL_loginWrap img').css('border', '0');
				jQuery('.LL_titLogin').css({'position':'absolute', 'left':'46px', 'top':'38px', 'font-size':'1px'});
				jQuery('.LL_errment').css({'position':'absolute', 'left':'45px', 'top':'125px', 'width':'215px', 'font':'11px 돋움', 'line-height':'14px', 'color':'#777', 'text-align':'center'});
				jQuery('.LL_btnTHLogin').css({'position':'absolute', 'left':'108px', 'top':'180px'});
				jQuery('.LL_bannerArea').css({'position':'absolute', 'left':'283px', 'top':'26px', 'width':'198px', 'height':'248px', 'overflow':'hidden'});
				jQuery('.LL_btnJoin').css({'display':'block', 'position':'absolute', 'left':'80px', 'top':'196px', 'padding':'3px 0'});
				jQuery('.LL_btnFindid').css({'display':'block', 'position':'absolute', 'left':'131px', 'top':'196px', 'padding':'3px 0'});
				jQuery('.LL_btnCS').css({'display':'block', 'position':'absolute', 'left':'112px', 'top':'246px', 'padding':'3px 0'});
				jQuery('#LOGINLAYERCLOSE').css({'position':'absolute', 'right':'0', 'top':'5px'});
				jQuery('.LL_btnReLogin').click(GNB_changeLoginLayer);
			}
			break;
	}
	
	jQuery('#LOGINLAYER').html(loginLayerDOM);
	displayContent();

	if((escape(GNB_getTHCookie("JCE%5FcookieId")) != "") || (escape(GNB_getTHCookie("JCE_cookieId")) != "")){
		_getUserIDCookie();
	}
	GNB_setRememberID();

	jQuery('#LOGINLAYERCLOSE').click(GNB_closeLoginLayer);
	
	//로그인 레이어 배너 호출
	jQuery.getJSON("http://bannersys.joycity.com/getBanner.jce?siteCode=29&secIdGroup=LOG&callback=?");
}

var GNB_changeLoginLayer = function() {
	jQuery('#LOGINLAYER').remove();
	GNB_createLoginLayer();
	return false;
}

var GNB_closeLoginLayer = function() {
	jQuery('#LOGINWRAP2').remove();
	jQuery('#LOGINLAYER').remove();
	jQuery('#LOGINWRAP').remove();
	jQuery('#FAKEWRAP').remove();
	
	jQuery(window).unbind('scroll');
	return false;
}


var GNB_setRememberID = function(){
	if(jQuery('#LL_chkSaveid').attr("checked")){
		jQuery('#rememberid').attr("value", "ON");
	}else{
		jQuery('#rememberid').attr("value", "");
	}
}

var _getUserIDCookie = function() {
	jQuery.getJSON("http://www.joycity.com/common/js/gnb/_getUserIDCookie.asp?callback=?");	
}

function getGNBCookieUserID(data){
	var g_cookieID = data[0].g_cookieID;
	if (g_cookieID != null || g_cookieID != ""){
		jQuery('#LL_iptID').attr("value", g_cookieID);
		jQuery('#LL_iptID').css({'backgroundImage':'none'});
	}
}
