//****************상품상세  start **********************************
// 함께본 상품
var fnGoodsTogetherSearch = function(params) {
	//gagajf.ajaxSubmit("/goods/detail/together/frame", "html", "goodsTogetherbArea", params);

	$.ajax( {
		type		: "POST",
		url 		: '/goods/detail/together/frame',
		data		: JSON.stringify(params),
		dataType 	: 'html',
		beforeSend : function(xhr, settings) {
			xhr.setRequestHeader("AJAX"			, "true");
			xhr.setRequestHeader('Accept'		, 'application/json');
			xhr.setRequestHeader('Content-Type'	, 'application/json');
		},
		success 	: function(result) {
			if (result != null) {
				$("#goodsTogetherbArea").css("display", "block");
				$("#goodsTogetherbArea").html(result);

				// 위시처리- 로그인 되어 있을시
		  		if (cfCheckLogin()) {
		  			//이상품과 함께본 상품
					let targetT = $('#goodsTogetherbArea').find('.item_state').find('button');
					//let targetTSize = targetT.length;
					targetT.each(function(){
						let goodsCd = $(this).attr('goodscd');
						var $this = $(this);
						let url = "/mypage/wish/list/check/"+goodsCd;
						var result = '';
						$.ajax({
							type: 'get'
							, async: false
							, url: url
							, success: function (data) {
								//likeit active
								if ("Y" == data){
									$this.addClass('likeit').addClass('active');
								}
							}
						});
					});
		  		}
			}
		}
	});
}

// 추천 상품
var fnGoodsRecommendSearch = function(params) {
	//gagajf.ajaxSubmit("/goods/detail/recommend/frame", "html", "goodsRecommendbArea", params);

	$.ajax( {
		type		: "POST",
		url 		: '/goods/detail/recommend/frame',
		data		: JSON.stringify(params),
		dataType 	: 'html',
		beforeSend : function(xhr, settings) {
			xhr.setRequestHeader("AJAX"			, "true");
			xhr.setRequestHeader('Accept'		, 'application/json');
			xhr.setRequestHeader('Content-Type'	, 'application/json');
		},
		success 	: function(result) {
			if (result != null) {
				$("#goodsRecommendbArea").css("display", "block");
				$("#goodsRecommendbArea").html(result);
				// 위시처리- 로그인 되어 있을시
		  		if (cfCheckLogin()) {
			  		//브랜드 추천상품
		  			let targetR = $('#goodsRecommendbArea').find('.item_state').find('button');
		  			//let targetRSize = targetT.length;
		  			targetR.each(function(){
		  				let goodsCd = $(this).attr('goodscd');
		  				var $this = $(this);
		  				let url = "/mypage/wish/list/check/"+goodsCd;
		  				var result = '';
		  				$.ajax({
		  					type: 'get'
		  					, async: false
		  					, url: url
		  					, success: function (data) {
		  						//likeit active
		  						if ("Y" == data){
		  							$this.addClass('likeit').addClass('active');
		  						}
		  					}
		  				});
		  			});
		  		}
			}
		}
	});
}

// 비슷한 상품
var fnGoodsLikeSearch = function(params) {
	//gagajf.ajaxSubmit("/goods/detail/like/frame", "html", "goodsLikebArea", params);

	$.ajax( {
		type		: "POST",
		url 		: '/goods/detail/like/frame',
		data		: JSON.stringify(params),
		dataType 	: 'html',
		beforeSend : function(xhr, settings) {
			xhr.setRequestHeader("AJAX"			, "true");
			xhr.setRequestHeader('Accept'		, 'application/json');
			xhr.setRequestHeader('Content-Type'	, 'application/json');
		},
		success 	: function(result) {
			if (result != null) {
				$("#goodsLikebArea").css("display", "block");
				$("#goodsLikebArea").html(result);
				// 위시처리- 로그인 되어 있을시
		  		if (cfCheckLogin()) {
		  			//비슷한 상품
		  			let targetL = $('#goodsLikebArea').find('.item_state').find('button');
		  			//let targetTSize = targetT.length;
		  			targetL.each(function(){
		  				let goodsCd = $(this).attr('goodscd');
		  				var $this = $(this);
		  				let url = "/mypage/wish/list/check/"+goodsCd;
		  				var reLult = '';
		  				$.ajax({
		  					type: 'get'
		  					, async: false
		  					, url: url
		  					, success: function (data) {
		  						//likeit active
		  						if ("Y" == data){
		  							$this.addClass('likeit').addClass('active');
		  						}
		  					}
		  				});
		  			});
		  		}
			}
		}
	});
}


// EP 쿠폰조회
var fnEpCouponDown = function(afLinkCd, goodsCd, maxRownum){
	if (typeof (afLinkCd) == 'undefined' || gagajf.isNull(afLinkCd)){
		return false;
	}

	let data = {afLinkCd : afLinkCd
				, goodsCd : goodsCd
				, maxRownum : maxRownum
				};
	$.getJSON('/goods/epCoupon/list', data, function(result, status) {
		if (status === 'success') {
			if(result.length>0){
				let coupon = result[0];
				let tag = '';
				tag += '<div class="modal fade pd_pop epcoupon_pop" id="epCouponPop" tabindex="-1" role="dialog" aria-labelledby="epCouponLabel" aria-hidden="true">\n';
				tag += '	<div class="modal-dialog" role="document">\n';
				tag += '	  <div class="modal-content">\n';
				tag += '		<div class="modal-header">\n';
				tag += '			<h5 class="modal-title" id="epCouponLabel">'+coupon.cpnNm+'</h5>\n';
				tag += '		</div>\n';
				tag += '		<div class="modal-body">\n';
				tag += '			<div class="pop_cont">\n';
				tag += '				<div class="ep_coupon">\n';
				tag += '					<div>\n';
				tag += '						<p class="cp_title">\n';
				tag += '							COUPON\n';
				tag += '						</p>\n';
				tag += '						<p class="cp_cont">\n';
				if (coupon.dcWay == 'G240_11'){		//할인율
					tag += '							<span class="unit_percent">\n';
					tag += '								최대<em class="number">'+coupon.dcVal+'</em><em class="unit">%</em>\n';
					tag += '							</span>\n';

				}else{
					tag += '							<span class="unit_won">\n';
					tag += '								<em class="number">'+coupon.dcVal.addComma()+'</em><em class="unit">원</em>\n';
					tag += '							</span>\n';
				}
				tag += '						</p>\n';
				tag += '					</div>\n';
				tag += '				</div>\n';
				tag += '				<div class="info_txt">\n';
				tag += '					<ul>\n';
				tag += '						<li>일부 상품은 쿠폰 사용이 제한될 수 있습니다.</li>\n';
				tag += '						<li>할인대상 및 금액은 상시 변경됩니다.</li>\n';
				tag += '						<li>제휴 사이트와 정보연동 시간차이로 판매정보가 불일치할 수 있습니다.</li>\n';
				tag += '						<li>본 쿠폰은 제휴 사이트를 통해 들어온 고객님만 발급 및 사용이 가능합니다.</li>\n';
				tag += '					</ul>\n';
				tag += '				</div>\n';
				tag += '			</div>\n';
				tag += '		</div>\n';
				tag += '		<div class="modal-footer">\n';
				tag += '			<button type="button" id="" class="btn btn_primary btn_all_cpdown" onclick="fnEpCoupondown(\''+afLinkCd+'\',\''+goodsCd+'\');" ><span>쿠폰 받기</span></button>\n';
				tag += '		</div>\n';
				tag += '	  </div>\n';
				tag += '	</div>\n';
				tag += '	<a href="javascript:void(0);" rel="modal:close" onclick="cfCloseLayer(\'epCouponPop\')" class="close-modal">Close</a>\n';
				tag += '</div>	\n';

				$('body').append(tag);
				$('#epCouponPop').modal("show");
			}
		}
	});
}

