<!DOCTYPE html>
<html lang="ko"
	  xmlns:th="http://www.thymeleaf.org"
	  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	  layout:decorator="mob/common/layout/BrandLayoutMob">
<!--
 *******************************************************************************
 * @source  : CategoryGoodsListFormMob.html
 * @desc    : 카테고리별 상품 리스트 Page
 *============================================================================
 * STYLE24
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.05.12   bin2107     최초 작성
 *******************************************************************************
 -->
<body>

<th:block layout:fragment="content">


	<main role="" id="" class="container dp">
		<section class="content dp_list">
			<div class="inner wide bg_gray">
				<div class="sub_category">
					<div class="cate_wrap" id="leafCateList">
						<!-- 하위카테고리 리스트 -->
					</div>
				</div>
			</div>

			<div class="inner">
				<!-- 상품리스트 -->
				<div class="list_content"> <!-- 데이터 없을시 클래스 nodata 추가 -->
					<div class="count_wrap">
						<div>
							<p><span id="totCntId"></span>개의 상품</p>
						</div>
						<div>
							<ul class="dp_util">
								<li>
									<div class="open_categori">
										<!-- 210415_select > a태그로 변경 -->
										<a id="filter">최신상품순
											<!--<option value="hide">최신상품순</option>
                                            <option value="Test_SELECT_OPTION_1" rel="icon-temperature">최신상품순1</option>
                                            <option value="Test_SELECT_OPTION_2">최신상품순2</option>
                                            <option value="Test_SELECT_OPTION_3">최신상품순3</option>-->
										</a>
									</div>
								</li>
								<li><a href="javascript:void(0);" class="filter open_filter">필터</a></li>
							</ul>
						</div>
					</div>
					<div class="list_defult" style="display:none;">
						<div>
							<p>선택하신 조건에 맞는 상품이 없습니다.<br>필터를 변경해 보세요.</p>
						</div>
						<button type="button" class="btn btn_default" onclick="fnMobFilterReset();"><span>선택한 필터 초기화</span></button>
					</div>

					<div id="infiniteContainer">
						<div id="listBoxOuter">
							<ul id="listBox" class="itemsGrp">
							</ul>
						</div>
					</div>

<!--					<div id="infiniteContainer">-->
<!--						<div id="listBoxOuter" class="itemsGrp">-->
<!--							<ul class="productlist quarter" >-->
<!--							</ul>-->
<!--						</div>-->
<!--					</div>-->

<!--					<div class="itemsGrp" id="listBox"> &lt;!&ndash; itemsGrp rank hot deal &ndash;&gt;-->

