<!DOCTYPE html>
<html lang="ko"
	  xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : GnbWeb.html
 * @desc    : GNB
 *============================================================================
 * STYLE24
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.01.28   gagamel     최초 작성
 *******************************************************************************
 -->
<header id="header" th:fragment="gnb">

	<!-- head start -->
	<div class="common_header main_header">
		<!-- 프로모션 띠 배너 등록 시 노출 -->
 		<div class="hd_top_banner" id="divTopbanner">
 		</div>
		<!-- //프로모션 띠 배너 등록 시 노출 -->

		<div class="area">
			<div class="logo">
				<a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_MAIN);">
					<h1>
						<i class="ico ico_logo"></i>
						<em class="blind">STYLE24</em>
					</h1>
				</a>
			</div>
			<div class="util_group">
				<span th:if="${sessionInfo == null}"><a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_LOGIN);" title="로그인 바로가기">로그인</a></span>
				<span th:if="${sessionInfo != null}"><a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_LOGOUT);" title="로그아웃">로그아웃</a></span>
				<span th:if="${sessionInfo == null}"><a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_CUSTOMER_JOIN_TYPE);" title="회원가입 바로가기">회원가입</a></span>
				<span><a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_MYPAGE);" title="마이페이지 바로가기">마이페이지</a></span>
			</div>
		</div>

		<div class="gnb">
			<!-- nav -->
			<div class="nav">
				<ul class="bundle btn_home">
					<li><a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_MAIN);" class="">홈</a></li>
				</ul>

				<ul class="bundle">
					<li class="has_depth">
						<a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_ALL_BRAND);">브랜드</a>
						<!-- 브랜드_depth -->
						<div class="depth_menu brand">
							<div class="head_category">
								<div class="tit">
									<p>브랜드</p>
									<a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_ALL_BRAND);" class="more">전체보기</a>
								</div>
								<div class="menu" id="divGnbBrandGrp">
								</div>
							</div>
						</div>
					</li>
				</ul>
				<ul class="bundle" id="divGnbTab">
				</ul>
			</div>
			<!-- // nav -->

			<div class="more_category">
				<a href="" class="btn_more_cate">더보기</a>
				<div class="cate_list">
					<ul id="ulGnbTab">
					</ul>
				</div>
			</div>

			<!-- search -->
			<div class="search">
				<!-- 프로모션 문구 노출 검색용-->
				<div class="area" id="searchArea">
<!--					<p class="promotion_search">모이몰론, 남들보다 빠르게! 신상 check</p>-->
<!--					<button type="button" class="btn_sch_promotion" id="btnGnbSearch" onclick="cfnSearchLayer();"><i class="ico ico_search"><em>프로모션 검색 바로가기</em></i></button>-->
				</div>
				<!-- //프로모션 문구 노출 검색용-->
				<!-- 통합검색 -->
				<button type="button" class="btn_open_search" id="searchBtn" onclick="cfnSearchLayer();"><i class="ico ico_search"><em>통합검색</em></i></button>
				<a href="#" class="btn_ico btn_cart" title="장바구니 바로가기"><i class="ico ico_bag"></i><span class="circle_count">99+</span></a>
				<!-- //통합검색 -->
			</div>
			<!-- //search -->
		</div>
		<div class="black_screen"></div>
	</div>
	
<script th:inline="javascript">
/*<![CDATA[*/
	// 전체카테고리 조회
	let gAllCate = [[${allCateList}]];
// 	let fnGetAllCategory = function() {
// 		$.getJSON('/display/all/cate/list'
// 			, function(result, status) {
// 				if (status == 'success') {
// 					allCate = result;
					
// 					// GNB탭 > 브랜드 생성
// 					fnCreateGnbBrandGroup();
// 				}
// 		});
// 	}