// ep 쿠폰다운로드
var fnEpCoupondown = function(afLinkCd, goodsCd){
	if (!cfCheckLogin()) {
		cfnGoToPage(_PAGE_LOGIN);
		return false;
	}

	gagajf.ajaxJsonSubmit(_PAGE_GOODS_EP_CPN_DOWNLOAD, JSON.stringify({goodsCd: goodsCd, afLinkCd: afLinkCd}), fnEpCouponDownCallBack);
}

var fnEpCouponDownCallBack = function(){
	$('#epCouponPop').find('.close-modal').trigger("click");
}

//****************상품상세  end **********************************

//****************상품리스트  start **********************************
var categoryGoodsList = [];
var cnt = 1;
var email = '';
var fnCreateGoodsList = function(result, ithrCd, contentLoc, goodsUrl, lastPage, endRow, appGb) {
	var tag = '';
	var rank = 0;
	if(lastPage!='1'){
		rank = endRow;
	}

	$.each(result.dataList, function(idx, item) {
		if (idx < 3) {
			categoryGoodsList.push(item.goodsCd);
		}
		if(!gagajf.isNull(item.goodsCd)) {
			tag += '<div class="item_prod" id="' + item.goodsCd + item.colorCd + '">';
			tag += '	<div class="item_state';
			if (!gagajf.isNull(item.sizes)) {
				var sizeArr = item.sizes.split(",");
				let soldOutCnt = 0;
				for (let i = 0; i < sizeArr.length; i++) {
					var sizeInfo = sizeArr[i].split(":");
					var sizeVal = sizeInfo[0];
					var soldOutYn = sizeInfo[1];
					if (soldOutYn == 'Y') {
						soldOutCnt++;
					}
				}
				if (sizeArr.length == soldOutCnt) {
					tag += ' soldout';
				}
			}
			tag += '">';
			tag += '		<button type="button" class="itemLike';
			if (item.likeIt == 'likeit') {
				tag += ' likeit';
			}
			tag += ' "';
			if (appGb == 'Mob') {
				tag += ' onClick="cfnMoPutWishList(this);" goodsCd=\'' + item.goodsCd + '\', goodsNm=\'' + item.goodsFullNm + '\', ithrCd=\'\', contentsLoc=\'\', planDtlSq=\'\'>관심상품 추가</button>';
			} else {
				tag += ' onClick="cfnPutWishList(this);" goodsCd=\'' + item.goodsCd + '\', goodsNm=\'' + item.goodsFullNm + '\', ithrCd=\'\', contentsLoc=\'\', planDtlSq=\'\'>관심상품 추가</button>';
			}
			tag += '<a href="javascript:void(0);" class="itemLink" onclick="fnClickGoodsCd(\'' + item.goodsCd + '\',\'' + item.colorCd + '\');">';
			tag += '			<div class="itemPic">';
			if (!gagajf.isNull(item.videos)) {
				var videoArr = item.videos.split(",");
				var videoGb = '';
				var videoUrl = '';
				for (let i = 0; i < videoArr.length; i++) {
					var videoInfo = videoArr[i].split(":");
					videoGb = videoInfo[0];
					videoUrl = videoInfo[1];
				}
				if (videoGb == 'Y') {
					tag += '<iframe id="pdThumbVideo" class="pd_mov" src="https://www.youtube.com/embed/' + videoUrl + '?autoplay=1&mute=1"></iframe>';
					//tag += '<iframe id="pdThumbVideo" class="pd_mov" src="http://v.kr.kollus.com/164MyIiv?enable_initialize_focus=false&autoplay&mute&controls_activation=none" allow="fullscreen" allowFullScreen></iframe>';
				} else {
					tag += '<iframe id="pdThumbVideo" class="pd_mov video-autoplay" src="' + _kollusMediaUrl + '/' + videoUrl + '?enable_initialize_focus=false&autoplay&mute&controls_activation=none" allow="fullscreen" allowFullScreen></iframe>';
				}
			}
			// tag += '		<img class=" vLHTC pd_img" src="' + item.sysImgNm + '" data-img="' + item.sysImgNm2 + '" onerror="noneImg(this)">';
			var imgUrl = "//image.istyle24.com/Upload/ProductImage/";
			tag += '		<img class=" vLHTC pd_img" src="' + goodsUrl + '/' + (item.sysImgNm ? item.sysImgNm.replace(imgUrl,"") : '') + '" data-img="' + goodsUrl + '/' + (item.sysImgNm2 ? item.sysImgNm2.replace(imgUrl,"") : '') + '" onerror="noneImg(this)">';
			if (!gagajf.isNull(item.sizes) && item.selfGoodsYn == 'Y') {
				var sizeArr = item.sizes.split(",");
				var minSize;
				var maxSize;
				var sizeVal = '';
				var soldOutYn = '';
				tag += '<div class="itemOpt">';

				if (sizeArr.length > 5) {
					for (let i = 0; i < sizeArr.length; i++) {
						var sizeInfo = sizeArr[i].split(":");
						sizeVal = sizeInfo[0];
						soldOutYn = sizeInfo[1];
						if (i == 0) {
							minSize = sizeVal;
						} else if (i == sizeArr.length - 1) {
							maxSize = sizeVal;
						}
					}
					tag += '	<div class="exc">';
					tag += '		<span>' + minSize + '</span> ~ <span>' + maxSize + '</span> 사이즈가 있습니다.';
					tag += '	</div>';
				} else {
					tag += '<ul>';
					for (let i = 0; i < sizeArr.length; i++) {
						var sizeInfo = sizeArr[i].split(":");
						sizeVal = sizeInfo[0];
						soldOutYn = sizeInfo[1];
						if (soldOutYn == 'N') {
							tag += '		<li>' + sizeVal + '</li>';
						} else {
							tag += '		<li class="none">' + sizeVal + '</li>';
						}
					}
					tag += '</ul>';
				}
				tag += '			</div>';
			}

			tag += '			</div>';

			tag += '			<p class="itemBrand">' + item.brandGroupNm + '</p>';
			if (item.goodsTnm != null && item.goodsTnm != '') {
				tag += '			<div class="itemComment">' + item.goodsTnm + '</div>';
			}
			tag += '			<div class="itemName">' + item.goodsFullNm + '</div>';
			if (appGb != 'Mob') {
				if(item.goodsType=='G056_D'){
					tag += '			<p class="itemPrice">' + item.currPrice.addComma() +'~ ';
				}else{
					tag += '			<p class="itemPrice">' + item.currPrice.addComma()
				}
				if (item.currPrice != item.listPrice) {
					if (item.listPrice != 0) {
						tag += '				<span class="itemPrice_original">' + item.listPrice.addComma() + '</span>';
						tag += '				<span class="itemPercent">' + Math.round((item.listPrice - item.currPrice) / (item.listPrice * 1.0) * 100) + '%</span>';
					}
				}
				tag += '			</p>';
			} else {
				tag += '			<p class="itemPrice">';
				if (item.currPrice != item.listPrice) {
					if (item.listPrice != 0) {
						tag += '				<span class="itemPrice_original">' + item.listPrice.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '</span>';
					}
				}
				if(item.goodsType=='G056_D'){
					tag += item.currPrice.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") +'~ ';
				}else{
					tag += item.currPrice.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
				}
				if (item.currPrice != item.listPrice) {
					if (item.listPrice != 0) {
						tag += '				<span class="itemPercent">' + Math.round((item.listPrice - item.currPrice) / (item.listPrice * 1.0) * 100) + '%</span>';
					}
				}
				tag += '			</p>';
			}

			tag += '			<div class="itemcolorchip">';
			if (!gagajf.isNull(item.colorChips)) {
				var colorArr = item.colorChips.split(",");
				var colorCd = '';
				var rgbColor = '';
				for (let i = 0; i < colorArr.length; i++) {
					var colorInfo = colorArr[i].split(":");
					colorCd = colorInfo[0];
					rgbColor = colorInfo[1];
					if (rgbColor == '#FFFFFF') {
						tag += '	<span class="chip_color" style="background-color: ' + rgbColor + ';border:1px solid #aaa;" value="' + colorCd + '">' + colorCd + '</span>';
					} else {
						tag += '	<span class="chip_color" style="background-color: ' + rgbColor + '" value="' + colorCd + '">' + colorCd + '</span>';
					}
				}
			}
			tag += '			</div>';

			if (!gagajf.isNull(item.benefits)) {
				var iconArr = item.benefits.split(",");
				var iconGb = '';
				var iconNm = '';
				tag += '	<p class="itemBadge">';
				let arrCnt;
				if (iconArr.length > 2) {
					arrCnt = 3;
				} else {
					arrCnt = iconArr.length;
				}
				for (let i = 0; i < arrCnt; i++) {
					var iconInfo = iconArr[i].split(":");
					iconGb = iconInfo[0];
					iconNm = iconInfo[1];
					tag += '	<span class="badge13" value="' + iconGb + '">' + iconNm + ' </span>';
				}
				tag += '	</p>';
			}

			tag += '		</a>';
			tag += '	</div>';
			tag += '</div>';
		}
	});

	if (cnt == 1) {
		// <!-- Criteo 카테고리/리스팅 태그 -->
		window.criteo_q = window.criteo_q || [];
		var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
		window.criteo_q.push(
			{event: "setAccount", account: 6762}, // 이 라인은 업데이트하면 안됩니다
			{event: "setEmail", email: criteoEmail}, // 유저가 로그인이 안되 있는 경우 빈 문자열을 전달
			{event: "setSiteType", type: deviceType},
			{event: "viewList", item: categoryGoodsList} // 가장 위에있는 3개의 상품 ID를 전달
		);
		// <!-- END 카테고리/리스팅 태그 -->
		cnt++;
	}

	return tag;
}