<!--					</div>-->
					<div class="list_last" id="endPage" style="display:none;">마지막페이지 입니다.</div>
				</div>
				<!-- //상품리스트 -->
			</div>
		</section>

		<!-- 필터 -->
		<div class="filter_box">
			<div class="filter_list">
				<div class="filter_top">
					<div class="tt">필터</div>
					<div>
						<button class="fillter_reset" onclick="fnMobFilterReset();"><span>초기화</span></button>
						<button class="close">닫기</button>
					</div>
				</div>
				<div class="filter_con">
					<form id="filterForm">
						<div class="filter_header">
							<div class="form_field">
								<div>
									<input id="unisex" type="checkbox" onclick="fnResetListIdx();fnFilterOption(this,'on');"><label for="unisex"> <span>남여 공용만 보기</span> </label>
								</div>
								
								<th:block th:if="${(brandGroupInfo == null or brandGroupInfo.supplyCompCd != '3') and cateInfo.cate1No != 1300}">
									<div th:unless="${cateInfo.formalGb=='G009_20'}">
										<input id="newGoods" type="checkbox" onclick="fnResetListIdx();fnFilterOption(this,'off');" checked="checked">
										<label for="newGoods"> <span>신상품만 보기</span> </label>
									</div>
								</th:block>
								<th:block th:if="${(brandGroupInfo != null AND brandGroupInfo.supplyCompCd == '3') or cateInfo.cate1No == 1300}">
									<div th:unless="${cateInfo.formalGb=='G009_20'}">
										<input id="newGoods" type="checkbox" onclick="fnResetListIdx();fnFilterOption(this,'on');">
										<label for="newGoods"> <span>신상품만 보기</span> </label>
									</div>
								</th:block>
							</div>
						</div>
						<div class="filter_body">
							<!-- 필터메뉴 -->
							<ul class="allFilter">
								<li class="brand chkFilter" th:if="${filterBrandList != null and !filterBrandList.empty}" id="brandGroupFilterDiv">
									<a href="javascript:void(0)" class="daps1">브랜드</a>
									<ul class="daps2">
										<li th:each="oneData, status : ${filterBrandList}">
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input th:id="${'chkFilterBrand' + status.index}" name="brandGroup" type="checkbox" th:value="${oneData.filterCd}" th:data-id="${oneData.filterNm}" onclick="fnResetListIdx();fnSelectFilerMob(this,'brandGroup','off','');"><label th:for="${'chkFilterBrand' + status.index}"><span th:text="${oneData.filterNm}"></span></label>
													</div>
												</div>
											</a>
										</li>
									</ul>
								</li>
								<li class="size chkFilter" th:if="${filterSizeList != null and !filterSizeList.empty}" id="sizeFilterDiv">
									<a href="javascript:void(0)" class="daps1">사이즈</a>
									<div class="daps2">
										<ul class="sizebox">
											<li id="sizeLi1">
												<strong>상의</strong>
												<th:block th:each="oneData, status : ${filterSizeList}" th:if="${#strings.startsWith(oneData.filterCd,'T')}">
													<label class="size_btn">
														<input type="checkbox" group="filterValue" th:id="${'chkFilterTSize' + status.index}" name="size" th:vale="${oneData.filterNm}" th:data-id="${oneData.filterNm}" data-idx="1" onclick="fnResetListIdx();fnSelectFilerMob(this,'size','off','1');"><span th:text="${oneData.filterNm}">80</span>
													</label>
												</th:block>
											</li>
											<li id="sizeLi2">
												<strong>하의</strong>
												<th:block th:each="oneData, status : ${filterSizeList}" th:if="${#strings.startsWith(oneData.filterCd,'B')}">
													<label class="size_btn">
														<input type="checkbox" group="filterValue" th:id="${'chkFilterBSize' + status.index}" name="size" th:vale="${oneData.filterNm}" th:data-id="${oneData.filterNm}" data-idx="2" onclick="fnResetListIdx();fnSelectFilerMob(this,'size','off','2');"><span th:text="${oneData.filterNm}">44</span>
													</label>
												</th:block>
											</li>
											<li id="sizeLi3">
												<strong>신발</strong>
												<th:block th:each="oneData, status : ${filterSizeList}" th:if="${#strings.startsWith(oneData.filterCd,'S')}">
													<label class="size_btn">
														<input type="checkbox" group="filterValue" th:id="${'chkFilterSSize' + status.index}" name="size" th:vale="${oneData.filterNm}" th:data-id="${oneData.filterNm}" data-idx="3" onclick="fnResetListIdx();fnSelectFilerMob(this,'size','off','3');"><span th:text="${oneData.filterNm}">120</span>
													</label>
												</th:block>
											</li>
										</ul>
									</div>
								</li>
								<li class="price chkFilter" id="priceFilterDiv">
									<input type="hidden" id="hPriceFrom" name="hPriceFrom" value=""/>
									<input type="hidden" id="hPriceTo" name="hPriceTo" value=""/>
									<a href="javascript:void(0)" class="daps1">가격<!--<span class="pic">230,000원~487,000원, 700,000원~990,000원</span>--></a>
									<ul class="daps2" id="priceArea">
									</ul>
								</li>
								<li class="discount chkFilter" id="dcRateFilterDiv">
									<input type="hidden" id="hDcRateFrom" name="hDcRateFrom" value=""/>
									<input type="hidden" id="hDcRateTo" name="hDcRateTo" value=""/>
									<a href="javascript:void(0)" class="daps1">할인율</a>
									<ul class="daps2" id="dcRateArea">
										<li>
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input id="discount1" name="dcRate" type="checkbox" value="0,10" data-id="10% 이하" onclick="fnResetListIdx();filterDcRateMob(this,'dcRate','off','1');"><label for="discount1"> <span id="dcRateText1">10% 이하</span> </label>
													</div>
												</div>
											</a>
										</li>
										<li>
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input id="discount2" name="dcRate" type="checkbox" value="10,20" data-id="10~20%" onclick="fnResetListIdx();filterDcRateMob(this,'dcRate','off','2');"><label for="discount2"> <span id="dcRateText2">10~20%</span> </label>
													</div>
												</div>
											</a>
										</li>
										<li>
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input id="discount3" name="dcRate" type="checkbox" value="20,30" data-id="20~30%" onclick="fnResetListIdx();filterDcRateMob(this,'dcRate','off','3');"><label for="discount3"> <span id="dcRateText3">20~30%</span> </label>
													</div>
												</div>
											</a>
										</li>
										<li>
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input id="discount4" name="dcRate" type="checkbox" value="30,40" data-id="30~40%" onclick="fnResetListIdx();filterDcRateMob(this,'dcRate','off','4');"><label for="discount4"> <span id="dcRateText4">30~40%</span> </label>
													</div>
												</div>
											</a>
										</li>
										<li>
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input id="discount5" name="dcRate" type="checkbox" value="40,50" data-id="40~50%" onclick="fnResetListIdx();filterDcRateMob(this,'dcRate','off','5');"><label for="discount5"> <span id="dcRateText5">40~50%</span> </label>
													</div>
												</div>
											</a>
										</li>
										<li>
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input id="discount6" name="dcRate" type="checkbox" value="50,60" data-id="50~60%" onclick="fnResetListIdx();filterDcRateMob(this,'dcRate','off','6');"><label for="discount6"> <span id="dcRateText6">50~60%</span> </label>
													</div>
												</div>
											</a>
										</li>
										<li>
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input id="discount7" name="dcRate" type="checkbox" value="60,70" data-id="60~70%" onclick="fnResetListIdx();filterDcRateMob(this,'dcRate','off','7');"><label for="discount7"> <span id="dcRateText7">60~70%</span> </label>
													</div>
												</div>
											</a>
										</li>
										<li>
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input id="discount8" name="dcRate" type="checkbox" value="70,80" data-id="70~80%" onclick="fnResetListIdx();filterDcRateMob(this,'dcRate','off','8');"><label for="discount8"> <span id="dcRateText8">70~80%</span> </label>
													</div>
												</div>
											</a>
										</li>
										<li>
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input id="discount9" name="dcRate" type="checkbox" value="80,90" data-id="80~90%" onclick="fnResetListIdx();filterDcRateMob(this,'dcRate','off','9');"><label for="discount9"> <span id="dcRateText9">80~90%</span> </label>
													</div>
												</div>
											</a>
										</li>
										<li>
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input id="discount10" name="dcRate" type="checkbox" value="90,0" data-id="90%이상" onclick="fnResetListIdx();filterDcRateMob(this,'dcRate','off','10');"><label for="discount10"> <span id="dcRateText10">90이상</span> </label>
													</div>
												</div>
											</a>
										</li>
									</ul>
								</li>
								<li class="age chkFilter" th:if="${filterAgeList != null and !filterAgeList.empty}" id="ageFilterDiv">
									<a href="javascript:void(0)" class="daps1">연령</a>
									<ul class="daps2">
										<li th:each="oneData, status : ${filterAgeList}">
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input th:id="${'chkFilterAge' + status.index}" name="age" th:value="${oneData.filterCd}" th:data-id="${oneData.filterNm}" onclick="fnResetListIdx();fnSelectFilerMob(this,'age','off','');" type="checkbox"><label th:for="${'chkFilterAge' + status.index}"> <span th:text="${oneData.filterNm}"></span> </label>
													</div>
												</div>
											</a>
										</li>
									</ul>
								</li>
								<li class="season chkFilter" th:if="${filterSeasonList != null and !filterSeasonList.empty}" id="seasonFilterDiv">
									<a href="javascript:void(0)" class="daps1">시즌</a>
									<ul class="daps2">
										<li th:each="oneData, status : ${filterSeasonList}">
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input th:id="${'chkFilterSeason' + status.index}" name="season" th:value="${oneData.filterCd}" th:data-id="${oneData.filterNm}" onclick="fnResetListIdx();fnSelectFilerMob(this,'season','off','');" type="checkbox"><label th:for="${'chkFilterSeason' + status.index}"> <span th:text="${oneData.filterNm}">봄</span> </label>
													</div>
												</div>
											</a>
										</li>
									</ul>
								</li>
								<li class="color chkFilter" th:if="${filterColorList != null and !filterColorList.empty}" id="colorFilterDiv">
									<a href="javascript:void(0)" class="daps1">컬러
										<span class="pic">
<!--											<span class="pdColor-color01"></span><span class="pdColor-color02"></span>-->
										</span>
									</a>
									<div class="daps2">
										<ul class="colorbox">
											<li th:each="oneData, status : ${filterColorList}">
												<label class="color-check">
													<input type="checkbox" group="filterValue" th:id="${'chkFilterColor' + status.index}" name="color" th:value="${oneData.filterCd}" th:data-id="${oneData.filterNm.replace('#','')}" onclick="fnResetListIdx();fnSelectFilerMob(this,'color','off','');">
													<span class="pdColor-color" th:if="${oneData.filterNm=='#FFFFFF'}" th:style="${'background-color:'+oneData.filterNm+';'+' border:1px solid #aaa;'}" th:value="${oneData.filterCd}"></span>
													<span class="pdColor-color" th:if="${oneData.filterNm!='#FFFFFF'}" th:style="${'background-color:'+oneData.filterNm}" th:value="${oneData.filterCd}"></span>
												</label>
											</li>
										</ul>
									</div>
								</li>
								<li class="benefit chkFilter" th:if="${filterBenefitList != null and !filterBenefitList.empty}" id="benefitFilterDiv">
									<a href="javascript:void(0)" class="daps1">혜택</a>
									<ul class="daps2">
										<li th:each="oneData, status : ${filterBenefitList}">
											<a href="javascript:void(0)">
												<div class="form_field">
													<div>
														<input th:id="${'chkFilterBenefits' + status.index}" name="benefit" th:value="${oneData.filterCd}+':'+${oneData.filterNm}" th:data-id="${oneData.filterNm}" onclick="fnResetListIdx();fnSelectFilerMob(this,'benefit','off','');" type="checkbox"><label th:for="${'chkFilterBenefits' + status.index}"> <span th:text="${oneData.filterNm}"></span> </label>
													</div>
												</div>
											</a>
										</li>
									</ul>
								</li>
							</ul>
							<!-- //필터메뉴 -->
						</div>
					</form>
				</div>
			</div>
		</div>
		<!-- //필터 -->


		<!-- 210415_최신상품순 리스트 팝업 추가 -->
		<div id="odDatePop" class="popup_box odDatePop">
			<div class="lap">
				<div class="popup_close">카테고리닫기</div>
				<div class="popup_head sr-only">
					<h2 class="">기간 선택 팝업</h2>
				</div>
				<div class="popup_con">
					<div class="button_list clear" id="sortArea">
						<button type="button" id="sortingNEW" class="on" onclick="fnSortingChange(this,'NEW','','Mob');"><span>최신상품순</span></button>
						<button type="button" id="sortingBEST" onclick="fnSortingChange(this,'BEST','','Mob');"><span>인기많은순</span></button>
						<button type="button" id="sortingREVIEW" onclick="fnSortingChange(this,'REVIEW','','Mob');"><span>리뷰많은순</span></button>
					</div>
				</div>
			</div>
		</div>

		<div class="nav_box">
			<div class="lap">
				<div class="nav_close">네비닫기</div>
				<div class="nav_list">
					<!-- 카테고리 선택 -->
					<div class="nav">
						<ul>
							<li class="active">