// 검색엔진 전체카테고리 조회
	let searchEngineAllCate;
	let fnGetSearchEngineAllCategory = function() {
		$.getJSON('/display/searchengine/all/cate/list'
			, function(result, status) {
				if (result.length > 0) {
					searchEngineAllCate = result;
					// GNB탭 > 브랜드 생성
					// fnCreateGnbBrandGroup();
					fnCreateGnbTab();
				}
		});
	}
	var bannerCloseYn = 'Y';
	
	// GNB탭 > 카테고리
	let fnGetGnbCategory = function(cate1) {
		let tag = '';

		if (cate1 != null) {
			tag += '<li class="has_depth">\n'; //depth_menu 있을 시 has_depth 클래스 추가
			tag += '	<a href="javascript:void(0);" onclick="cfnGoToCategoryMain(\'' + cate1.cateGb + '\',' + cate1.cate1No + ');">' + cate1.cate1Nm + '</a>\n';
			tag += '	<div class="depth_menu category">\n';
			tag += '		<div class="head_category">\n';
			tag += '			<div class="tit">\n';
			tag += '				<p>' + cate1.cate1Nm + '</p>\n';
			tag += '				<a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + cate1.cateGb + '\',' + cate1.cate1No + ');" class="more">전체보기</a>\n';
			tag += '			</div>\n';
			if (cate1.leafYn == 'N' && cate1.cate2List.length > 0) {
				tag += '			<div class="menu">\n';
				tag += '				<ul class="maintabs">\n';
				$.each(cate1.cate2List, function(idx2, cate2) {
					tag += '					<li>\n';
					tag += '						<a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + cate2.cateGb + '\',' + cate2.cate1No + ',' + cate2.cate2No + ');">' + cate2.cate2Nm + '</a>\n';
					if (cate2.leafYn == 'N' && cate2.cate3List != null && cate2.cate3List.length > 0) {
						tag += '						<ul class="box_depth2">\n';
						$.each(cate2.cate3List, function(idx3, cate3) {
							tag += '							<li>\n';
							tag += '								<a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + cate3.cateGb + '\',' + cate3.cate1No + ',' + cate3.cate2No + ',' + cate3.cate3No + ');">' + cate3.cate3Nm + '</a>\n';
							if (cate3.leafYn == 'N' && cate3.cate4List != null && cate3.cate4List.length > 0) {
								tag += '								<ul class="box_depth3">\n';
								$.each(cate3.cate4List, function(idx4, cate4) {
									tag += '									<li><a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + cate4.cateGb + '\',' + cate4.cate1No + ',' + cate4.cate2No + ',' + cate4.cate3No + ',' + cate4.cate4No + ');">' + cate4.cate4Nm + '</a></li>\n';
								});
								tag += '								</ul>\n';
							}
							tag += '							</li>\n';
						});
						tag += '						</ul>\n';
					}
					tag += '					</li>\n';
				});
				tag += '				</ul>\n';
				tag += '			</div>\n';
				tag += '		</div>\n';
				tag += '	<div class="head_banner" id="id'+cate1.cate1No+'">\n';
				tag += '	</div>';
				tag += '	</div>\n';
			}
			tag += '</li>\n';
		}
		return tag;
	}

	let fnGetGnbBanner = function (cateNo){
		let actionUrl = '/display/gnb/tab/banner/list?cateNo='+cateNo;
		let tag2 = '';
		$.getJSON(actionUrl
		, function(result, status){
			var bannerImgUrl = _imgUrl; //[[${@environment.getProperty('domain.image')}]];
			var planninImgUrl = _uploadImageUrl; //[[${@environment.getProperty('upload.image.view')}]];
			if(result.length>0){
				tag2 += '		<div class="tit">\n';
				if(!gagajf.isNull(result[0].gnbTabTitle)){
					tag2 += '			<p>'+result[0].gnbTabTitle+'</p>\n';
				}
				tag2 += '		</div>\n';
				tag2 += '		<div class="list">\n';
				tag2 += '			<ul class="clear event_con">\n';
				$.each(result, function (idx, item){
					tag2 += '				<li>\n';
					tag2 += '					<a href="javascript:void(0);" onclick="cfnGoToPage(\''+item.strVar1+'\')">\n';
					if(item.bannerGb=='ADMIN'){
						tag2 += '						<div class="ev_img"><img src="'+bannerImgUrl+''+item.imgPath1+'" alt=""></div>\n';
					}else{
						tag2 += '						<div class="ev_img"><img src="'+planninImgUrl+''+item.imgPath1+'" alt=""></div>\n';
					}

					tag2 += '						<div class="txt">\n';
					tag2 += '							<p class="tit">'+item.strTitle1+'</p>\n';
					// tag2 += '							<p class="tit">'+item.strTitle2+'</p>\n';
					tag2 += '						</div>\n';
					tag2 += '					</a>\n';
					tag2 += '				</li>\n';
				});
				tag2 += '			</ul>\n';
				tag2 += '		</div>\n';
			}
			$('#id'+cateNo).append(tag2);
			return tag2;
		});

	}

	// GNB탭 생성
	let fnCreateGnbTab = function() {
		$.getJSON('/display/gnb/tab/list'
			, function(result, status) {
				if (status == 'success') {
					if (result.length > 0) {
						$('#divGnbTab').html('');
						$('#ulGnbTab').html('');
						
						// let allCate = [[${allCateList}]];
						let allCate = searchEngineAllCate;
						$.each(result, function(idx, item) {
							if (item.contentsType == 'C') { // 컨텐츠유형:카테고리, 아울렛
								$.each(allCate, function(allCateIdx, allCateItem) {
									if (item.cate1No == allCateItem.cate1No) {
										let gnbCate = fnGetGnbCategory(allCateItem);
										fnGetGnbBanner(item.cate1No);
										$('#divGnbTab').append(gnbCate);
										$('#ulGnbTab').append(gnbCate);
									}
								});
							} else if(item.contentsType == 'O'){
								let outletCate = fnGetOutletCategory(item.gtabNm);
								$('#divGnbTab').append(outletCate);
								$('#ulGnbTab').append(outletCate);
								// $('#divGnbTab').append('<li><a href="' + item.linkUrl + '">' + item.gtabNm + '</a></li>');
								// $('#ulGnbTab').append('<li><a href="' + item.linkUrl + '">' + item.gtabNm + '</a></li>');
								fnGetOutletLeafCategory(outletCate);
								fnGetGnbBanner('3000');
							} else if (item.contentsType == 'L') { // 컨텐츠유형:링크
								$('#divGnbTab').append('<li><a href="' + item.linkUrl + '">' + item.gtabNm + '</a></li>');
								$('#ulGnbTab').append('<li><a href="' + item.linkUrl + '">' + item.gtabNm + '</a></li>');
							}
						});
						
						fnui_gnbOvers();
					}
				}
			});
	}

	var fnGetOutletCategory = function (outletNm){
		let formalGb = 'G009_20';
		var tag = '';
		tag += '<li class="has_depth">\n'; //depth_menu 있을 시 has_depth 클래스 추가
		tag += '	<a href="javascript:void(0);" onclick="cfnGoToOutletMain(\'G032_103\');">' + outletNm + '</a>\n';
		tag += '	<div class="depth_menu category">\n';
		tag += '		<div class="head_category">\n';
		tag += '			<div class="tit">\n';
		tag += '				<p>' + outletNm + '</p>\n';
		tag += '				<a href="javascript:void(0);" onclick="cfnGoToOutletMain(\'G032_103\');" class="more">전체보기</a>\n';
		tag += '			</div>\n';
		let allCate = gAllCate;
		tag += '			<div class="menu">\n';
		tag += '				<ul class="maintabs" >\n';
		$.each(allCate, function(allCateIdx, allCateItem) {
			tag += '					<li id="cate'+allCateItem.cate1No+'">\n';
			tag += '						<a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + allCateItem.cateGb + '\',' + allCateItem.cate1No + ',\'\',\'\',\'\',\'\',\'' + formalGb + '\');">' + allCateItem.cate1Nm + '</a>\n';
			tag += '					</li>\n';
		});
		tag += '				</ul>\n';
		tag += '			</div>\n';
		tag += '		</div>\n';
		tag += '	<div class="head_banner" id="id3000">\n';
		tag += '	</div>';
		tag += '	</div>\n';
		tag += '</li>\n';
		return tag;
	}

	var fnGetOutletLeafCategory = function (cate1List){
		let formalGb = 'G009_20';
		let actionUrl = '/display/outlet/cate/list?cate1No=&formalGb='+formalGb;
		$.getJSON(actionUrl , function(result, status) {
			if (result.length > 0) {
				let allCate = gAllCate;
				$.each(result, function(idx, item) {
					$.each(allCate, function(allCateIdx, allCateItem) {
						if (item.cate1No == allCateItem.cate1No) {
							let gnbCate = fnGetOutletLeafData(idx,item);
							$('#cate'+allCateItem.cate1No).append(gnbCate);
						}
					});
				});
			}
		});
	}

	var fnGetOutletLeafData= function (idx, cate1){
		let tag2 = '';
		let formalGb = 'G009_20';
		if (cate1 != null) {
			if (cate1.leafYn == 'N' && cate1.cate2List.length > 0) {
				tag2 += '<ul class="box_depth2">';
				$.each(cate1.cate2List, function(idx2, cate2) {
					tag2 += '					<li>\n';
					tag2 += '						<a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + cate2.cateGb + '\',' + cate2.cate1No + ',' + cate2.cate2No + ',\'\',\'\',\'\',\'' + formalGb + '\');">' + cate2.cate2Nm + '</a>\n';
					if (cate2.leafYn == 'N' && cate2.cate3List != null && cate2.cate3List.length > 0) {
						tag2 += '						<ul class="box_depth2">\n';
						$.each(cate2.cate3List, function(idx3, cate3) {
							tag2 += '							<li>\n';
							tag2 += '								<a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + cate3.cateGb + '\',' + cate3.cate1No + ',' + cate3.cate2No + ',' + cate3.cate3No + ',\'\',\'\',\'' + formalGb + '\');">' + cate3.cate3Nm + '</a>\n';
							if (cate3.leafYn == 'N' && cate3.cate4List != null && cate3.cate4List.length > 0) {
								tag2 += '								<ul class="box_depth3">\n';
								$.each(cate3.cate4List, function(idx4, cate4) {
									tag2 += '									<li><a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'' + cate4.cateGb + '\',' + cate4.cate1No + ',' + cate4.cate2No + ',' + cate4.cate3No + ',' + cate4.cate4No + ',\'\',\'' + formalGb + '\');">' + cate4.cate4Nm + '</a></li>\n';
								});
								tag2 += '								</ul>\n';
							}
							tag2 += '							</li>\n';
						});
						tag2 += '						</ul>\n';
					}
					tag2 += '					</li>\n';
				});
				tag2 += '</ul>';
			}
		}
		return tag2;
	}

	// GNB탭 > 브랜드 생성
	let fnCreateGnbBrandGroup = function() {
		$.getJSON('/display/gnb/brand/group/list'
			, function(result, status) {
				if (status == 'success') {
					if (result.length > 0) {
						$('#divGnbBrandGrp').html('');
						let tag = '';
						let prevTitle = '';
						$.each(result, function (idx, item) {
							if (prevTitle != item.title) {
								if (idx > 0) {
									tag += '		</ul>\n';
									tag += '	</div>\n';
									tag += '</div>\n';
								}
								tag += '<div class="row">\n';
								tag += '	<p>' + item.title + '</p>\n';
								tag += '	<div class="brand_list swiper-container">\n';
								tag += '		<ul class="clear swiper-wrapper">\n';
							}
							tag += '			<li class="swiper-slide">\n';
							tag += '				<a href="javascript:void(0);" onclick="cfnGoToBrandMain(' + item.brandGroupNo + ');">\n';
							tag += '					<img src="' + _uploadDefaultUrl + item.logoFileNm + '" alt=""/>\n';
							tag += '					<span><em>' + item.brandGroupNm + '</em></span>\n';
							tag += '				</a>\n';
							tag += '			</li>\n';

							prevTitle = item.title;
						});
						tag += '		</ul>\n';
						tag += '	</div>\n';
						tag += '</div>\n';
						$('#divGnbBrandGrp').html(tag);
					}
					// fnCreateGnbTab();
				}
		});
	}

	// $('#btnGnbSearch').on('click', function() {
	// 	//검색창 호출
	// 	$(".common_search").addClass('active');
	// });

	// 띠배너 닫기(쿠키설정)
	let fnGnbTobBannerClose = function(unexpDays){
		let chkNoShow = $("#chk-cookie").is(":checked");
		if(chkNoShow){
			let todayDate = new Date();
			todayDate = new Date(parseInt(todayDate.getTime() / 86400000) * 86400000);	// 당일 자정처리
			todayDate.setDate(todayDate.getDate() + unexpDays);
			document.cookie = "gnbtop_banner=Y; path=/; expires=" + todayDate.toGMTString() + ";";
		}
	}

	// 띠배너 조회
	let fnCreateTopBanner = function (){
		var url = '/display/gnb/topbanner/list?contentsLoc=SGNB001';

		$.getJSON(url, function (result, status){
			if(status=='success'){
				if(result.length>0){
					let bannerYn = "N";
					var bannerImgUrl = _imgUrl; // [[${@environment.getProperty('domain.image')}]];
					$.each(result, function (idx, item) {
						$('#divTopbanner').html('');
						if(document.cookie.match('(^|;)?gnbtop_banner=([^;]*)(;|$)')==null){
							bannerYn = "Y";
							let tag = '';

							if(item.contentsType == 'OPEN'){
								tag +='<div class="bnrtype_open" style="background-color:#'+item.strVar5.replaceAll('#','')+';">';
								if(item.strVar7=='IMG'){
									tag +=' 	<a href="'+item.strVar1+'" target="">';
									tag +=' 		<img src="'+bannerImgUrl+''+item.imgPath1+'" alt="">';
									tag +=' 		<div class="open_bnr_area">';
									tag +=' 			<img src="'+bannerImgUrl+''+item.imgPath2+'" alt=""/>';
									tag +=' 		</div>';
									tag +=' 	</a>';
									tag +=' 	<button class="btn_toggle_bnr">열기</button>';
								}else{
									tag +=' 	<a href="'+item.strVar1+'" target="">';
									tag +=' 		<img src="'+bannerImgUrl+''+item.imgPath1+'" alt="">';
									tag +=' 		<div class="open_bnr_area">'+ item.html.replace(/(&lt;)/g, '<').replace(/(&gt;)/g, '>').replace(/(&quot;)/g, '"') +'</div>';
// 									tag +=' 		<div class="open_bnr_area">'+ item.html +'</div>';
									tag +=' 	</a>';
									tag +=' 	<button class="btn_toggle_bnr">열기</button>';
								}
								tag +='</div>';
								// if(item.strVar8=='Y'){
									tag+='<div class="close_bnr_area">';
									tag+=' 	<form class="form_wrap">';
									tag+=' 		<div class="form_field">';
									tag+=' 			<input id="chk-cookie" type="checkbox"><label for="chk-cookie"><span>오늘 하루 보지 않기</span></label>';
									tag+=' 		</div>';
									tag+=' 	</form>';
									tag+=' 	<button id="btn_close_bnr" class="btn_close" onclick="fnGnbTobBannerClose(1);"><span>닫기</span></button>';
									tag+='</div>';
								// }
								if($(".open_bnr_area").text() == '열기'){
									$('.close_bnr_area').show();
								}else{
									if(item.strVar8=='Y'){
										$('.close_bnr_area').show();
										bannerCloseYn = 'Y';
									}else{
										$('.close_bnr_area').hide();
										bannerCloseYn = 'N';
									}
								}
							}else if(item.contentsType == 'IMG'){
								tag+='<div class="bnrtype_img" style="background-color:#'+item.strVar5.replaceAll('#','')+';">';
								tag+=' 	<a href="'+item.strVar1+'" target="">';
								tag+=' 		<img src="'+bannerImgUrl+''+item.imgPath1+'" alt=""/>';
								tag+=' 	</a>';
								tag+='</div>';
								tag+='<div class="close_bnr_area">';
								tag+=' 	<form class="form_wrap">';
								tag+=' 		<div class="form_field">';
								tag+=' 			<input id="chk-cookie" type="checkbox"><label for="chk-cookie"><span>오늘 하루 보지 않기</span></label>';
								tag+=' 		</div>';
								tag+=' 	</form>';
								tag+=' 	<button id="btn_close_bnr" class="btn_close" onclick="fnGnbTobBannerClose(1);"><span>닫기</span></button>';
								tag+='</div>';
							}else{
								tag+='<div class="bnrtype_text" style="background-color:#fd4801;">';
								tag+=' 	<a href="'+item.strVar1+'" target="">';
								tag+=' 		<div style="color:#fff; font-size:20px; font-weight:300;">';
								tag+=' 			<span style="font-weight:500">'+item.strTitle1+'</span>';
								tag+=' 		</div>';
								tag+=' 	</a>';
								tag+='</div>';
								tag+='<div class="close_bnr_area">';
								tag+=' 	<form class="form_wrap">';
								tag+=' 		<div class="form_field">';
								tag+=' 			<input id="chk-cookie" type="checkbox"><label for="chk-cookie"><span>오늘 하루 보지 않기</span></label>';
								tag+=' 		</div>';
								tag+=' 	</form>';
								tag+=' 	<button id="btn_close_bnr" class="btn_close" onclick="fnGnbTobBannerClose(1);"><span>닫기</span></button>';
								tag+='</div>';
							}
							// tag+='<div class="close_bnr_area">';
							// tag+=' 	<form class="form_wrap">';
							// tag+=' 		<div class="form_field">';
							// tag+=' 			<input id="chk-cookie" type="checkbox"><label for="chk-cookie"><span>오늘 하루 보지 않기</span></label>';
							// tag+=' 		</div>';
							// tag+=' 	</form>';
							// if(item.contentsType != 'OPEN' || (item.contentsType == 'OPEN' && item.strVar8=='Y')){
							// 	tag+=' 	<button id="btn_close_bnr" class="btn_close" onclick="fnGnbTobBannerClose(1);"><span>닫기</span></button>';
							// }
							// tag+='</div>';

							if(bannerYn=="Y"){
								$('#divTopbanner').html(tag);
							}

							// if(item.contentsType == 'OPEN'){
							// 	if(item.strVar7!='IMG'){
							// 		var countdown = document.getElementById("testOpen");
							// 		var vvv = ""+item.html+"";
							// 		countdown.innerHTML = vvv;
							// 	}
							// }
						}
					});
				}
			}
		});
	}

	// 검색키워드 조회
	var fnCreateSearchArea = function (){
		var url = '/display/search/keyword/list';
		let html = '';
		$.getJSON(url, function (result, status){
			if(result.length>0){
				$.each(result, function (idx, item) {
					html += '<p class="promotion_search" onclick="cfnSearchLayer();">'+item.keyword+'</p>\n';
					// html += '<button type="button" class="btn_sch_promotion" id="btnGnbSearch" onclick="cfnSearchLayer();"><i class="ico ico_search"><em>프로모션 검색 바로가기</em></i></button>';
					html += '<button type="button" class="btn_sch_promotion" id="btnGnbSearch" onclick="fnGotoLink(\''+item.linkUrl+'\');"><i class="ico ico_search"><em>프로모션 검색 바로가기</em></i></button>';
				});
			}else{
				html += '<p class="promotion_search" onclick="cfnSearchLayer();"></p>\n';
				html += '<button type="button" class="btn_sch_promotion" id="btnGnbSearch" onclick="cfnSearchLayer();"><i class="ico ico_search"><em>프로모션 검색 바로가기</em></i></button>\n';
			}
			$("#searchArea").append(html);
		});
	}

	// 검색 키워드 링크 연결
	let fnGotoLink = function (linkUrl){
		document.location.href = linkUrl;
	}
	
	// gnb overs show/hide
	function fnui_gnbOvers() {
		var categoryWidth = $('#divGnbTab').outerWidth();
		var bdList_index = $('#divGnbTab > li').get();
			bdList_index.reverse();
		var bdList_legth = bdList_index.length;
		var mrList_index = $('.more_category .cate_list ul > li').get();
		var mrList_legth = mrList_index.length;
			mrList_index.reverse();

		for ( var i = 0; i < bdList_legth; i++ ) {
			if (categoryWidth > 994 ){
				bdList_index[i].style.display="none";
				mrList_index[i].style.display="block";
				return false;
			}else if(categoryWidth < 993 ){
				$('.more_category').css('display', 'none');
				return false;
			}
			categoryWidth = $('#divGnbTab').outerWidth();
		}
	}
	
	$(document).ready(function() {
		//TOP BANNER close
		$(document).on('click','#btn_close_bnr',function(e){
			$('body').removeClass('lock');
			$('.bnrtype_open').removeClass('fixed');
			$('.hd_top_banner').remove();
		});
		
		//TOP BANNER OPEN TYPE		
		$(document).on('click','.bnrtype_open .btn_toggle_bnr',function(e){
			$('body').toggleClass('lock');
			$('.bnrtype_open').toggleClass('fixed');
			$(this).text($(this).text() == '열기' ? '닫기' : '열기');
			// $(this).text() == '열기' ? $('.close_bnr_area').show() : $('.close_bnr_area').hide();
			if(bannerCloseYn == 'N'){
				if($(this).text() == '열기'){
					$('.close_bnr_area').show();
				}else{
					$('.close_bnr_area').hide();
				}
			}else{
				$('.close_bnr_area').show();
			}
		});
		
		// GNB toggle
		$(document).on('mouseenter','.common_header .gnb .nav > ul > li',function(e){
			$(this).parents('.nav').find('.bundle > li > a').removeClass('active');
			$(this).children('a').addClass('active');
			if(!$(this).hasClass('has_depth')){
				$('.black_screen').hide();
				$('.common_header .gnb .depth_menu, .box_depth2, .box_depth3, .box_depth4').hide();
			} else if($(this).hasClass('has_depth')){
				$('.black_screen').show();
				$(this).find('.depth_menu').show();
				$(this).parents('ul').siblings('ul').find('li.has_depth .depth_menu').hide();
				$(this).siblings('li.has_depth').find('.depth_menu').hide();
			}
		}).on('mouseleave','.common_header .gnb',function(e){
			$(this).find('.bundle > li > a').removeClass('active');
			$('.black_screen').hide();
			$('.common_header .gnb .depth_menu, .box_depth2, .box_depth3, .box_depth4').hide();
		});

		// GNB 하위메뉴
		$(document).on('mouseenter','.common_header .maintabs li',function(e){
			if($(this).find('> ul').length > 0){
				$(this).addClass('on');
			}
			$(this).find('> ul').show();
			$(this).siblings('li').find('> ul').hide();
		});

		// GNB 하위메뉴
		$(document).on('mouseenter','.common_header .maintabs li',function(e){
			if($(this).find('> ul').length > 0){
				$(this).addClass('on');
			}
			$(this).find('> ul').show();
			$(this).siblings('li').find('> ul').hide();
		});
		
		// GNB 더보기
		$(document).on('click','.more_category .btn_more_cate',function(e){
			$(this).parent('.more_category').toggleClass('on');
			$(this).parent('.more_category').find('.cate_list').toggle();
			return false;
		});

		// GNB - 슬라이드 > 브랜드_GNB
		var brand_gnb_slide = new Swiper('#header .gnb .brand_list', {
			observer: true,
			observeParents: true,
			centeredSlides: false,
			slidesPerView: 'auto',
			freeMode:true,
		});

		//통합검색 - 슬라이드 > 지금 고객님들이 많이 보고 있어요
		var realtimeItemSwiper = new Swiper('.common_search .realtime_slider .swiper-container', {
			observer: true,
			observeParents: true,
			slidesPerView: 5,
			spaceBetween: 20,
			autoplay: {
				delay: 2500,
				disableOnInteraction:false,
			},
			navigation: {
				nextEl: '.common_search .realtime_slider .swiper-button-next',
				prevEl: '.common_search .realtime_slider .swiper-button-prev',
			},
			pagination: {
				el: '.common_search .realtime_slider .swiper-pagination',
				clickable: true,
			},
		});

// 		// 전체 카테고리 조회
// 		fnGetAllCategory();
// 		// 검색엔진 카테고리 조회
 		fnGetSearchEngineAllCategory();
		
		// GNB탭 > 브랜드 생성
		fnCreateGnbBrandGroup();

		// 띠배너 조회
		fnCreateTopBanner();

		// 검색키워드 조회
		fnCreateSearchArea();
	});
/*]]>*/
</script>

</header>

</html>