// 인피니트 스크롤 초기화
var fnCategoryGoodsInfiniteScrollInit = function(){
	sessionStorage.removeItem(document.location.href);
	//History 초기화
	$("#listBox").html("");
}

var filterHtml = '';
var filterStatHtml = '';

// 상품상세 필터 조회
var filterSel = function (obj, gubun, staus, sizeGb){
	// fnCategoryGoodsInfiniteScrollInit();
	// filterHtml = '';
	// filterStatHtml = '';
	// console.log('1.filterHtml++'+filterHtml);
	// console.log('2.filterStatHtml++'+filterStatHtml);
	gagaInfiniteScroll.pageStatus.filterHtml = filterHtml;
	gagaInfiniteScroll.pageStatus.filterStatHtml = filterStatHtml;
	let $obj = $(obj);
	if(staus=='on'){
		filterStatHtml = '';
		if(gubun=='size'){
			$(obj).attr('onclick','fnResetListIdx();filterSel(this,\''+gubun+'\',\'off\',\''+sizeGb+'\');');
		}else{
			$(obj).attr('onclick','fnResetListIdx();filterSel(this,\''+gubun+'\',\'off\',\'\');');
		}

		$("#filterData").find('span').each(function(idx,item) {
			if(gubun=='color'){
				if($obj.attr('data-id').replace('#','').trim() == $(this).closest("span").attr('id')) {
					$(this).closest("span").remove();
				}
			}else{
				if($obj.attr('data-id') == $(this).closest("span").text()) {
					$(this).closest("span").remove();
				}
			}
		});
		filterStatHtml = $("#filterData").html();
	}else{
		if(gubun=='size'){
			$(obj).attr('onclick','fnResetListIdx();filterSel(this,\''+gubun+'\',\'on\',\''+sizeGb+'\');');
		}else{
			$(obj).attr('onclick','fnResetListIdx();filterSel(this,\''+gubun+'\',\'on\',\'\');');
		}

		let tag = '';
		if(gubun=='color'){
			tag += '<span id="'+$obj.attr('data-id').replace('#','')+'">';
			if($obj.attr('data-id')=='#FFFFFF'){
				tag += '	<span class="pdColor-color" style="background-color: #'+$obj.attr('data-id')+';border:1px solid #aaa;" value="'+$obj.attr('data-id')+'"></span>';
			}else{
				tag += '	<span class="pdColor-color" style="background-color: #'+$obj.attr('data-id')+'" value="'+$obj.attr('data-id')+'"></span>';
			}
			tag += '	<a href="javascript:void(0);" class="filter_delete" onclick="fnDeleteFilter(this,\''+gubun+'\',\'on\');"></a >';
			tag += '</span>';
		}else{
			tag += '<span>'+$obj.attr('data-id');
			if(!gagajf.isNull(sizeGb)){
				tag += '<a href="javascript:void(0);" class="filter_delete" onclick="fnDeleteFilter(this,\''+gubun+'\',\'on\',\''+sizeGb+'\');"></a >';
			}else{
				tag += '<a href="javascript:void(0);" class="filter_delete" onclick="fnDeleteFilter(this,\''+gubun+'\',\'on\',\'\');"></a >';
			}
			tag += '</span>';
		}

		$("#filterData").append(tag);

		filterStatHtml += tag;
	}

	gagaInfiniteScroll.pageStatus.filterStatHtml = filterStatHtml;
	fnFilterSet(gubun, sizeGb);
}