<!--								<a href="javascript:void(0)" class="daps1">여성</a>-->
								<ul class="daps2" id="cateDepth">

								</ul>
							</li>
						</ul>
					</div>
					<!-- //카테고리 선택 -->
				</div>
			</div>
		</div>
	</main>

	<form id="searchGoodsForm" name="searchGoodsForm">
		<input type="hidden" name="pageNo" id="pageNo" value ="1"/>
		<input type="hidden" name="pageSize" value ="50"/>
		<!-- 		<input type="hidden" name="cateNo" th:value="${cateInfo.cateNo}"/> -->
		<input type="hidden" name="cateGb" th:value="${cateInfo.cateGb}"/>
		<input type="hidden" name="brandGroupNo" th:value="${cateInfo.brandGroupNo}"/>
		<input type="hidden" name="formalGb" th:value="${cateInfo.formalGb=='G009_20'?'G009_20':''}"/>
		<input type="hidden" name="cate1No" th:value="${cateInfo.cate1No}"/>
		<input type="hidden" name="cate2No" th:value="${cateInfo.cate2No}"/>
		<input type="hidden" name="cate3No" th:value="${cateInfo.cate3No}"/>
		<input type="hidden" name="cate4No" th:value="${cateInfo.cate4No}"/>
		<input type="hidden" name="sortingType" value="NEW"/>
		<input type="hidden" name="newGoods" th:unless="${(brandGroupInfo != null and brandGroupInfo.supplyCompCd == '3') or cateInfo.cate1No == 1300 or (cateInfo.formalGb=='G009_20')}" th:value="${(brandGroupInfo != null and brandGroupInfo.supplyCompCd == '3') or cateInfo.cate1No == 1300 or (cateInfo.formalGb=='G009_20') ?'':'40'}" />
		<!-- <input type="hidden" name="newGoods" th:unless="${cateInfo.formalGb=='G009_20'}" th:value="${cateInfo.formalGb=='G009_20'?'':'40'}" /> -->
		<input type="hidden" name="keyword" value=""/>
