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

<th:block layout:fragment="content">
	<div id="container" class="container dp">
		<div class="breadcrumb">
			<ul id="navArea">
				<li class="bread_home" id="idHome"><a href="javascript:void(0);" id="navHome">홈</a></li>
				<li class="bread_2depth" id="navNm"></li>
			</ul>
		</div>
		<div class="wrap">
			<div class="content dp_list"> <!-- 페이지특정 클래스 = dp_list -->
				<div class="cont_head">
					<div>
						<h3 id="formTitle"></h3>
					</div>
				</div>
				<div class="lnb">
					<div class="lnb_tit">
						<h3>카테고리</h3>
					</div>
					<div class="lnb_category">
						<ul class="category" id="ulAllCate">

						</ul>
					</div>
				</div>
				<div class="cont">
					<form id="filterForm">
						<div class="cont_body">
							<div class="filter_list">
								<!-- 1depth -->
								<ul>
									<li data-id="tap02" th:if="${filterBrandList!=null and !filterBrandList.empty}">
										<a href="javascript:void(0)">브랜드</a>
									</li>
									<li data-id="tap03" th:if="${filterSizeList!=null and !filterSizeList.empty}">
										<a href="javascript:void(0)">사이즈</a>
									</li>
									<li data-id="tap04" th:if="${filterPriceList!=null and !filterPriceList.empty}">
										<a href="javascript:void(0)">가격</a>
									</li>
									<li data-id="tap05">
										<a href="javascript:void(0)">할인율</a>
									</li>
									<li data-id="tap06" th:if="${filterAgeList!=null and !filterAgeList.empty}">
										<a href="javascript:void(0)">연령</a>
									</li>
									<li data-id="tap07" th:if="${filterSeasonList!=null and !filterSeasonList.empty}">
										<a href="javascript:void(0)">시즌</a>
									</li>
									<li data-id="tap08" th:if="${filterColorList!=null and !filterColorList.empty}">
										<a href="javascript:void(0)">컬러</a>
									</li>
									<li data-id="tap09" th:if="${filterBenefitList!=null and !filterBenefitList.empty}">
										<a href="javascript:void(0)">혜택</a>
									</li>
								</ul>
								<div class="form_field">
									<div>
										<input id="sexGb" type="checkbox" onclick="fnFilterOption(this,'on');"><label for="sexGb"> <span>남여 공용만 보기</span> </label>
									</div>
									<div>
										<input id="newProd" type="checkbox" onclick="fnFilterOption(this,'on');"><label for="newProd"> <span>신상품만 보기</span> </label>
									</div>
								</div>
							</div>
							<div class="filter_content">
								<!-- 브랜드 -->
								<div class="sort tap02" th:if="${filterBrandList!=null and !filterBrandList.empty}" id="brandFilterDiv">
									<ul>
										<th:block th:each="filterBrandData, filterBrandStat : ${filterBrandList}">
											<li>
												<label class="brand_btn">
													<input type="checkbox" group="filterValue" th:id="${'chkFilterBrand'+filterBrandStat.count}" name="brand" th:value="${filterBrandData.filterCd}" th:data-id="${filterBrandData.filterNm}" onclick="filterSel(this,'brand','off');"><span th:text="${filterBrandData.filterNm}"></span>
												</label>
											</li>
										</th:block>
									</ul>
									<a href="javascript:void(0)" class="tap_close">delete-btn</a>
								</div>
								<!-- //브랜드 -->
								<!-- 사이즈 -->
								<div class="sort tap03" th:if="${filterSizeList!=null and !filterSizeList.empty}" id="sizeFilterDiv">
									<ul>
										<li id="sizeLi1">
											<strong>상의</strong>
											<th:block th:each="filterSizeData, filterSizeStat : ${filterSizeList}" th:if="${filterSizeData.filterCd == 'T'}">
												<label class="size_btn">
													<input type="checkbox" group="filterValue" th:id="${'chkFilterTSize'+filterSizeStat.count}" name="size" th:vale="${filterSizeData.filterNm}" th:data-id="${filterSizeData.filterNm}" onclick="filterSel(this,'size','off','1');"><span th:text="${filterSizeData.filterNm}">80</span>
												</label>
											</th:block>
										</li>
										<li id="sizeLi2">
											<strong>하의</strong>
											<th:block th:each="filterSizeData, filterSizeStat : ${filterSizeList}" th:if="${filterSizeData.filterCd == 'B'}">
												<label class="size_btn">
													<input type="checkbox" group="filterValue" th:id="${'chkFilterBSize'+filterSizeStat.count}" name="size" th:vale="${filterSizeData.filterNm}" th:data-id="${filterSizeData.filterNm}" onclick="filterSel(this,'size','off','2');"><span th:text="${filterSizeData.filterNm}">80</span>
												</label>
											</th:block>
										</li>
										<li id="sizeLi3">
											<strong>신발</strong>
											<th:block th:each="filterSizeData, filterSizeStat : ${filterSizeList}" th:if="${filterSizeData.filterCd == 'S'}">
												<label class="size_btn">
													<input type="checkbox" group="filterValue" th:id="${'chkFilterSSize'+filterSizeStat.count}" name="size" th:vale="${filterSizeData.filterNm}" th:data-id="${filterSizeData.filterNm}" onclick="filterSel(this,'size','off','3');"><span th:text="${filterSizeData.filterNm}">80</span>
												</label>
											</th:block>
										</li>
									</ul>
									<a href="javascript:void(0)" class="tap_close">delete-btn</a>
								</div>
								<!-- //사이즈 -->
								<!-- 가격 -->
								<div class="sort tap04" id="priceFilterDiv">
									<div class="range">
										<input type="text" class="js-range-slider01" name="" value="" />
										<input type="hidden" id="price_input_from" value="0"/>
										<input type="hidden" id="price_input_to" value="0"/>
									</div>
									<a href="javascript:void(0)" class="tap_close">delete-btn</a>
								</div>
								<!-- //가격 -->
								<!-- 할인율 -->
								<div class="sort tap05" id="dcrateFilterDiv">
									<ul style="display:none;">
										<li><input type="checkbox" id="percent01" name="range" value="0"><label for="percent01"><span></span><span>0%</span></label></li>
										<li><input type="checkbox" id="percent02" name="range" value="10"><label for="percent02"><span></span><span>10%</span></label></li>
										<li><input type="checkbox" id="percent03" name="range" value="20"><label for="percent03"><span></span><span>20%</span></label></li>
										<li><input type="checkbox" id="percent04" name="range" value="30"><label for="percent04"><span></span><span>30%</span></label></li>
										<li><input type="checkbox" id="percent05" name="range" value="40"><label for="percent05"><span></span><span>40%</span></label></li>
										<li><input type="checkbox" id="percent06" name="range" value="50"><label for="percent06"><span></span><span>50%</span></label></li>
										<li><input type="checkbox" id="percent07" name="range" value="60"><label for="percent07"><span></span><span>60%</span></label></li>
										<li><input type="checkbox" id="percent08" name="range" value="70"><label for="percent08"><span></span><span>70%</span></label></li>
										<li><input type="checkbox" id="percent09" name="range" value="80"><label for="percent09"><span></span><span>80%</span></label></li>
										<li><input type="checkbox" id="percent10" name="range" value="100"><label for="percent10"><span></span><span>100%</span></label></li>
									</ul>
									<div class="range">
										<input type="text" class="js-range-slider02" name="" value="" />
										<input type="hidden" id="dcrate_input_from" value="0"/>
										<input type="hidden" id="dcrate_input_to" value="0"/>
									</div>
									<a href="javascript:void(0)" class="tap_close">delete-btn</a>
								</div>
								<!-- //할인율 -->
								<!-- 연령 -->
								<div class="sort tap06" th:if="${filterAgeList!=null and !filterAgeList.empty}" id="ageFilterDiv">
									<ul>
										<th:block th:each="filterAgeData, filterAgeStat : ${filterAgeList}">
											<li>
												<label class="Age_btn">
													<input type="checkbox" group="filterValue" th:id="${'chkFilterAge'+filterAgeStat.count}" name="age" th:value="${filterAgeData.filterCd}" th:data-id="${filterAgeData.filterNm}" onclick="filterSel(this,'age','off');"><span th:text="${filterAgeData.filterNm}">베이비(0~18개월)</span>
												</label>
											</li>
										</th:block>
									</ul>
									<a href="javascript:void(0)" class="tap_close">delete-btn</a>
								</div>
								<!-- //연령 -->
								<!-- 시즌 -->
								<div class="sort tap07" th:if="${filterSeasonList!=null and !filterSeasonList.empty}" id="seasonFilterDiv">
									<ul>
										<th:block th:each="filterSeasonData, filterSeasonStat : ${filterSeasonList}">
											<li>
												<label class="Season_btn">
													<input type="checkbox" group="filterValue"  th:id="${'chkFilterSeason'+filterSeasonStat.count}" name="season" th:value="${filterSeasonData.filterCd}" th:data-id="${filterSeasonData.filterNm}" onclick="filterSel(this,'season','off');"><span th:text="${filterSeasonData.filterNm}">봄</span>
												</label>
											</li>
										</th:block>
									</ul>
									<a href="javascript:void(0)" class="tap_close">delete-btn</a>
								</div>
								<!-- //시즌 -->
								<!-- 컬러 -->
								<div class="sort tap08" th:if="${filterColorList!=null and !filterColorList.empty}" id="colorFilterDiv">
									<ul>
										<th:block th:each="filterColorData, filterColorStat : ${filterColorList}">
											<li>
												<label class="color-check">
													<input type="checkbox" group="filterValue" th:id="${'chkFilterColor'+filterColorStat.count}" name="color" th:value="${filterColorData.filterNm}" th:data-id="${filterColorData.filterNm.replace('#','')}" onclick="filterSel(this,'color','off');">
													<span class="pdColor-color" th:if="${filterColorData.filterNm=='#FFFFFF'}" th:style="${'background-color:'+filterColorData.filterNm+';'+' border:1px solid #aaa;'}" th:value="${filterColorData.filterNm}"></span>
													<span class="pdColor-color" th:if="${filterColorData.filterNm!='#FFFFFF'}" th:style="${'background-color:'+filterColorData.filterNm}" th:value="${filterColorData.filterNm}"></span>
												</label>
											</li>
										</th:block>
									</ul>
									<a href="javascript:void(0)" class="tap_close">delete-btn</a>
								</div>
								<!-- //컬러 -->
								<!-- 혜택 -->
								<div class="sort tap09" th:if="${filterBenefitList!=null and !filterBenefitList.empty}" id="benefitFilterDiv">
									<ul>
										<th:block th:each="filterBenefitData, filterBenefitStat : ${filterBenefitList}">
											<li>
												<label class="Benefits_btn">
													<input type="checkbox" group="filterValue" th:id="${'chkFilterBenefits'+filterBenefitStat.count}" name="benefit" th:value="${filterBenefitData.filterCd}" th:data-id="${filterBenefitData.filterNm}" onclick="filterSel(this,'benefit','off');"><span th:text="${filterBenefitData.filterNm}"></span>
												</label>
											</li>
										</th:block>
									</ul>
									<a href="javascript:void(0)" class="tap_close">delete-btn</a>
								</div>
								<!-- //혜택 -->
								<!-- 필터 -->
								<div class="fillter">
									<div class="fillter_box" id="filterData">
									</div>
									<button type="button" class="fillter_reset" onclick="fnFilterReset();"><span>전체 초기화</span></button>
								</div>
								<!-- //필터 -->
							</div>
							<div class="list_content"> <!-- 데이터 없을시 클래스 nodata 추가 -->
								<div class="list_defult">
									<div>
										<p>선택하신 조건에 맞는 상품이 없습니다.<br>필터를 변경해 보세요.</p>
									</div>
									<div class="ui_row">
										<button type="button" class="btn btn_default btn_md"><span>선택한 필터 초기화</span></button>
									</div>
								</div>
								<div class="count_wrap">
									<div>
										<p><span id="totCntId"></span>개의 상품</p>
									</div>
									<div>
										<ul id="sortArea">
											<li>
												<a href="javascript:void(0);" class="on" onclick="fnSortList(this,'new');">최신상품순</a>
											</li>
											<li>
												<a href="javascript:void(0);" onclick="fnSortList(this,'best');">인기상품순</a>
											</li>
											<li>
												<a href="javascript:void(0);" onclick="fnSortList(this,'review');">리뷰 많은순</a>
											</li>
										</ul>
									</div>
								</div>

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

								<div class="itemsGrp" id="listBox">

								</div>

							</div>
							<div class="list_content">
								<div class="list_defult" id="endPage">
									<div>
										<p>마지막 페이지 입니다.</p>
									</div>
								</div>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<form id="searchGoodsForm" name="searchGoodsForm">
		<input type="hidden" name="pageNo" id="pageNo" value ="1"/>
		<input type="hidden" name="pageSize" value ="30"/>
		<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}"/>
		<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="sortGb" value="new"/>
	</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">
		/*<![CDATA[*/
		var filterPriceList = [[${filterPriceList}]];
		var custom_values = [];
		var custom_values02  = [];
		var currUrl = document.location.href;

		// 컨텐츠 호출
		$(document).ready( function() {
			//가격 슬라이드
			//var custom_values = ['9,000원', '230,000원', '487,000원', '700,000원', '1,360,000원', '1,799,000원'];
			if(!gagajf.isNull(filterPriceList)){

				$.each(filterPriceList, function (priceIdx, priceItem){
					custom_values[priceIdx] = priceItem.filterNm;
				});

				var my_from = custom_values.indexOf(custom_values[0]); //custom_values.indexOf('9,000원');
				var my_to = custom_values.indexOf(custom_values[5]); //custom_values.indexOf('230,000원');
				var minValue = custom_values[0];
				var maxValue = custom_values[5];

				$(".dp .js-range-slider01, .sch_result .js-range-slider01").ionRangeSlider({
					type: "double",
					min: minValue,
					max: maxValue,
					from: my_from,
					to: my_to,
					grid: true,
					skin: "round",
					postfix: "원",
					prettify_separator: ",",
					values: custom_values,
					min_interval: 1,
					// onStart : function(data){
					// 	fnCheckPrice(data);
					// },
					// onChange : fnCheckPrice,
					onFinish : function(data){
						fnCheckPrice(data);
					}
				});
			}

			//할인율
			custom_values02 = ['0%', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'];
			var my_from02 = custom_values02.indexOf('0%');
			var my_to02 = custom_values02.indexOf('100%');

			$(".dp .js-range-slider02, .sch_result .js-range-slider02").ionRangeSlider({
				type: "double",
				min: 0,
				max: 100,
				from: my_from02,
				to: my_to02,
				grid: true,
				skin: "round",
				postfix: "%",
				prettify_separator: ",",
				values: custom_values02,
				min_interval: 1,
				// onStart : function(data){
				// 	fnCheckDcRate(data);
				// },
				// onChange : fnCheckDcRate,
				onFinish : function (data){
					fnCheckDcRate(data);
				}
			});

			fnCreateCategoryList();
		});

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

			if(thisId == 'sexGb'){
				if(stat=='on'){
					$(obj).attr('onclick','fnFilterOption(this,\'off\');');
					tag += '<input type="hidden" name="sexGb" value="G007_Z"/>\n';
					$("#searchGoodsForm").append(tag);
				}else{
					$(obj).attr('onclick','fnFilterOption(this,\'on\');');
					$("#searchGoodsForm input:hidden[name=sexGb]").remove();
				}
			}else{
				if(stat=='on'){
					$(obj).attr('onclick','fnFilterOption(this,\'off\');');
					tag += '<input type="hidden" name="newProd" value="40"/>\n';
					$("#searchGoodsForm").append(tag);
				}else{
					$(obj).attr('onclick','fnFilterOption(this,\'on\');');
					$("#searchGoodsForm input:hidden[name=newProd]").remove();
				}
			}
			fnCategoryGoodsInfiniteScrollInit();
			fnGoodsListSearch();
		}

		// 필터 가격 확인
		var fnCheckPrice = function (data){
			$("#priceSpan").remove();
			$("#searchGoodsForm input:hidden[name=priceRow]").remove();
			$("#searchGoodsForm input:hidden[name=priceHigh]").remove();
			let min = data.from;
			let max = data.to;
			// console.log('Price from>>'+custom_values[min]);
			// console.log('Price to>>'+custom_values[max]);
			$("#price_input_from").val(custom_values[0]);
			$("#price_input_to").val(custom_values[5]);

			fnFilterSlider('price' , custom_values[min].addComma(), custom_values[max].addComma());
		}

		// 필터 할인율 확인
		var fnCheckDcRate = function (data){
			$("#dcrateSpan").remove();
			$("#searchGoodsForm input:hidden[name=dcrateRow]").remove();
			$("#searchGoodsForm input:hidden[name=dcrateHigh]").remove();
			let min = data.from;
			let max = data.to;
			$("#price_input_from").val(0);
			$("#price_input_to").val(100);

			fnFilterSlider('dcrate' , custom_values02[min].replace('%',''), custom_values02[max].replace('%',''));
		}

		var fnFilterReset = function (){
			document.location.href = currUrl;
			// $("#searchGoodsForm input:hidden[name=brandSearch]").remove();
			// $("#searchGoodsForm input:hidden[name=sizeSearch]").remove();
			// $("#searchGoodsForm input:hidden[name=priceRow]").remove();
			// $("#searchGoodsForm input:hidden[name=priceHigh]").remove();
			// $("#searchGoodsForm input:hidden[name=dcrateRow]").remove();
			// $("#searchGoodsForm input:hidden[name=dcrateHigh]").remove();
			// $("#searchGoodsForm input:hidden[name=seasonSearch]").remove();
			// $("#searchGoodsForm input:hidden[name=colorSearch]").remove();
			// $("#searchGoodsForm input:hidden[name=benefitSearch]").remove();
		}

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

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

		var fnDrawInfiniteScrollData = function (result){
			let totalCnt = result.totalCnt;
			$("#totCntId").text(totalCnt.addComma());
			gagaInfiniteScroll.pageStatus.totalCount = result.totalCnt;

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

		var fnCreateCategoryList = function (){
			let actionUrl = '';
			let brandGroupNo = [[${cateInfo.brandGroupNo}]];
			if(gagajf.isNull(brandGroupNo) || brandGroupNo == 0){
				actionUrl = '/display/gnb/tab/list';
			}else{
				actionUrl = '/display/brand/cate/list?brandGroupNo=' + [[${cateInfo.brandGroupNo}]];
			}
			
			$.getJSON(actionUrl
				, function(result, status) {
					//if (status == 'success') {
					if (result.length > 0) {
						let formalGb = [[${cateInfo.formalGb}]];
						let cateGb = 'G032_101';
						let navNm = '';
						$('#ulAllCate').html('');
						if(formalGb=='G009_20'){
							$("#navNm").hide();
							$('#ulAllCate').append('<li><a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\''+cateGb+'\',\'\',\'\',\'\',\'\',\'\',\''+formalGb+'\');">전체</a></li>\n');
							navNm += '<li class="bread_2depth" id="navNm">아울렛</li><li class="bread_2depth" id="navNm1">전체</li>';
						}else{
							$("#navNm").hide();
							$('#ulAllCate').append('<li><a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\''+cateGb+'\');">전체</a></li>\n');
							navNm += '<li class="bread_2depth" id="navNm1">전체</li>';
						}
						
						if(gagajf.isNull($("#searchGoodsForm").find("[name=cate1No]").val())){
							$("#navArea").append(navNm);
							$("#formTitle").text('전체');
						}

						let allCate = [[${allCateList}]];
						if(gagajf.isNull(brandGroupNo) || brandGroupNo == 0){
							$.each(result, function(idx, item) {
								if (item.contentsType == 'C') { // 컨텐츠유형:카테고리
									$.each(allCate, function(allCateIdx, allCateItem) {
										if (item.cate1No == allCateItem.cate1No) {
											$('#ulAllCate').append(fnGetCategoryList(allCateItem));
										}
									});
								}
							});
						}else{
							$.each(result, function(idx, item) {
								$.each(allCate, function(brandCateIdx, brandCateItem) {
									if (item.cate1No == brandCateItem.cate1No) {
										$('#ulAllCate').append(fnGetBrandCategoryList(item));
									}
								});
							});
						}
					}
					//}
				});
		}
		
		let fnGetBrandCategoryList = function (cate1){
			var brandGroupNo = [[${cateInfo.brandGroupNo}]];
			var cateGb =  [[${cateInfo.cateGb}]];
			var formalGb = [[${cateInfo.formalGb}]];
			var cate1No = [[${cateInfo.cate1No}]];
			var cate2No = [[${cateInfo.cate2No}]];
			var cate3No = [[${cateInfo.cate3No}]];
			var cate4No = [[${cateInfo.cate4No}]];
			
			var navNm = "";
			var formTitle = "";
			let tag = '';
			
			console.log('cate1No>>>'+cate1No);
		
			if(cate1 != null){
				tag += '<li';
				if (cate1.cate1No == cate1No) {
					tag += ' class="on"';
				}
				tag += '>\n';
				tag += '	<a href="javascript:javascript:void(0);"';
				if (cate1.cate1No == cate1No && cate2No == null) {
					tag += ' class="on"';
					formTitle = cate1.cate1Nm;
					$("#formTitle").text(formTitle);
					$("#navNm").hide();
					navNm += '<li class="bread_2depth" id="navNm1">' + cate1.cate1Nm + '</li>';
					$("#navHome").attr('onclick', 'cfnGoToBrandMain(' + brandGroupNo + ');');
					$("#navArea").append(navNm);
				}else if(cate1.cate1No == cate1No && cate3No == null){
					$("#navNm").hide();
					navNm += '<li class="bread_2depth" id="navNm1">' + cate1.cate1Nm + '</li>';
					$("#navArea").append(navNm);
				}else if(cate3No != null){
					$("#navNm").hide();
				}
				tag += '	onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ');" >' + cate1.cate1Nm + '</a>\n';
				
				
				if (cate1.leafYn == 'N' && cate1.cate2List.length > 0) {
					tag += '<div class="sub_cate" style="display: block;">\n';
					tag += '	<ul>\n';
					$.each(cate1.cate2List, function (idx2, cate2) {
						tag += '		<li';
						if (cate2.cate2No == cate2No && cate3No == null) {
							tag += ' class="on"';
						}
						tag += '		>\n';
						tag += '		<a href="javascript:javascript:void(0);" ';
						if (cate2.cate2No == cate2No && cate3No == null) {
							tag += ' class="on"';
							navNm = '<li class="bread_2depth" id="navNm2">' + cate2.cate2Nm + '</li>';
							$("#navArea").append(navNm);
							$("#formTitle").text(cate2.cate2Nm);
						}else if(cate2.cate2No == cate2No){
							navNm += '<li class="bread_2depth" id="navNm1">' + cate1.cate1Nm + '</li>';
							$("#navArea").append(navNm);
						}
						tag += '	onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ',' + cate2.cate2No + ');">' + cate2.cate2Nm + '</a>\n';
						
						if (cate2.leafYn == 'N' && cate2.cate3List != null && cate2.cate3List.length > 0) {
							tag += '<div class="sub_cate"';
							if (cate2.cate2No == cate2No) {
								tag += ' style="display: block;"';
							}
							tag += '>\n';
							tag += '	<ul>\n';
							$.each(cate2.cate3List, function (idx3, cate3) {
								tag += '<li';
								if (cate3.cate3No == cate3No && cate4No == null) {
									tag += ' class="on"';
								}
								tag += '>';
								tag += '		<a href="javascript:javascript:void(0);" ';
								if (cate3.cate3No == cate3No && cate4No == null) {
									tag += ' class="on"';
									navNm = '<li class="bread_2depth" id="navNm2">' + cate2.cate2Nm + '</li><li class="bread_2depth" id="navNm3">' + cate3.cate3Nm + '</li>';
									$("#navArea").append(navNm);
									$("#formTitle").text(cate3.cate3Nm);
								}else if(cate3.cate3No == cate3No){
									navNm = '<li class="bread_2depth" id="navNm2">' + cate2.cate2Nm + '</li><li class="bread_2depth" id="navNm3">' + cate3.cate3Nm + '</li>';
								}
								tag += ' onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ',' + cate2.cate2No + ',' + cate3.cate3No + ');">' + cate3.cate3Nm + '</a>';
								
								if (cate3.leafYn == 'N' && cate3.cate4List != null && cate3.cate4List.length > 0) {
									tag += '<div class="sub_cate"';
									if (cate3.cate3No == cate3No) {
										tag += ' style="display: block;"';
									}
									tag += '>\n';
									tag += '	<ul>\n';
									$.each(cate3.cate4List, function (idx4, cate4) {
										tag += '<li';
										if (cate4.cate4No == cate4No) {
											tag += ' class="on"';
										}
										tag += '>';
										tag += '		<a href="javascript:javascript:void(0);" ';
										if (cate4.cate4No == cate4No) {
											tag += ' class="on"';
											navNm = '<li class="bread_2depth" id="navNm3">' + cate2.cate2Nm + '</li><li class="bread_2depth" id="navNm3">' + cate3.cate3Nm + '</li><li class="bread_2depth" id="navNm3">' + cate4.cate4Nm + '</li>';
											$("#navArea").append(navNm);
											$("#formTitle").text(cate4.cate4Nm);
										}
										if (formalGb == 'G009_20') {
											tag += ' onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ',' + cate2.cate2No + ',' + cate3.cate3No + ',' + cate4.cate4No + ',\'\',\'' + formalGb + '\');">' + cate4.cate4Nm + '</a>';
										} else {
											tag += ' onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ',' + cate2.cate2No + ',' + cate3.cate3No + ',' + cate4.cate4No + ');">' + cate4.cate4Nm + '</a>';
										}
									});
									tag += '</ul>\n';
									tag += '</div>\n';
								}
								tag += '</li>';
							});
							tag += '</ul>\n';
							tag += '</div>\n';
						}
						
						tag += '</li>';
					});
					tag += '</ul>';
					tag += '</div>';
				}
			}
			
			return tag;
		}

		let fnGetCategoryList = function (cate1){
			var brandGroupNo = [[${cateInfo.brandGroupNo}]];
			var cateGb =  [[${cateInfo.cateGb}]];
			var formalGb = [[${cateInfo.formalGb}]];
			var cate1No = [[${cateInfo.cate1No}]];
			var cate2No = [[${cateInfo.cate2No}]];
			var cate3No = [[${cateInfo.cate3No}]];
			var cate4No = [[${cateInfo.cate4No}]];

			var navNm = "";
			var formTitle = "";
			let tag = '';

			if (cate1 != null) {
				tag += '<li';
				if (cate1.cate1No == cate1No) {
					tag += ' class="on"';
				}
				tag += '>\n';
				tag += '	<a href="javascript:javascript:void(0);"';
				if (cate1.cate1No == cate1No && cate2No == null) {
					tag += ' class="on"';
					formTitle = cate1.cate1Nm;
					$("#formTitle").text(formTitle);
					$("#navNm").hide();
					if(formalGb=='G009_20'){
						navNm += '<li class="bread_2depth" id="navNm1">아울렛</li>';
					}
					navNm += '<li class="bread_2depth" id="navNm1">' + cate1.cate1Nm + '</li>';
					if (brandGroupNo == 0) {
						$("#navHome").attr('href', '/');
						$("#navArea").append(navNm);
					} else {
						$("#navHome").attr('onclick', 'cfnGoToBrandMain(' + brandGroupNo + ');');
						$("#navArea").append(navNm);
					}
				}else if(cate1.cate1No == cate1No && cate3No == null){
					$("#navNm").hide();
					if(formalGb=='G009_20'){
						navNm += '<li class="bread_2depth" id="navNm1">아울렛</li>';
					}
					navNm += '<li class="bread_2depth" id="navNm1">' + cate1.cate1Nm + '</li>';
					$("#navArea").append(navNm);
					//$("#navNm").text(cate1.cate1Nm);
				}else if(cate3No != null){
					$("#navNm").hide();
				}
				if(formalGb=='G009_20'){
					tag += '	onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ',\'\',\'\',\'\',\'\',\'' + formalGb + '\');" >' + cate1.cate1Nm + '</a>\n';
				}else{
					tag += '	onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ');" >' + cate1.cate1Nm + '</a>\n';
				}
				
				if (cate1.leafYn == 'N' && cate1.cate2List.length > 0) {
					tag += '<div class="sub_cate"';
					if (cate1.cate1No == cate1No) {
						tag += ' style="display: block;"';
					}
					tag += '>\n';
					tag += '	<ul>\n';
					$.each(cate1.cate2List, function (idx2, cate2) {
						tag += '		<li';
						if (cate2.cate2No == cate2No && cate3No == null) {
							tag += ' class="on"';
						}
						tag += '		>\n';
						tag += '		<a href="javascript:javascript:void(0);" ';
						if (cate2.cate2No == cate2No && cate3No == null) {
							tag += ' class="on"';
							navNm = '<li class="bread_2depth" id="navNm2">' + cate2.cate2Nm + '</li>';
							$("#navArea").append(navNm);
							$("#formTitle").text(cate2.cate2Nm);
						}else if(cate2.cate2No == cate2No){
							if(formalGb=='G009_20'){
								navNm += '<li class="bread_2depth" id="navNm1">아울렛</li>';
							}
							navNm += '<li class="bread_2depth" id="navNm1">' + cate1.cate1Nm + '</li>';
							$("#navArea").append(navNm);
						}
						if(formalGb=='G009_20'){
							tag += '	onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ',' + cate2.cate2No + ',\'\',\'\',\'\',\'' + formalGb + '\');">' + cate2.cate2Nm + '</a>\n';
						}else{
							tag += '	onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ',' + cate2.cate2No + ');">' + cate2.cate2Nm + '</a>\n';
						}
						if (cate2.leafYn == 'N' && cate2.cate3List != null && cate2.cate3List.length > 0) {
							tag += '<div class="sub_cate"';
							if (cate2.cate2No == cate2No) {
								tag += ' style="display: block;"';
							}
							tag += '>\n';
							tag += '	<ul>\n';
							$.each(cate2.cate3List, function (idx3, cate3) {
								tag += '<li';
								if (cate3.cate3No == cate3No && cate4No == null) {
									tag += ' class="on"';
								}
								tag += '>';
								tag += '		<a href="javascript:javascript:void(0);" ';
								if (cate3.cate3No == cate3No && cate4No == null) {
									tag += ' class="on"';
									navNm = '<li class="bread_2depth" id="navNm2">' + cate2.cate2Nm + '</li><li class="bread_2depth" id="navNm3">' + cate3.cate3Nm + '</li>';
									$("#navArea").append(navNm);
									$("#formTitle").text(cate3.cate3Nm);
								}else if(cate3.cate3No == cate3No){
									navNm = '<li class="bread_2depth" id="navNm2">' + cate2.cate2Nm + '</li><li class="bread_2depth" id="navNm3">' + cate3.cate3Nm + '</li>';
								}
								if(formalGb=='G009_20'){
									tag += ' onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ',' + cate2.cate2No + ',' + cate3.cate3No + ',\'\',\'\',\'' + formalGb + '\');">' + cate3.cate3Nm + '</a>';
								}else{
									tag += ' onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ',' + cate2.cate2No + ',' + cate3.cate3No + ');">' + cate3.cate3Nm + '</a>';
								}
								if (cate3.leafYn == 'N' && cate3.cate4List != null && cate3.cate4List.length > 0) {
									tag += '<div class="sub_cate"';
									if (cate2.cate2No == cate2No) {
										tag += ' style="display: block;"';
									}
									tag += '>\n';
									tag += '	<ul>\n';
									$.each(cate3.cate4List, function (idx4, cate4) {
										tag += '<li';
										if (cate4.cate4No == cate4No) {
											tag += ' class="on"';
										}
										tag += '>';
										tag += '		<a href="javascript:javascript:void(0);" ';
										if (cate4.cate4No == cate4No) {
											tag += ' class="on"';
											navNm = '<li class="bread_2depth" id="navNm3">' + cate2.cate2Nm + '</li><li class="bread_2depth" id="navNm3">' + cate3.cate3Nm + '</li><li class="bread_2depth" id="navNm3">' + cate4.cate4Nm + '</li>';
											$("#navArea").append(navNm);
											$("#formTitle").text(cate4.cate4Nm);
										}
										if(formalGb=='G009_20'){
											tag += ' onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ',' + cate2.cate2No + ',' + cate3.cate3No + ',' + cate4.cate4No + ',\'\',\'' + formalGb + '\');">' + cate4.cate4Nm + '</a>';
										}else{
											tag += ' onclick="cfnGoToGoodsList(' + brandGroupNo + ',\'' + cateGb + '\',' + cate1.cate1No + ',' + cate2.cate2No + ',' + cate3.cate3No + ',' + cate4.cate4No + ');">' + cate4.cate4Nm + '</a>';
										}
									});
								}
								tag += '</li>\n';
							});
							tag += '	</ul>\n';
							tag += '</div>\n';
						}
						tag += '</li>';
					});
					tag += '	</ul>\n';
					tag += '</div>\n';
				}
				tag += '</li>\n';
			}
			return tag;
		}

		var fnImgOnoff = function (){
			var nowFocus = $('.dp .itemPic');
			var nowMov = $('.itemPic').children('.pd_mov');
			var nowImg = $('.itemPic').children('.pd_img');
			var ogrSrc;
			var overSrc;
			var srcName = nowImg.attr('src');
			overSrc = srcName.substring(0, srcName.lastIndexOf('.'));
			
			var srcImg;
			var srcdat;

			$(nowFocus).on('mouseover', function() {
				// [on] size opt
				//$(this).siblings(".itemOpt").stop().animate({"bottom": 0}, 400,"swing");
				// [on] mov none
				//$(this).css("opacity","0");
				// return false;
				$(this).children('.pd_mov').siblings(".itemOpt").addClass('on');
				$(this).children('.pd_mov').css("opacity","0");
			});
			$(nowFocus).on('mouseleave', function() {
				// [off] size opt
				//$(this).siblings(".itemOpt").stop().animate({"bottom": -120}, 400,"swing");
				// [off] mov block
				//$(this).css("opacity","1");
				// return false;
				$(this).children('.pd_mov').siblings(".itemOpt").removeClass('on');
				$(this).children('.pd_mov').css("opacity","1");
			});
			$(nowFocus).on('mouseover', function() {
				//img1 = $(this).attr('src');
				//img2 = $(this).attr('data-img');
				// [on] size opt
				//$(this).siblings(".itemOpt").stop().animate({"bottom": 0}, 400,"swing");
				// [on] re-Name
				// ogrSrc = $(this).attr('src').substring(0, srcName.lastIndexOf('.'));
				// overSrc = $(this).attr('src').substring(0, srcName.lastIndexOf('.'));
				// $(this).attr('src', overSrc+ '_onhover.' + /[^.]+$/.exec(srcName));
				//$(this).attr('src',img2);
				// return false;
				$(this).children('.pd_img').siblings(".itemOpt").addClass('on');
				srcImg = $(this).children('.pd_img').attr('src');
				srcdat = $(this).children('.pd_img').attr('data-img');
				$(this).children('.pd_img').attr('src',srcdat);
			});
			$(nowFocus).on('mouseleave', function() {
				// [off] size opt
				//$(this).siblings(".itemOpt").stop().animate({"bottom": -120}, 400,"swing");
				// [off] re-Name
				// $(this).attr('src', overSrc + '.' + /[^.]+$/.exec(srcName));
				//$(this).attr('src', img1);
				// return false;
				$(this).children('.pd_img').siblings(".itemOpt").removeClass('on');
				$(this).children('.pd_img').attr('src', srcImg);
			});
		}

		// 사파리 - event.persisted || 크롬 - window.performance.navigation.type 이 1이면 새로고침, 2면 페이지 이동을 통한 캐쉬페이징
		$(window).on("pageshow", function(event) {
			$('#filterForm input[name=brand]:checked').each(function(){
				$(this).parent().addClass("active");
			});
			$('#filterForm input[name=size]:checked').each(function(){
				$(this).parent().addClass("active");
			});
			$('#filterForm input[name=price]:checked').each(function(){
				$(this).parent().addClass("active");
			});
			if ( (event.originalEvent && event.originalEvent.persisted) || (window.performance && window.performance.navigation.type == 2)) {
				var historyData = sessionStorage.getItem(document.location.href);
				if(historyData!=null){
					historyData = JSON.parse(historyData);
				}else{
					historyData = {};
				}
				if(typeof historyData.sortGbNm!='undefined' && historyData.sortGbNm!=''){
					$(".arrayWrap .btn").text(historyData.sortGbNm);
				}
				if(typeof historyData.filterHtml!='undefined' && historyData.filterHtml!=''){
					$("#searchForm").append(historyData.filterHtml);
					filterHtml = historyData.filterHtml;
				}
				if(typeof historyData.filterStatHtml!='undefined' && historyData.filterStatHtml!=''){
					$(".filterstate").append(historyData.filterStatHtml);
					filterStatHtml = historyData.filterStatHtml;
				}
				if(typeof historyData.totalCount!='undefined' && historyData.totalCount!=''){
					$("#totalGoodsCnt").text(historyData.totalCount);
				}
				if(typeof historyData.sortGb!='undefined' && historyData.sortGb!=''){
					$("#sortSelect").val(historyData.sortGb);
					$("#searchForm input:hidden[name=sortGb]").val(historyData.sortGb);
					fnSortChange(historyData.sortGb);
				}else{
					fnGoodsListSearch();
				}
			}else{
				fnCategoryGoodsInfiniteScrollInit();
				/*var sortGb = [[${sortGb}]];
				if(sortGb=='new' || sortGb=='best'){
					$("#sortSelect").val(sortGb);
					$("#sortSelect").parent('div').children('span').text($("#sortSelect option:selected").text())
					fnSortChange(sortGb);
				}else{
					fnGoodsListSearch();
				}*/
				fnGoodsListSearch();
			}
		});

		var fnSortList = function (obj, sortGb){
			$("#sortArea").find('li').each(function (){
				$(this).find('a').attr('class','off');
			});

			$(obj).addClass("on");
			$("#searchGoodsForm").find("[name=sortGb]").val(sortGb);
			fnCategoryGoodsInfiniteScrollInit();
			fnGoodsListSearch();
		}

		/*]]>*/
	</script>

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

</th:block>

</body>
</html>