var fnFilterSet = function (searchId, sizeGb, appGb){
	fnCategoryGoodsInfiniteScrollInit();
	$("#searchGoodsForm input:hidden[name="+searchId+"Arr]").remove();
	var tag = '';
	var mobTag = '';
	if(searchId=='size'){
		$('#filterForm input[name='+searchId+']:checked').each(function(){
			tag = '<input type="hidden" name="'+searchId+'Arr" value="'+$(this).attr('data-id')+'"/>\n';
			$("#searchGoodsForm").append(tag);
			// filterHtml += tag;
		});
	}else{
		$('#filterForm input[name='+searchId+']:checked').each(function(){
			tag = '<input type="hidden" name="'+searchId+'Arr" value="'+$(this).val()+'"/>\n';
			$("#searchGoodsForm").append(tag);
			// filterHtml += tag;
		});
		if(searchId=='benefit'){
			if ($('#newGoods').is(":checked")) {
				// tag = '<input type="hidden" name="'+searchId+'Arr" value="40:신상"/>\n';
				$("#searchGoodsForm").append(tag);
			}
		}
	}

	if(appGb == 'Mob'){
		var data = '';
		var tag = '';
		var filterSet = '';
		$('#'+searchId+'FilterDiv').find('.daps1').find('span').html('');
		$('#filterForm input[name='+searchId+']:checked').each(function(idx){
			if(searchId=='color'){
				$('#'+searchId+'FilterDiv').find('.daps1').find('.pic').find('span').html('');
				var mobTag = '';
				var color = $(this).attr('data-id');
				console.log('color::'+$(this).attr('data-id'));
				if(color=='FFFFFF'){
					mobTag += '<span class="pdColor-color" style="background-color:#'+color+';border:1px solid #aaa;"></span>';
				}else{
					mobTag += '<span class="pdColor-color" style="background-color:#'+color+'"></span>';
				}
				$("#"+searchId+"FilterDiv").find('.daps1').find('.pic').append(mobTag);
			}else{
				$('#'+searchId+'FilterDiv').find('.daps1').find('span').html('');
				if(idx>0){
					data += ',';
				}
				data += $(this).attr('data-id');
				$("#"+searchId+"FilterDiv").find('.daps1').append('<span class="pic">'+data+'</span>');
			}
		});

	}
	fnSetFilterHtml();
	// gagaInfiniteScroll.pageStatus.filterHtml = filterHtml;
	// gagaInfiniteScroll.pageStatus.filterStatHtml = filterStatHtml;
	fnGoodsListSearch();
}

var fnSetFilterHtml = function (gubun, staus, mobGb){
	filterHtml = '';

	$('#filterForm input[name=size]:checked').each(function(){
		filterHtml += '<input type="hidden" name="sizeArr" value="'+$(this).attr('data-id')+'"/>\n';
	});
	$('#filterForm input[name=brandGroup]:checked').each(function(){
		filterHtml += '<input type="hidden" name="brandGroupArr" value="'+$(this).val()+'"/>\n';
	});
	$('#filterForm input[name=age]:checked').each(function(){
		filterHtml += '<input type="hidden" name="ageArr" value="'+$(this).val()+'"/>\n';
	});
	$('#filterForm input[name=season]:checked').each(function(){
		filterHtml += '<input type="hidden" name="seasonArr" value="'+$(this).val()+'"/>\n';
	});
	$('#filterForm input[name=color]:checked').each(function(){
		filterHtml += '<input type="hidden" name="colorArr" value="'+$(this).val()+'"/>\n';
	});
	$('#filterForm input[name=benefit]:checked').each(function(){
		filterHtml += '<input type="hidden" name="benefitArr" value="'+$(this).val()+'"/>\n';
	});
	$('#filterForm input[name=price]:checked').each(function(){
		filterHtml += '<input type="hidden" name="priceArr" value="'+$(this).val()+'"/>\n';
	});
	$('#filterForm input[name=dcRate]:checked').each(function(){
		filterHtml += '<input type="hidden" name="dcRateArr" value="'+$(this).val()+'"/>\n';
	});
	let priceVal = '';
	if(!gagajf.isNull($("#filterForm input[name=hPriceFrom]").val())){
		// filterHtml += '<input type="hidden" name="priceFrom" value="'+$("#filterForm input[name=hPriceFrom]").val()+'"/>\n';
		priceVal += $("#filterForm input[name=hPriceFrom]").val().removeComma();
	}
	if(!gagajf.isNull($("#filterForm input[name=hPriceTo]").val())){
		// filterHtml += '<input type="hidden" name="priceTo" value="'+$("#filterForm input[name=hPriceTo]").val()+'"/>\n';
		priceVal += ',' + $("#filterForm input[name=hPriceTo]").val().removeComma();
	}
	filterHtml += '<input type="hidden" name="priceArr" value="'+priceVal+'"/>\n';

	let dcRateVal = '';
	if(!gagajf.isNull($("#filterForm input[name=hDcRateFrom]").val())){
		// filterHtml += '<input type="hidden" name="dcRateFrom" value="'+$("#filterForm input[name=hDcRateFrom]").val()+'"/>\n';
		dcRateVal += $("#filterForm input[name=hDcRateFrom]").val();
	}
	if(!gagajf.isNull($("#filterForm input[name=hDcRateTo]").val())){
		// filterHtml += '<input type="hidden" name="dcRateTo" value="'+$("#filterForm input[name=hDcRateTo]").val()+'"/>\n';
		dcRateVal += ',' + $("#filterForm input[name=hDcRateTo]").val();
	}
	filterHtml += '<input type="hidden" name="dcRateArr" value="'+dcRateVal+'"/>\n';
	if($('#filterForm').find("input:checkbox[id='unisex']").is(":checked") == true){
		filterHtml += '<input type="hidden" name="unisex" value="G007_Z"/>\n';
	}
	if($('#filterForm').find("input:checkbox[id='newGoods']").is(":checked") == true){
		filterHtml += '<input type="hidden" name="newGoods" value="40"/>\n';
	}
	// console.log('filterHtml>>'+filterHtml);
	gagaInfiniteScroll.pageStatus.filterHtml = filterHtml;
}