<!--		<input type="hidden" name="benefitArr" th:unless="${cateInfo.formalGb=='G009_20'}" th:value="${cateInfo.formalGb=='G009_20'?'':'40:신상'}"/>-->
	</form>


	<script src="/ux/plugins/gaga/gaga.infinite.scrollSession.js"></script>
	<script src="/ux/plugins/jquery/jquery.history.min.js"></script>
	<script th:src="@{'/biz/goods.js?v=' + ${#calendars.format(#calendars.createNow(), 'yyyyMMddHHmmss')}}" src="/biz/goods.js"></script>

	<script th:inline="javascript">
		let brandGroupInfo =  [[${brandGroupInfo}]];
		var filterPriceList = [[${filterPriceList}]];
		// 상품리스트 페이지 확인용
		var listIdx = 1;

		$(document).ready(function(){
			if(filterPriceList.length > 0){
				$("#priceArea").html('');
				var priceHtml = '';
				var minPrice;
				var maxPrice;
				for(let i=0; i<filterPriceList.length-1; i++){
					if(i==filterPriceList.length-2){
						minPrice = filterPriceList[i].filterNm;
						maxPrice = filterPriceList[i+1].filterNm;
					}else{
						minPrice = filterPriceList[i].filterNm;
						maxPrice = filterPriceList[i+1].filterNm;
					}
					priceHtml += '<li>\n';
					priceHtml += '	<a href="javascript:void(0)">\n';
					priceHtml += '		<div class="form_field">\n';
					priceHtml += '			<div>\n';
					priceHtml += '				<input type="checkbox" id="price'+(i+1)+'" name="price" value="'+minPrice+','+maxPrice+'" data-id="'+minPrice.addComma()+'원 ~ '+maxPrice.addComma()+'원" onclick="filterPriceMob(this,\'price\',\'off\',\''+(i+1)+'\');"><label for="price'+(i+1)+'">\n';
					priceHtml += '				<span id="pricdSpan'+(i+1)+'">'+minPrice.addComma()+'원 ~ '+maxPrice.addComma()+'원</span> </label>\n';
					priceHtml += '			</div>\n';
					priceHtml += '		</div>\n';
					priceHtml += '	</a>\n';
					priceHtml += '</li>\n';
				}
				$("#priceArea").append(priceHtml);
			}

			// TOP 동일 카테고리
			// fnCreateDepthList();
			fnGetSameDepthList();
			// 상단노출 하위 카테고리
			// fnCreateCategoryList();

			if ($('#sizeLi1').find('label').length == 0) $('#sizeLi1').hide();
			if ($('#sizeLi2').find('label').length == 0) $('#sizeLi2').hide();
			if ($('#sizeLi3').find('label').length == 0) $('#sizeLi3').hide();

			//네비
			var bodyChk = 0;
			function navi(){

				var navOpen=$("#htopTitle");
				var navClose=$(".nav_box .nav_close");
				var navPop=$(".nav_box");

				navOpen.on("click",function(){
					if($(this).hasClass("on")){
						$(this).removeClass("on")
						navPop.hide();
						$("body").css({"overflow":"visible"});
						bodyChk = 1;
					}else{
						$(this).addClass("on")
						navPop.show();
						navPop.addClass("on");
						$("body").css({"overflow":"hidden"});
						bodyChk = 0;
					}
				});

				navClose.on("click",function(){
					$(this).removeClass("on");
					navPop.hide();
					$("body").css({"overflow":"visible"});
					$("#htopTitle").removeClass("on");
				});

				if(bodyChk === 0){
					$('body').on('scroll touchmove mousewheel', function(event) { // 터치무브와 마우스휠 스크롤 방지
						event.preventDefault();
						event.stopPropagation();
						return false;
					});
				}
			}
			navi();

			//카테고리
			function category(){
				var categoryOpen=$(".open_categori .select_dress");
				var categoryClose=$(".category_box .category_close");
				var categoryPop=$(".category_box");

				categoryOpen.on("click",function(){
					categoryPop.show();
					categoryPop.addClass("active");

				});

				categoryClose.on("click",function(){
					categoryPop.hide();
					$("body").css({"overflow":"visible"});
				});
			}
			category();

			//필터
			function filter(){
				var filterOpen=$(".open_filter");
				var filterClose=$(".filter_box .close");
				var filterPop=$(".filter_box");
				var filter=$(".filter_body > ul");
				var dap1=$(".filter_body > ul .daps1");
				var dap2=$(".filter_body > ul .daps2");
				var dap3=$(".filter_body > ul .daps3");
				var dap4=$(".filter_body > ul .daps4");
				var dap5=$(".filter_body > ul .daps5");
				var dap2A=$(".filter_body > ul .daps2 > li > a");
				var dap3A=$(".filter_body > ul .daps3 > li > a");
				var dap4A=$(".filter_body > ul .daps4 > li > a");
				var dap5A=$(".filter_body > ul .daps5 > li > a");

				/* 필터모달 > 열기,닫기 */
				filterOpen.on("click",function(){
					filterPop.addClass("active");
					$("body").css({"overflow":"hidden"});
				});

				filterClose.on("click",function(){
					filterPop.removeClass("active");
					$("body").css({"overflow":"visible"});
				});

				/* 필터메뉴 > 댑스열고, 닫기 */
				dap1.on("click",function(){
					if($(this).hasClass("on")){
						$(this).removeClass("on");
						$(this).next(dap2).slideUp();
					}else{
						$(this).addClass("on");
						$(this).next(dap2).slideDown();
					}
				});

				dap2A.on("click",function(){
					if($(this).hasClass("on")){
						$(this).removeClass("on");
						$(this).next(dap3).slideUp();
					}else{
						$(this).addClass("on");
						$(this).next(dap3).slideDown();
					}
				});

				dap3A.on("click",function(){
					if($(this).hasClass("on")){
						$(this).removeClass("on");
						$(this).next(dap4).slideUp();
					}else{
						$(this).addClass("on");
						$(this).next(dap4).slideDown();
					}
				});

				dap4A.on("click",function(){
					if($(this).hasClass("on")){
						$(this).removeClass("on");
						$(this).next(dap5).slideUp();
					}else{
						$(this).addClass("on");
						$(this).next(dap5).slideDown();
					}
				});

				dap5A.on("click",function(){
					if($(this).hasClass("on")){
						$(this).removeClass("on");
						//$(this).next(dap6).slideUp();
					}else{
						$(this).addClass("on");
						//$(this).next(dap6).slideDown();
					}
				});
			}
			filter();

			// 210415_팝업관련 추가
			//기간 선택 팝업
			$(document).on("click", ".open_categori", function(){
				$('#odDatePop').show().addClass("active");
				$("body").css({"overflow":"hidden"});
			});
			//팝업_닫기
			$('.popup_close').on("click",function(){
				$('.popup_box').hide().removeClass('active');
				$("body").css({"overflow":"visible"});
			});

			// 210415_팝업 테두리 선택 추가
			$(document).on('click','.popup_box .button_list button',function(){
				$('.popup_box .button_list button').removeClass('on');
				$(this).addClass('on');
			});

			$('.dp .filter_box .filter_con').scroll(function(){
				//$(".dp .filter_box .filter_con").css("border-bottom", "0px none");
				//console.log($(".dp .filter_box .filter_con").scrollTop());
				if($(".dp .filter_box .filter_con").scrollTop() === 0){
					$(".dp .filter_box .filter_top").css("box-shadow", "none");
					//$(".dp .filter_box .filter_con").css("border-bottom", "1px solid #eee");
				} else {
					$(".dp .filter_box .filter_top").css("box-shadow", "0px 3px 15px 0px rgba(0,0,0,0.30)");
				}
			});

			//210510_추가 : 토스트 팝업 button 클릭 시 팝업 닫기.
			$(document).on('click','.popup_box.odDatePop .button_list button',function(){
				$(this).parents('.popup_box.odDatePop').hide().removeClass('active');
				$("body").css({"overflow":"visible"});
			});

			$(".nav_close").click();

		});

		var fnGoodsListSearch = function (){
			// debugger;
			gagaInfiniteScroll.getHistory();
		}

		var totalCnt = 0;

		// 상품 검색
		var fnGetInfiniteScrollDataList = function (pageNum){
			$("#searchGoodsForm input[name=pageNo]").val(pageNum+1);
			// if(idx==1 || totalCnt > Number($("#searchGoodsForm").find("input[name=pageSize]").val())){
			// 	idx++;
				gagajf.ajaxFormSubmit("/display/category/goods/list", document.searchGoodsForm,  gagaInfiniteScroll.jsonToHtml , true);
			// }
		}

		var fnDrawInfiniteScrollData = function (result){
			totalCnt = result.paging.totalCount;
			$("#totCntId").text(totalCnt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
			gagaInfiniteScroll.pageStatus.totalCount = totalCnt;

			var ithrCd = '';
			var contentLoc = '';
			let dataListLen = 0;
			if(result.dataList != null){
				dataListLen = result.dataList.length-1;
			}

			// result.dataList != null && result.dataList.length > 0
			if (dataListLen > 0) {
				listIdx++;
				$('.list_content .list_defult').hide();
				//$('.list_content .count_wrap').show();
				var goodsUrl = [[${@environment.getProperty('upload.goods.view')}]];
				let lastPage = result.paging.pageNo;
				let endRow = result.paging.endRow - result.paging.pageSize;
				var htm = fnCreateGoodsList(result, ithrCd, contentLoc, goodsUrl, lastPage, endRow, 'Mob');
				gagaInfiniteScroll.draw(htm);
			}else {
				if(listIdx > 1) { // 데이터가 1건 이상
					if(totalCnt > Number($("#searchGoodsForm").find("input[name=pageSize]").val())){
						if($("#searchGoodsForm input[name=pageNo]").val()==1){
							// 필터 값으로 조회 데이터 없을때
							$('.list_content .list_defult').show();
						}else{
							// 마지막 페이지 일때
							$('#endPage').show();
						}
					}else{
						if($("#searchGoodsForm input[name=pageNo]").val()==1){
							// 필터 값으로 조회 데이터 없을때
							$('.list_content .list_defult').show();
						}
					}
				}else{
					// 필터 값으로 조회 데이터 없을때
					$('.list_content .list_defult').show();
				}

				gagaInfiniteScroll.draw('not');
			}
		}

		var fnFilterOption = function (obj, stat){
			var thisId = $(obj).attr('id');
			var tag = '';

			if(thisId == 'unisex'){
				if(stat=='on'){
					$(obj).attr('onclick','fnResetListIdx();fnFilterOption(this,\'off\');');
					$(obj).attr('checked', true);
					tag += '<input type="hidden" name="unisex" value="G007_Z"/>\n';
					$("#searchGoodsForm").append(tag);
				}else{
					$(obj).attr('onclick','fnResetListIdx();fnFilterOption(this,\'on\');');
					$(obj).attr('checked', false);
					$("#searchGoodsForm input:hidden[name=unisex]").remove();
				}
			}else{
				if(stat=='on'){
					$(obj).attr('onclick','fnResetListIdx();fnFilterOption(this,\'off\');');
					$(obj).attr('checked', true);
					tag += '<input type="hidden" name="newGoods" value="40"/>\n';
					// tag += '<input type="hidden" name="benefitArr" value="40:신상"/>\n';
					$("#searchGoodsForm").append(tag);
				}else{
					$(obj).attr('onclick','fnResetListIdx();fnFilterOption(this,\'on\');');
					$(obj).attr('checked', false);
					$("#searchGoodsForm input:hidden[name=newGoods]").remove();
					$("#searchGoodsForm input:hidden[name=benefitArr]").each(function(){
						if($(this).val() == "40:신상"){
							$(this).remove();
						}
					});
				}
			}
			fnSetFilterHtml();
			fnCategoryGoodsInfiniteScrollInit();
			fnGoodsListSearch();
		}

		// 사파리 - event.persisted || 크롬 - window.performance.navigation.type 이 1이면 새로고침, 2면 페이지 이동을 통한 캐쉬페이징
		$(window).on("pageshow", function(event) {
			if( history.scrollRestoration ) window.history.scrollRestoration = 'manual';
			$('#filterForm input[name=brandGroup]:checked').each(function(){
				$(this).attr('checked', true);
			});
			$('#filterForm input[name=size]:checked').each(function(){
				$(this).attr('checked', true);
			});
			$('#filterForm input[name=dcRate]:checked').each(function(){
				$(this).attr('checked', true);
			});
			$('#filterForm input[name=age]:checked').each(function(){
				$(this).attr('checked', true);
			});
			$('#filterForm input[name=season]:checked').each(function(){
				$(this).attr('checked', true);
			});
			$('#filterForm input[name=color]:checked').each(function(){
				$(this).attr('checked', true);
			});
			$('#filterForm input[name=benefit]:checked').each(function(){
				$(this).attr('checked', true);
			});
			$('#filterForm input[name=price]:checked').each(function(){
				$(this).attr('checked', true);
			});
			if ( (event.originalEvent && event.originalEvent.persisted) || (window.performance && window.performance.navigation.type == 2)) {
				if( history.scrollRestoration ) window.history.scrollRestoration = 'manual';
				$("#searchGoodsForm input:hidden[name=unisex]").remove();
				$("#searchGoodsForm input:hidden[name=newGoods]").remove();
				var historyData = sessionStorage.getItem(document.location.href);
				if(historyData!=null){
					historyData = JSON.parse(historyData);
				}else{
					historyData = {};
				}
				if(typeof historyData.filterHtml!='undefined' && historyData.filterHtml!=''){
					//console.log('historyData.filterHtml>>>'+historyData.filterHtml);
					$("#searchGoodsForm").append(historyData.filterHtml);
					filterHtml = historyData.filterHtml;
				}
				if(typeof historyData.filterStatHtml!='undefined' && historyData.filterStatHtml!=''){
					$("#filterForm").append(historyData.filterStatHtml);
					filterStatHtml = historyData.filterStatHtml;
				}
				if(typeof historyData.totalCount!='undefined' && historyData.totalCount!=''){
					$("#totCntId").text(historyData.totalCount);
				}
				if(gagajf.isNull($("#searchGoodsForm").find("input[name=unisex]").val())){
					$("#unisex").attr('onclick','fnResetListIdx();fnFilterOption(this,\'on\');');
					$("#unisex").attr('checked', false);
				}else{
					$("#unisex").attr('onclick','fnResetListIdx();fnFilterOption(this,\'off\');');
					$("#unisex").attr('checked', true);
				}

				if(gagajf.isNull($("#searchGoodsForm").find("input[name=newGoods]").val())){
					$("#newGoods").attr('onclick','fnResetListIdx();fnFilterOption(this,\'on\');');
					$("#newGoods").attr('checked', false);
				}else{
					$("#newGoods").attr('onclick','fnResetListIdx();fnFilterOption(this,\'off\');');
					$("#newGoods").attr('checked', true);
				}
				/*if(filterPriceList.length > 0){
					let min = 0;
					let max = 0;
					var val = '';
					if(!gagajf.isNull($("#searchGoodsForm").find("input:hidden[name=priceFrom]").val())){
						min = $("#searchGoodsForm").find("input:hidden[name=priceFrom]").val();
					}
					if(!gagajf.isNull($("#searchGoodsForm").find("input:hidden[name=priceTo]").val())){
						max = $("#searchGoodsForm").find("input:hidden[name=priceTo]").val();
					}
					val = min+','+max;

					$('#filterForm input[name=price]').each(function (){
						if(val == $(this).val()){
							$(this).prop("checked",true);
						}
					});
				}*/
				fnReCheckFilterList();
				if(typeof historyData.sortingType!='undefined' && historyData.sortingType!=''){
					$("#searchGoodsForm input:hidden[name=sortingType]").val(historyData.sortingType);
					fnSortingChange(this,historyData.sortingType,'back','Mob');
				}else{
					// fnCategoryGoodsInfiniteScrollInit();
					// console.log('here*'+historyData.scroll);
					// debugger;
					fnGoodsListSearch();
					// $('html, body').animate({scrollTop: historyData.backScroll});
					// window.scrollTo(0, historyData.backScroll);
				}
			}else{
				fnCategoryGoodsInfiniteScrollInit();
				var sortingType = $("#searchGoodsForm input:hidden[name=sortingType]").val();
				if(sortingType=='BEST' || sortingType=='REVIEW'){
					fnSortingChange(this,sortingType,'','Mob');
				}else{
					fnGoodsListSearch();
				}
			}

		});

		// var iframe= document.createElement('iframe');
		// iframe.setAttribute('allowFullScreen', '');
		// iframe.setAttribute('allow', 'fullscreen');
		// var controller;
		// var player = document.getElementById('player');
		//
		// player.onload = function() {
		// 	try {
		// 		var controller = new VgControllerClient({
		// 			target_window: document.getElementById('pdThumbVideo').contentWindow
		// 			// target_window: document.getElementsByClassName('pd_mov').contentWindow
		// 		});
		// 		var playMov;
		//
		// 		controller.on('ready', function(){
		// 			//플레이어 준비 완료
		// 			controller.set_ratio('fill');
		// 			//  contain : 비율에 맞게 채웁니다.
		// 			//fill : 화면에 꽉 차게 채웁니다.
		// 			//enlargement : 세로 높이를 꽉 차게 맞춥니다. 좌우로 스크롤이 가능합니다
		// 			controller.play();
		// 		});
		// 		controller.on('done', function(){
		// 			//플레이어 재생 완료
		// 			controller.play();
		// 		});
		//
		// 	} catch(e) {
		// 		// Videogateweay Controller Library는 window.postMessage API를 이용하기 때문에
		// 		// 해당 기능을 지원하지 않는 웹브라우져에서는 동작하지 않습니다.
		// 		// 이 부분에 적절한 fail-over 코드를 추가하여 주십시요.
		// 	}
		//
		// }

		var fnDisplayTitle = function (cateNm){
			$("#htopTitle").html('');
			var tag = '';

			tag += '<span>'+cateNm+'</span>\n';
			tag += '<button class="btn_gnbs" title="서브타이틀 메뉴 열기/닫기">\n';
			tag += '	<span><i></i></span>\n';
			tag += '</button>\n';

			return tag;
		}

		var fnGetSameDepthList = function (){
			var brandGroupNo = [[${cateInfo.brandGroupNo}]];
			var cateGb =  [[${cateInfo.cateGb}]];
			var formalGb = [[${cateInfo.formalGb}]];
			let cate1No = [[${cateInfo.cate1No}]];
			let cate2No = [[${cateInfo.cate2No}]];
			let cate3No = [[${cateInfo.cate3No}]];
			let cate4No = [[${cateInfo.cate4No}]];
			let cate5No = [[${cateInfo.cate5No}]];
			let cateList = [[${cateList}]];
			let allCateList = [[${allCateList}]];
			let tag = '';
			let html = '';
			if(brandGroupNo>0){
				var brandCateList =  [[${brandCateList}]];
			}

			if(!gagajf.isNull(cate5No)){

			}else if(!gagajf.isNull(cate4No)){
				var leaf_Yn = 'N';
				$.each(cateList, function(idx,item){
					let cate2 = item.cate2List;
					$.each(cate2, function(idx2, item2){
						if(item2.cate2No == cate2No){
							$.each(item2.cate3List, function(idx3,item3){
								if(item3.cate3No == cate3No){
									tag += '<a href="javascript:void(0);" class="daps1" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ' ,' + item2.cate2No + ',' + item3.cate3No + ' ';
									if(formalGb=='G009_20'){
										tag += ' ,\'\',\'\',\''+formalGb+'\'';
									}
									tag += ' )">'+item3.cate3Nm+'</a>';
									tag += '<ul class="daps2">\n';
									tag += '<li>';
									tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ' ,' + item2.cate2No + ',' + item3.cate3No + ' ';
									if(formalGb=='G009_20'){
										tag += ' ,\'\',\'\',\''+formalGb+'\'';
									}
									tag += ' )">전체</a>';
									tag += '</li>\n';
									$.each(item3.cate4List, function(idx4, item4){
										if(item4.cate4No == cate4No){
											if(item4.leafYn == 'Y'){
												leaf_Yn = 'Y';
											}
											if(idx<1) {
												$("#htopTitle").append(fnDisplayTitle(item4.cate4Nm));
											}
											let leafTag = '';
											leafTag += '<a href="javascript:void(0);" class="on" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item4.cate1No + ', ' + item4.cate2No + ', ' + item4.cate3No + ', ' + item4.cate4No + ' ';
											if(formalGb=='G009_20'){
												leafTag += ' ,\'\',\''+formalGb+'\'';
											}
											leafTag += ');">전체</a>';
											if(item4.cate5List != null && item4.cate5List.length > 0){
												$.each(item4.cate5List, function (idx5, item5){
													leafTag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + [[${cateInfo.cateGb}]] + '\', ' + item5.cate1No + ' , ' + item5.cate2No + ', ' + item5.cate3No + ' , ' + item5.cate4No + ' , ' + item5.cate5No + ' ';
													if(formalGb=='G009_20'){
														leafTag += ' ,\''+formalGb+'\'';
													}
													leafTag += ');">'+item5.cate5Nm+'</a>';
												});
											}
											if(leaf_Yn == 'N'){
												$('#leafCateList').append(leafTag);
											}
										}
										tag += '<li ';
										if(item4.cate4No == cate4No){
											tag += ' class="on"';
										}
										tag += '>\n';
										tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item4.cate1No + ', ' + item4.cate2No + ', ' + item4.cate3No + ', ' + item4.cate4No + ' ';
										if(formalGb=='G009_20'){
											tag += ' ,\'\',\''+formalGb+'\'';
										}
										tag += ' );">'+item4.cate4Nm+'</a></li>';
									});
								}
							});
						}
					});
					tag += '</ul>\n';
				});
				if(leaf_Yn == 'N'){
					$("#cateDepth").append(tag);
				}else{
					tag = '';
					$.each(cateList, function(idx,item){
						let cate2 = item.cate2List;
						$.each(cate2, function (idx2,item2){
							if(item2.cate2No == cate2No){
								tag += '<a href="javascript:void(0);" class="daps1" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ' ,' + item2.cate2No + ' ';
								if(formalGb=='G009_20'){
									tag += ' ,\'\',\'\',\'\',\''+formalGb+'\'';
								}
								tag += ' )">'+item2.cate2Nm+'</a>';
								tag += '<ul class="daps2">\n';
								tag += '<li>';
								tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ' ,' + item2.cate2No + ' ';
								if(formalGb=='G009_20'){
									tag += ' ,\'\',\'\',\'\',\''+formalGb+'\'';
								}
								tag += ' )">전체</a>';
								tag += '</li>\n';
								$.each(item2.cate3List, function (idx3, item3){
									if(idx<1) {
										tag += '<li';
										if(item3.cate3No == cate3No){
											if(item3.leafYn == 'Y'){
												leaf_Yn = 'Y';
											}
											tag += ' class="on"';
										}
										tag += '><a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ', ' + item2.cate2No + ', ' + item3.cate3No + ' ';
										if(formalGb=='G009_20'){
											tag += ' ,\'\',\'\',\''+formalGb+'\'';
										}
										tag += ');">'+item3.cate3Nm+'</a></li>';
									}
								});
							}
						});

						$.each(cate2, function (idx2,item2){
							let leafTag = '';
							if(item2.cate2No == cate2No){
								leafTag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ', ' + item2.cate2No + ', ' + cate3No + ' ';
								if(formalGb=='G009_20'){
									leafTag += ' ,\'\',\'\',\''+formalGb+'\'';
								}
								leafTag += ');">전체</a>';
								$.each(item2.cate3List, function(idx3, item3){
									if(item3.cate3No == cate3No){
										if(idx<1) {
											$("#htopTitle").append(fnDisplayTitle(item3.cate3Nm));
										}
										if(item3.cate4List != null && item3.cate4List.length > 0){
											$.each(item3.cate4List, function (idx4, item4){
												leafTag += '<a href="javascript:void(0);"';
												if(item4.cate4No == cate4No){
													leafTag += ' class="on"';
												}
												leafTag += ' onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + [[${cateInfo.cateGb}]] + '\', ' + item4.cate1No + ' , ' + item4.cate2No + ', ' + item4.cate3No + ' , ' + item4.cate4No + ' ';
												if(formalGb=='G009_20'){
													leafTag += ' ,\'\',\''+formalGb+'\'';
												}
												leafTag += ');">'+item4.cate4Nm+'</a>';
											});
											// $('#leafCateList').append(leafTag);
										}
									}
								});
								$('#leafCateList').append(leafTag);
							}
						});
						tag += '</ul>\n';
					});
					$("#cateDepth").append(tag);
				}
			}else if(!gagajf.isNull(cate3No)){
				var leaf_Yn = 'N';
				$.each(cateList, function(idx,item){
					let cate2 = item.cate2List;
					$.each(cate2, function (idx2,item2){
						if(item2.cate2No == cate2No){
							tag += '<a href="javascript:void(0);" class="daps1" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ' ,' + item2.cate2No + ' ';
							if(formalGb=='G009_20'){
								tag += ' ,\'\',\'\',\'\',\''+formalGb+'\'';
							}
							tag += ' )">'+item2.cate2Nm+'</a>';
							tag += '<ul class="daps2">\n';
							tag += '<li>';
							tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ' ,' + item2.cate2No + ' ';
							if(formalGb=='G009_20'){
								tag += ' ,\'\',\'\',\'\',\''+formalGb+'\'';
							}
							tag += ' )">전체</a>';
							tag += '</li>\n';
							$.each(item2.cate3List, function (idx3, item3){
								if(idx<1) {
									tag += '<li';
									if(item3.cate3No == cate3No){
										if(item3.leafYn == 'Y'){
											leaf_Yn = 'Y';
										}
										tag += ' class="on"';
									}
									tag += '><a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ', ' + item2.cate2No + ', ' + item3.cate3No + ' ';
									if(formalGb=='G009_20'){
										tag += ' ,\'\',\'\',\''+formalGb+'\'';
									}
									tag += ');">'+item3.cate3Nm+'</a></li>';
								}
							});
						}
					});

					$.each(cate2, function (idx2,item2){
						let leafTag = '';
						if(item2.cate2No == cate2No){
							leafTag += '<a href="javascript:void(0);" class="on" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ', ' + item2.cate2No + ', ' + cate3No + ' ';
							if(formalGb=='G009_20'){
								leafTag += ' ,\'\',\'\',\''+formalGb+'\'';
							}
							leafTag += ');">전체</a>';
							$.each(item2.cate3List, function(idx3, item3){
								if(item3.cate3No == cate3No){
									if(idx<1) {
										$("#htopTitle").append(fnDisplayTitle(item3.cate3Nm));
									}
									if(item3.cate4List != null && item3.cate4List.length > 0){
										$.each(item3.cate4List, function (idx4, item4){
											leafTag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + [[${cateInfo.cateGb}]] + '\', ' + item4.cate1No + ' , ' + item4.cate2No + ', ' + item4.cate3No + ' , ' + item4.cate4No + ' ';
											if(formalGb=='G009_20'){
												leafTag += ' ,\'\',\''+formalGb+'\'';
											}
											leafTag += ');">'+item4.cate4Nm+'</a>';
										});
										// $('#leafCateList').append(leafTag);
									}
								}
							});
							if(leaf_Yn == 'N'){
								$('#leafCateList').append(leafTag);
							}
						}
					});
					tag += '</ul>\n';
				});
				if(leaf_Yn == 'N'){
					$("#cateDepth").append(tag);
				}else{
					tag = '';
					$.each(cateList, function(idx,item){
						tag += '<a href="javascript:void(0);" class="daps1" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item.cate1No + ' ';
						if(formalGb=='G009_20'){
							tag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
						}
						tag += ' )">'+item.cate1Nm+'</a>';
						tag += '<ul class="daps2">\n';
						tag += '<li>';
						tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item.cate1No + ' ';
						if(formalGb=='G009_20'){
							tag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
						}
						tag += ' )">전체</a>';
						tag += '</li>\n';
						$.each(item.cate2List, function (idx2,item2){
							if(item2.cate2No == cate2No){
								if(idx<1) {
									$("#htopTitle").append(fnDisplayTitle(item2.cate2Nm));
								}
								if(item2.cate3List != null && item2.cate3List.length > 0){
									let leafTag = '';
									leafTag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ', ' + item2.cate2No + ' ';
									if(formalGb=='G009_20'){
										leafTag += ' ,\'\',\'\',\'\',\''+formalGb+'\'';
									}
									leafTag += ');">전체</a>';
									$.each(item2.cate3List, function (idx3, item3){
										leafTag += '<a href="javascript:void(0);" ';
										if(cate3No == item3.cate3No){
											leafTag += 'class="on"';
										}
										leafTag += 'onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + [[${cateInfo.cateGb}]] + '\', ' + item3.cate1No + ' , ' + item3.cate2No + ', ' + item3.cate3No + ' ';
										if(formalGb=='G009_20'){
											leafTag += ' ,\'\',\'\',\''+formalGb+'\'';
										}
										leafTag += ');">'+item3.cate3Nm+'</a>';
									});
									$('#leafCateList').append(leafTag);
								}
							}
							if(idx<1) {
								tag += '<li';
								if(item2.cate2No == cate2No){
									tag += ' class="on"';
								}
								tag += '><a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ', ' + item2.cate2No + ' ';
								if(formalGb=='G009_20'){
									tag += ' ,\'\',\'\',\'\',\''+formalGb+'\'';
								}
								tag += ');">'+item2.cate2Nm+'</a></li>';
							}

						});
						tag += '</ul>\n';
					});
					$("#cateDepth").append(tag);
				}
			}else if(!gagajf.isNull(cate2No)){
				var leaf_Yn = 'N';
				$.each(cateList, function(idx,item){
					tag += '<a href="javascript:void(0);" class="daps1" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item.cate1No + ' ';
					if(formalGb=='G009_20'){
						tag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
					}
					tag += ' )">'+item.cate1Nm+'</a>';
					tag += '<ul class="daps2">\n';
					tag += '<li>';
					tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item.cate1No + ' ';
					if(formalGb=='G009_20'){
						tag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
					}
					tag += ' )">전체</a>';
					tag += '</li>\n';
					$.each(item.cate2List, function (idx2,item2){
						if(item2.cate2No == cate2No){
							if(item2.leafYn == 'Y'){
								leaf_Yn = 'Y';
							}
							if(idx<1) {
								$("#htopTitle").append(fnDisplayTitle(item2.cate2Nm));
							}
							if(item2.cate3List != null && item2.cate3List.length > 0){
								let leafTag = '';
								leafTag += '<a href="javascript:void(0);" class="on" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ', ' + item2.cate2No + ' ';
								if(formalGb=='G009_20'){
									leafTag += ' ,\'\',\'\',\'\',\''+formalGb+'\'';
								}
								leafTag += ');">전체</a>';
								$.each(item2.cate3List, function (idx3, item3){
									leafTag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + [[${cateInfo.cateGb}]] + '\', ' + item3.cate1No + ' , ' + item3.cate2No + ', ' + item3.cate3No + ' ';
									if(formalGb=='G009_20'){
										leafTag += ' ,\'\',\'\',\''+formalGb+'\'';
									}
									leafTag += ');">'+item3.cate3Nm+'</a>';
								});
								if(leaf_Yn == 'N'){
									$('#leafCateList').append(leafTag);
								}
							}
						}
						if(idx<1) {
							tag += '<li';
							if(item2.cate2No == cate2No){
								tag += ' class="on"';
							}
							tag += '><a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item2.cate1No + ', ' + item2.cate2No + ' ';
							if(formalGb=='G009_20'){
								tag += ' ,\'\',\'\',\'\',\''+formalGb+'\'';
							}
							tag += ');">'+item2.cate2Nm+'</a></li>';
						}

					});
					tag += '</ul>\n';
				});
				if(leaf_Yn == 'N'){
					$("#cateDepth").append(tag);
				}else{
					tag = '';
					if(formalGb=='G009_20'){
						tag += '<a class="daps1" href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',\'\',\'\',\'\',\'\',\'\',\''+formalGb+'\')";>전체</a>\n';
						tag += '<ul class="daps2">\n';
					}
					$.each(cateList, function(idx,item){
						$.each(allCateList, function (allIdx, allItem){
							if(brandGroupNo > 0){
								if(item.cate1No==allItem.cate1No){
									if(idx<1) {
										$("#htopTitle").append(fnDisplayTitle(item.cate1Nm));
									}
									if(idx<1) {
										tag += '<li';
										if(item.cate1No==allItem.cate1No){
											tag += ' class="on"';
										}
										tag += '><a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item.cate1No + ' ';
										if(formalGb=='G009_20'){
											tag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
										}
										tag += ');">'+item.cate1Nm+'</a></li>';
									}
								}
							}else{
								if(item.cate1No==allItem.cate1No){
									if(idx<1) {
										$("#htopTitle").append(fnDisplayTitle(item.cate1Nm));
									}
								}
								if(idx<1) {
									tag += '<li';
									if(item.cate1No==allItem.cate1No){
										tag += ' class="on"';
									}
									tag += '><a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + allItem.cate1No + ' ';
									if(formalGb=='G009_20'){
										tag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
									}
									tag += ');">'+allItem.cate1Nm+'</a></li>';
								}
							}
						});

						if(item.cate2List != null && item.cate2List.length > 0){
							let leafTag = '';
							leafTag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\', \'\' ';
							if(formalGb=='G009_20'){
								leafTag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
							}
							leafTag += ');">전체</a>';
							$.each(item.cate2List, function (idx, item){
								leafTag += '<a href="javascript:void(0);"';
								if(item.cate2No == cate2No){
									leafTag += ' class="on"';
								}
								leafTag += ' onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + [[${cateInfo.cateGb}]] + '\', ' + item.cate1No + ' , ' + item.cate2No + ' ';
								if(formalGb=='G009_20'){
									leafTag += ' ,\'\',\'\',\'\',\''+formalGb+'\'';
								}
								leafTag += ');">'+item.cate2Nm+'</a>';
							});
							$('#leafCateList').append(leafTag);
						}
					});
					if(formalGb=='G009_20'){
						tag += '</ul>\n';
					}
					$("#cateDepth").append(tag);
				}
			}else if(!gagajf.isNull(cate1No)){
				if(brandGroupNo > 0){
					tag += '<a class="daps1" href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',\'\',\'\',\'\',\'\',\'\',\'\')";>전체</a>\n';
					tag += '<ul class="daps2">\n';
				}
				if(formalGb=='G009_20'){
					tag += '<a class="daps1" href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',\'\',\'\',\'\',\'\',\'\',\''+formalGb+'\')";>전체</a>\n';
					tag += '<ul class="daps2">\n';
				}

				if(brandGroupNo > 0){
					$.each(cateList, function(idx,item){
						$.each(allCateList, function (allIdx, allItem){
							if(item.cate1No==allItem.cate1No){
								if(idx<1) {
									$("#htopTitle").append(fnDisplayTitle(item.cate1Nm));
								}
								tag += '<li';
								if(item.cate1No==cate1No){
									tag += ' class="on"';
								}
								tag += '><a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + item.cate1No + ' ';
								if(formalGb=='G009_20'){
									tag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
								}
								tag += ');">'+item.cate1Nm+'</a></li>';
							}
						});
						let leafTag = '';
						if(idx<1){
							leafTag += '<a href="javascript:void(0);" class="on" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\', \'\' ';
							if(formalGb=='G009_20'){
								leafTag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
							}
							leafTag += ');">전체</a>';
						}

						if(item.cate2List != null && item.cate2List.length > 0){
							$.each(item.cate2List, function (idx, item){
								leafTag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + [[${cateInfo.cateGb}]] + '\', ' + item.cate1No + ' , ' + item.cate2No + ' ';
								if(formalGb=='G009_20'){
									leafTag += ' ,\'\',\'\',\'\',\''+formalGb+'\'';
								}
								leafTag += ');">'+item.cate2Nm+'</a>';
							});
						}
						$('#leafCateList').append(leafTag);
					});
				}else{
					$.each(cateList, function(idx,item){
						$.each(allCateList, function (allIdx, allItem){
							if(item.cate1No==allItem.cate1No){
								if(idx<1) {
									$("#htopTitle").append(fnDisplayTitle(item.cate1Nm));
								}
							}
							if(idx<1) {
								tag += '<li';
								if(item.cate1No==allItem.cate1No){
									tag += ' class="on"';
								}
								tag += '><a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + allItem.cate1No + ' ';
								if(formalGb=='G009_20'){
									tag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
								}
								tag += ');">'+allItem.cate1Nm+'</a></li>';
							}
						});

						if(item.cate2List != null && item.cate2List.length > 0){
							let leafTag = '';
							leafTag += '<a href="javascript:void(0);" class="on" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\', \'\' ';
							if(formalGb=='G009_20'){
								leafTag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
							}
							leafTag += ');">전체</a>';
							$.each(item.cate2List, function (idx, item){
								leafTag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + [[${cateInfo.cateGb}]] + '\', ' + item.cate1No + ' , ' + item.cate2No + ' ';
								if(formalGb=='G009_20'){
									leafTag += ' ,\'\',\'\',\'\',\''+formalGb+'\'';
								}
								leafTag += ');">'+item.cate2Nm+'</a>';
							});
							$('#leafCateList').append(leafTag);
						}
					});
				}

				if(formalGb=='G009_20'){
					tag += '</ul>\n';
				}
				$("#cateDepth").append(tag);
			}else{
				let tag = '';
				if(brandGroupNo > 0 ){
					$("#htopTitle").text('전체');
					var titleTag = '';
					titleTag += '<button class="btn_gnbs" title="서브타이틀 메뉴 열기/닫기">\n';
					titleTag += '	<span><i></i></span>\n';
					titleTag += '</button>\n';
					$("#htopTitle").append(titleTag);

					tag += '<ul class="daps2">\n';
					tag += '<li class="on">';
					tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',\'\'';
					if(formalGb=='G009_20'){
						tag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
					}
					tag += ' )">전체</a>';
					tag += '</li>\n';
					tag += '</ul>\n';
					// $("#cateDepth").append(tag);
				}
				if(formalGb == 'G009_20'){
					$("#htopTitle").text('아울렛');
					tag += '<ul class="daps2">\n';
					tag += '<li>';
					tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',\'\'';
					if(formalGb=='G009_20'){
						tag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
					}
					tag += ' )">전체</a>';
					tag += '</li>\n';
					tag += '</ul>\n';
					$("#cateDepth").append(tag);
				}
				let leafTag = '';
				leafTag += '<a href="javascript:void(0);" class="on" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\', \'\' ';
				if(formalGb=='G009_20'){
					leafTag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
				}
				leafTag += ');">전체</a>';
				$.each(allCateList, function (allIdx, allItem){
					$.each(cateList, function(idx,item){
						if(allItem.cate1No == item.cate1No){
							leafTag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + [[${cateInfo.cateGb}]] + '\', ' + item.cate1No + ' ';
							if(formalGb=='G009_20'){
								leafTag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
							}
							leafTag += ');">'+item.cate1Nm+'</a>';

							if(brandGroupNo > 0 ){
								tag += '<li>';
								tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + [[${cateInfo.cateGb}]] + '\', ' + item.cate1No + ' ';
								if(formalGb=='G009_20'){
									tag += ' ,\'\',\'\',\'\',\'\',\''+formalGb+'\'';
								}
								tag += ');">'+item.cate1Nm+'</a>';
								tag += '</li>';
							}
						}
					});
				});
				$('#leafCateList').append(leafTag);
				if(brandGroupNo > 0 ){
					$("#cateDepth").append(tag);
				}
			}
		}

		var fnResetListIdx = function (){
			gagaInfiniteScroll.pageStatus.loadPage = 0;
			gagaInfiniteScroll.pageStatus.pageNum = [];
			listIdx = 1;
			$('#endPage').hide();
		}

	</script>

	<script>
		//(진행 중)
		/* 210427_수정 : err 이미지 스크립트 */
		// function noneImg(noneSrc){
		// 	$(noneSrc).parents('.itemPic').css({'background':'url(/images/pc/thumb/bg_item_none.png)'});
		// 	$(noneSrc).css({'opacity':'0'});
		// 	//$(noneSrc).attr("src", no_src);
		// }
	</script>


</th:block>
</body>
</html>