// 상품상세 필터 삭제
var fnDeleteFilter = function (obj, gubun, staus, sizeGb){
	if(gubun=='size'){
		$("#"+gubun+"FilterDiv #sizeLi"+sizeGb).each(function(idx,item) {
			$('#sizeLi'+sizeGb+' .size_btn').each(function (){
				if($(obj).closest("span").text() == $(this).find('input').attr('data-id')){
					$(this).find('input').click();
				}
			});
		});
	}else{
		$("#"+gubun+"FilterDiv > ul > li").each(function(idx,item) {
			if(gubun == 'color'){
				if($(obj).closest("span").attr('id') == $(this).find('input').attr('data-id').trim()){
					$(this).find('input').click();
				}
			}else{
				if($(obj).closest("span").text() == $(this).find('input').attr('data-id')){
					$(this).find('input').click();
				}
			}
		});
	}

	$(obj).closest("span").remove();
	fnSetFilterHtml();
}

var fnFilterSliderMove = function (min, max){
	var $range = $(".dp .js-range-slider01, .sch_result .js-range-slider01");
	var $inputFrom = $("#price_input_from");
	var $inputTo = $("#price_input_to");
	var instance;

	instance = $range.data("ionRangeSlider");
	instance.update({
		from: min
	});
	//$inputFrom.val(min);

	instance.update({
		to: max
	});
	//$inputTo.prop("value",max);
	fnSetFilterHtml();
}

var fnDcRateFilterSliderMove = function (min, max){
	var $range = $(".dp .js-range-slider02, .sch_result .js-range-slider02");
	var $inputFrom = $("#dcrate_input_from");
	var $inputTo = $("#dcrate_input_to");
	var instance;

	instance = $range.data("ionRangeSlider");
	instance.update({
		from: min
	});
	$inputFrom.val(min);

	instance.update({
		to: max
	});
	$inputTo.prop("value",max);
	fnSetFilterHtml();
}

var fnFilterSlider = function (gubun, min, max){
	fnCategoryGoodsInfiniteScrollInit();
	let tag = '';
	let oriMin = '';
	let oriMax = '';
	filterHtml = '';
	filterStatHtml = '';
	filterStatHtml = $("#filterData").html();
	// $("#searchGoodsForm").find('input[name=priceFrom]').remove();
	// $("#searchGoodsForm").find('input[name=priceTo]').remove();
	// $("#searchGoodsForm").find('input[name=dcRateFrom]').remove();
	// $("#searchGoodsForm").find('input[name=dcRateTo]').remove();
	$("#searchGoodsForm").find('input[name=priceArr]').remove();
	$("#searchGoodsForm").find('input[name=dcRateArr]').remove();
	if(gubun=='price'){
		oriMin = $("#price_input_from").val();
		oriMax = $("#price_input_to").val();
	}else{
		oriMin = $("#dcrate_input_from").val();
		oriMax = $("#dcrate_input_to").val();
	}

	if(gubun=='price'){
		if(min!=max){
			tag += '<span id="priceSpan">'+ min +'원~'+max+'원';
		}else{
			tag += '<span id="priceSpan">'+max+'원';
		}
		$("#filterForm").find('input[name=hPriceFrom]').val(min);
		$("#filterForm").find('input[name=hPriceTo]').val(max);
	}else{
		if(min!=max){
			tag += '<span id="dcrateSpan">'+ min +'~'+max+'%';
		}else{
			tag += '<span id="dcrateSpan">'+max+'%';
		}
		$("#filterForm").find('input[name=hDcRateFrom]').val(min);
		$("#filterForm").find('input[name=hDcRateTo]').val(max);
	}
	tag += '<a href="javascript:void(0);" class="filter_delete" onclick="fnDeleteFilterSlider(this,\''+gubun+'\', \''+oriMin+'\', \''+oriMax+'\');"></a >';
	tag += '</span>';

	$("#filterData").append(tag);
	filterStatHtml += tag;

	var tag2 = '';
	if(gubun=='price'){
		// tag2 += '<input type="hidden" name="priceFrom" value="'+min.replace(",", "")+'"/>\n';
		// tag2 += '<input type="hidden" name="priceTo" value="'+max.replace(",", "")+'"/>\n';
		tag2 += '<input type="hidden" name="priceArr" value="'+min.replaceAll(",", "")+','+max.replaceAll(",", "")+'"/>\n';
		$("#searchGoodsForm").append(tag2);
		// filterHtml += tag2;
		// fnCategoryGoodsInfiniteScrollInit();
	}else{
		// tag2 += '<input type="hidden" name="dcRateFrom" value="'+min+'"/>\n';
		// tag2 += '<input type="hidden" name="dcRateTo" value="'+max+'"/>\n';
		tag2 += '<input type="hidden" name="dcRateArr" value="'+min+','+max+'"/>\n';
		$("#searchGoodsForm").append(tag2);
		// fnCategoryGoodsInfiniteScrollInit();
		// filterHtml += tag2;
	}
	gagaInfiniteScroll.pageStatus.filterStatHtml = filterStatHtml;
	fnSetFilterHtml();
	fnGoodsListSearch();
}

var fnDeleteFilterSlider = function (obj, gubun, minVal, maxVal){
	filterStatHtml = '';
	filterStatHtml = $("#filterData").html();
	if(gubun=='price'){
		// $("#searchGoodsForm").find("input:hidden[name=priceFrom]").remove();
		// $("#searchGoodsForm").find("input:hidden[name=priceTo]").remove();
		$("#searchGoodsForm").find("input:hidden[name=priceArr]").remove();
		var $range = $(".dp .js-range-slider01, .sch_result .js-range-slider01");
		var $inputFrom = $("#price_input_from");
		var $inputTo = $("#price_input_to");
		var instance;

		instance = $range.data("ionRangeSlider");
		instance.update({
			from: 0
		});
		$inputFrom.val(minVal);

		instance.update({
			to: 5
		});
		$inputTo.prop("value",maxVal);
		$("#filterForm input:hidden[name=priceArr]").remove();
		// $("#filterForm input:hidden[name=priceFrom]").remove();
		// $("#filterForm input:hidden[name=priceTo]").remove();
	}else{
		// $("#searchGoodsForm").find("input:hidden[name=dcRateFrom]").remove();
		// $("#searchGoodsForm").find("input:hidden[name=dcRateTo]").remove();
		$("#searchGoodsForm").find("input:hidden[name=dcRateArr]").remove();
		var $range = $(".dp .js-range-slider02, .sch_result .js-range-slider02");
		var $inputFrom = $("#dcrate_input_from");
		var $inputTo = $("#dcrate_input_to");
		var instance;

		instance = $range.data("ionRangeSlider");
		instance.update({
			from: 0
		});
		$inputFrom.prop("value",minVal);

		instance.update({
			to: 10
		});
		$inputTo.prop("value",maxVal);
		$("#searchGoodsForm input:hidden[name=dcRateArr]").remove();
		// $("#searchGoodsForm input:hidden[name=dcRateFrom]").remove();
		// $("#searchGoodsForm input:hidden[name=dcRateTo]").remove();
	}
	$(obj).closest("span").remove();
	fnSetFilterHtml();
	fnCategoryGoodsInfiniteScrollInit();
	fnGoodsListSearch();
}

// 정렬 순서
var fnSortingChange = function (obj, sortingType, stat, appGb){
	console.log('here sort');
	fnCategoryGoodsInfiniteScrollInit();
	if(stat != 'back'){
		// if($("#searchGoodsForm input[name=sortingType]").val()==sortingType){
		// 	return;
		// }
	}

	if(appGb != 'Mob'){
		$("#sortArea").find('li').each(function (){
			$(this).find('a').attr('class','off');
		});
	}else{
		$("#sortArea").find('button').each(function (){
			$(this).removeClass("on");
		});
		$("#sorting"+sortingType).addClass("on");
		$("#filter").text($("#sorting"+sortingType).find('span').text());
	}

	$(obj).addClass("on");
	if(stat=='back'){
		$("#sorting"+sortingType).addClass("on");
	}
	$("#searchGoodsForm").find("[name=sortingType]").val(sortingType);
	$("#searchGoodsForm").find("[name=pageNo]").val(1);
	gagaInfiniteScroll.pageStatus.loadPage = 1;
	gagaInfiniteScroll.pageStatus.pageNum = [];
	gagaInfiniteScroll.pageStatus.sortingType = sortingType;

	$('#endPage').hide();
	$('#noFilterData').hide();
	console.log('here sort2');
	fnGoodsListSearch();
}

// 모바일 가격 필터
var filterPriceMob = function (obj, gubun, staus, idx){
	if(staus=='on'){
		$(obj).attr('onclick','fnResetListIdx();filterPriceMob(this,\''+gubun+'\',\'off\',\''+idx+'\');');
	}else{
		$(obj).attr('onclick','fnResetListIdx();filterPriceMob(this,\''+gubun+'\',\'on\',\''+idx+'\');');
	}

	fnFilterSet(gubun, 'price', 'Mob');
}

var filterPriceMobOri = function (obj, gubun, staus, idx){
	$("#searchGoodsForm input:hidden[name=priceFrom]").remove();
	$("#searchGoodsForm input:hidden[name=priceTo]").remove();

	if(staus=='on'){
		$(obj).attr('onclick','fnResetListIdx();filterPriceMob(this,\''+gubun+'\',\'off\',\''+idx+'\');');
	}else{
		$(obj).attr('onclick','fnResetListIdx();filterPriceMob(this,\''+gubun+'\',\'on\',\''+idx+'\');');
	}

	$('#filterForm input[name=price]').each(function (ind){
		$(this).prop("checked",false);
	});

	let price = $(obj).val().split(",");
	let min = price[0];
	let max = price[1];
	var tag2 = '';

	if(staus=='off'){
		$("#price"+idx).prop("checked",true);
		if(max<1){
			tag2 += '<input type="hidden" name="priceFrom" value="'+min.replace(",", "")+'"/>\n';
		}else{
			tag2 += '<input type="hidden" name="priceFrom" value="'+min.replace(",", "")+'"/>\n';
			tag2 += '<input type="hidden" name="priceTo" value="'+max.replace(",", "")+'"/>\n';
		}
	}else{
		$("#searchGoodsForm input:hidden[name=priceFrom]").remove();
		$("#searchGoodsForm input:hidden[name=priceTo]").remove();
	}
	$("#filterForm").find('input[name=hPriceFrom]').val(min);
	$("#filterForm").find('input[name=hPriceTo]').val(max);

	$('#priceFilterDiv').find('.daps1').find('span').html('');
	$('#filterForm input[name=price]:checked').each(function(index){
		$("#priceFilterDiv").find('.daps1').append('<span class="pic">'+$("#pricdSpan"+idx).text()+'</span>');
	});

	$("#searchGoodsForm").append(tag2);
	// filterHtml += tag2;
	fnCategoryGoodsInfiniteScrollInit();

	// gagaInfiniteScroll.pageStatus.filterHtml = filterHtml;
	// gagaInfiniteScroll.pageStatus.filterStatHtml = filterStatHtml;
	fnSetFilterHtml('','','Mob');
	fnGoodsListSearch();
}

// 모바일 할인 필터
var filterDcRateMob = function (obj, gubun, staus, idx){
	if(staus=='on'){
		$(obj).attr('onclick','fnResetListIdx();filterDcRateMob(this,\''+gubun+'\',\'off\',\''+idx+'\');');
	}else{
		$(obj).attr('onclick','fnResetListIdx();filterDcRateMob(this,\''+gubun+'\',\'on\',\''+idx+'\');');
	}
	fnFilterSet(gubun, 'dcRate', 'Mob');
}

var filterDcRateMobOri = function (obj, gubun, staus, idx){
	$("#searchGoodsForm input:hidden[name=dcRateFrom]").remove();
	$("#searchGoodsForm input:hidden[name=dcRateTo]").remove();

	if(staus=='on'){
		$(obj).attr('onclick','fnResetListIdx();filterDcRateMob(this,\''+gubun+'\',\'off\',\''+idx+'\');');
	}else{
		$(obj).attr('onclick','fnResetListIdx();filterDcRateMob(this,\''+gubun+'\',\'on\',\''+idx+'\');');
	}

	$('#filterForm input[name=dcRate]').each(function (ind){
		$(this).prop("checked",false);
	});

	let dcRate = $(obj).val().split(",");
	let min = dcRate[0];
	let max = dcRate[1];
	var tag2 = '';

	if(staus=='off') {
		$("#discount" + idx).prop("checked", true);
		if(max<1){
			tag2 += '<input type="hidden" name="dcRateFrom" value="'+min.replace(",", "")+'"/>\n';
		}else{
			tag2 += '<input type="hidden" name="dcRateFrom" value="'+min.replace(",", "")+'"/>\n';
			tag2 += '<input type="hidden" name="dcRateTo" value="'+max.replace(",", "")+'"/>\n';
		}
	}else{
		$("#searchGoodsForm input:hidden[name=dcRateFrom]").remove();
		$("#searchGoodsForm input:hidden[name=dcRateTo]").remove();
	}
	$("#filterForm").find('input[name=hDcRateFrom]').val(min);
	$("#filterForm").find('input[name=hDcRateTo]').val(max);

	$('#dcRateFilterDiv').find('.daps1').find('span').html('');
	$('#filterForm input[name=dcRate]:checked').each(function(index){
		$("#dcRateFilterDiv").find('.daps1').append('<span class="pic">'+$("#dcRateText"+idx).text()+'</span>');
	});

	$("#searchGoodsForm").append(tag2);
	// filterHtml += tag2;
	fnCategoryGoodsInfiniteScrollInit();

	// gagaInfiniteScroll.pageStatus.filterHtml = filterHtml;
	// gagaInfiniteScroll.pageStatus.filterStatHtml = filterStatHtml;
	fnSetFilterHtml('','','Mob');
	fnGoodsListSearch();

}

// 상품상세 필터 조회
var fnSelectFilerMob = function (obj, gubun, staus, sizeGb){
	gagaInfiniteScroll.pageStatus.filterHtml = filterHtml;
	gagaInfiniteScroll.pageStatus.filterStatHtml = filterStatHtml;
	let $obj = $(obj);
	if(staus=='on'){
		if(gubun=='size'){
			$(obj).attr('onclick','fnResetListIdx();fnSelectFilerMob(this,\''+gubun+'\',\'off\',\''+sizeGb+'\');');
		}else{
			$(obj).attr('onclick','fnResetListIdx();fnSelectFilerMob(this,\''+gubun+'\',\'off\',\'\');');
		}

		$("#filterData").find('span').each(function(idx,item) {
			if(gubun=='color'){
				if($obj.attr('data-id').replace('#','').trim() == $(this).closest("span").attr('id')) {
					$(this).closest("span").remove();
				}
			}else{
				if($obj.attr('data-id') == $(this).closest("span").text()) {
					$(this).closest("span").remove();
				}
			}
		});
	}else{
		if(gubun=='size'){
			$(obj).attr('onclick','fnResetListIdx();fnSelectFilerMob(this,\''+gubun+'\',\'on\',\''+sizeGb+'\');');
		}else{
			$(obj).attr('onclick','fnResetListIdx();fnSelectFilerMob(this,\''+gubun+'\',\'on\',\'\');');
		}
	}
	fnFilterSet(gubun, sizeGb, 'Mob');
}

var fnReCheckFilterList = function (){
	var searchId = '';
	$('#filterForm').find('.allFilter').find('.chkFilter').each(function() {
		if(!gagajf.isNull($(this).attr('id'))){
			if($(this).attr('id') == 'sizeFilterDiv'){
				searchId = 'size';
			}else{
				searchId = $(this).attr('id').replace('FilterDiv','');
			}
		}

		if(!gagajf.isNull(searchId)){
			var data = '';
			if(searchId == 'price'){
				let priceSpan = '';
				$('#searchGoodsForm').find('input[name=priceArr]').each(function (idx){
					let formPrice = $(this).val();
					$('#filterForm #priceArea').find('li').each(function(index){
						let filterPrice = $(this).find('input[name=price]').val();
						if(formPrice == filterPrice){
							$("#price"+(index+1)).prop('checked',true);
							if(idx>0){
								priceSpan += ',';
							}
							priceSpan += $("#pricdSpan"+(index+1)).text();
						}
					});
				});
				// $('#filterForm #priceArea').find('li').each(function(index){
				// 	if($(this).find('input[name=price]').prop('checked') == true){
				// 		if(index > 0){
				// 			priceSpan += ',';
				// 		}
				// 		priceSpan += $("#pricdSpan"+(index+1)).text();
				// 	}
				// });
				$("#priceFilterDiv").find('.daps1').append('<span class="pic">'+priceSpan+'</span>');
			}else if(searchId == 'dcRate'){
				let dcRateSpan = '';
				$('#filterForm #dcRateArea').find('li').each(function(index){
					if($(this).find('input[name=dcRate]').prop('checked') == true){
						if(index > 1){
							dcRateSpan += ',';
						}
						dcRateSpan += $("#dcRateText"+(index+1)).text();
					}
				});
				$("#dcRateFilterDiv").find('.daps1').append('<span class="pic">'+dcRateSpan+'</span>');
			}else{
				$('#filterForm input[name='+searchId+']:checked').each(function(idx){
					if(searchId=='color'){
						$('#'+searchId+'FilterDiv').find('.daps1').find('.pic').find('span').html('');
						var mobTag = '';
						var color = $(this).attr('data-id');
						console.log('color::'+$(this).attr('data-id'));
						if(color=='FFFFFF'){
							mobTag += '<span class="pdColor-color" style="background-color:#'+color+';border:1px solid #aaa;"></span>';
						}else{
							mobTag += '<span class="pdColor-color" style="background-color:#'+color+'"></span>';
						}
						$("#"+searchId+"FilterDiv").find('.daps1').find('.pic').append(mobTag);
					}else if(searchId=='brandGroup'){
						$('#'+searchId+'FilterDiv').find('.daps1').find('span').html('');
						if(idx>0){
							data += ',';
						}
						data += $(this).attr('data-id');
						$("#"+searchId+"FilterDiv").find('.daps1').append('<span class="pic">'+data+'</span>');
					}else if(searchId=='size'){
						$('#'+searchId+'FilterDiv').find('.daps1').find('span').html('');
						if(idx>0){
							data += ',';
						}
						data += $(this).attr('data-id');
						$("#"+searchId+"FilterDiv").find('.daps1').append('<span class="pic">'+data+'</span>');
					}else if(searchId=='season'){
						$('#'+searchId+'FilterDiv').find('.daps1').find('span').html('');
						if(idx>0){
							data += ',';
						}
						data += $(this).attr('data-id');
						$("#"+searchId+"FilterDiv").find('.daps1').append('<span class="pic">'+data+'</span>');
					}else if(searchId=='benefit'){
						$('#'+searchId+'FilterDiv').find('.daps1').find('span').html('');
						if(idx>0){
							data += ',';
						}
						data += $(this).attr('data-id');
						$("#"+searchId+"FilterDiv").find('.daps1').append('<span class="pic">'+data+'</span>');
					}else{
						$('#'+searchId+'FilterDiv').find('.daps1').find('span').html('');
						if(idx>0){
							data += ',';
						}
						data += $(this).attr('data-id');
						$("#"+searchId+"FilterDiv").find('.daps1').append('<span class="pic">'+data+'</span>');
					}
				});
			}

		}

	});
}

/*window.addEventListener('beforeunload', (event) => {
	console.log('addEventListener-1');
	// 표준에 따라 기본 동작 방지
	event.preventDefault();
	// Chrome에서는 returnValue 설정이 필요함
	// event.returnValue = '';
	console.log('addEventListener-2');
	let scrollTop = document.documentElement.scrollTop;
	console.log('addEventListener->'+scrollTop);
	gagaInfiniteScroll.pageStatus.backScroll = scrollTop;

});*/

var fnClickGoodsCd = function (goodsCd, mainColorCd){
	// let scrollTop = document.documentElement.scrollTop;
	// gagaInfiniteScroll.pageStatus.backScroll = scrollTop;
	let scrollpos = $(window).scrollTop();
	localStorage.setItem('scrollpos', scrollpos);
	gagajf.setCookie("scrollpos", scrollpos);

	// fnPushHistory();
	cfnGoToGoodsDetail(goodsCd, mainColorCd);
}

var fnPushHistory = function(){
	gagaInfiniteScroll.pushHistory(
		gagaInfiniteScroll.pageStatus.nowPage
		, $(window).scrollTop()
		, $('#container').height()
		, gagaInfiniteScroll.pageStatus.loadPage
		, 0
		, gagaInfiniteScroll.obj.$ajaxBox.html()
		, gagaInfiniteScroll.pageStatus.backScroll
	);
}

// 필터 초기화
var fnFilterReset = function (){
	//document.location.href = currUrl;
	$("#searchGoodsForm input:hidden[name=brandGroupArr]").remove();
	$("#searchGoodsForm input:hidden[name=sizeArr]").remove();
	// $("#searchGoodsForm input:hidden[name=dcRateFrom]").remove();
	// $("#searchGoodsForm input:hidden[name=dcRateTo]").remove();
	// $("#searchGoodsForm input:hidden[name=priceFrom]").remove();
	// $("#searchGoodsForm input:hidden[name=priceTo]").remove();
	$("#searchGoodsForm input:hidden[name=priceArr]").remove();
	$("#searchGoodsForm input:hidden[name=dcRateArr]").remove();
	$("#searchGoodsForm input:hidden[name=ageArr]").remove();
	$("#searchGoodsForm input:hidden[name=seasonArr]").remove();
	$("#searchGoodsForm input:hidden[name=colorArr]").remove();
	$("#searchGoodsForm input:hidden[name=benefitArr]").remove();
	$("#searchGoodsForm input:hidden[name=newGoods]").val('');
	$("#unisex").prop('checked',false);
	$("#unisex").attr('onclick','fnResetListIdx();fnFilterOption(this,\'on\');');
	$("#searchGoodsForm input:hidden[name=unisex]").remove();
	$("#newGoods").prop('checked',false);
	$("#newGoods").attr('onclick','fnResetListIdx();fnFilterOption(this,\'on\');');
	// $("#searchGoodsForm input:hidden[name=newGoods]").val('40');

	fnFilterSliderMove(0,5);
	fnDcRateFilterSliderMove(0,10);
	$('.filter_content .sort').find('input[type=checkbox]').each(function (idx){
		$(this).prop('checked',false);
	});
	gagaInfiniteScroll.pageStatus.filterHtml = '';
	gagaInfiniteScroll.pageStatus.filterStatHtml = '';
	$("#filterData").html('');
	fnCategoryGoodsInfiniteScrollInit();
	fnGoodsListSearch();
}

// 필터 초기화
var fnMobFilterReset = function (){
	$(".list_defult").hide();
	$("#searchGoodsForm input:hidden[name=brandGroupArr]").remove();
	$("#searchGoodsForm input:hidden[name=sizeArr]").remove();
	$("#searchGoodsForm input:hidden[name=dcRateFrom]").remove();
	$("#searchGoodsForm input:hidden[name=dcRateTo]").remove();
	$("#searchGoodsForm input:hidden[name=priceFrom]").remove();
	$("#searchGoodsForm input:hidden[name=priceTo]").remove();
	$("#searchGoodsForm input:hidden[name=ageArr]").remove();
	$("#searchGoodsForm input:hidden[name=seasonArr]").remove();
	$("#searchGoodsForm input:hidden[name=colorArr]").remove();
	$("#searchGoodsForm input:hidden[name=benefitArr]").remove();
	$("#searchGoodsForm input:hidden[name=newGoods]").val('');
	$("#unisex").prop('checked',false);
	$("#unisex").attr('onclick','fnResetListIdx();fnFilterOption(this,\'on\');');
	$("#searchGoodsForm input:hidden[name=unisex]").remove();
	$("#newGoods").prop('checked',false);
	$("#newGoods").attr('onclick','fnResetListIdx();fnFilterOption(this,\'on\');');
	$('.allFilter .chkFilter').find('input[type=checkbox]').each(function (idx){
		$(this).prop('checked',false);
	});
	$('.allFilter .chkFilter .daps1').find('span').each(function (idx){
		$(this).remove();
	});
	gagaInfiniteScroll.pageStatus.filterHtml = '';
	gagaInfiniteScroll.pageStatus.filterStatHtml = '';
	fnCategoryGoodsInfiniteScrollInit();
	fnGoodsListSearch();
}

//****************상품리스트  end **********************************