<!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/GoodsLayoutMob">
<!--
 *******************************************************************************
 * @source  : GoodsDealDetailFormMob.html
 * @desc	: 딜 상품상세 Page
 *============================================================================
 * STYLE24
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE		 AUTHOR	  DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.04.15   eskim	   최초 작성
 *******************************************************************************
 -->
<body>
<th:block layout:fragment="content">
<script type="text/javascript" th:src="${@environment.getProperty('naverPay.button.mobile.js.url')}" src="" charset="UTF-8"></script>
<script type="text/javascript" src="https://wcs.naver.net/wcslog.js"></script>
<form id="nPayForm" name="nPayForm"></form>
<form id="nPayWishForm" name="nPayWishForm" method="get">
	<input type="hidden" name="SHOP_ID" />
	<input type="hidden" name="ITEM_ID" />
</form>
<form name="cartForm" id="cartForm" method="post">
		<input type="hidden" name="mode">
		<input type="hidden" name="goodsCd" th:value="${params.goodsCd}" />
		<input type="hidden" name="contentsLoc" th:value="${params.contentsLoc}" />
		<input type="hidden" name="ithrCd"  th:value="${params.ithrCd}" />
		<input type="hidden" name="planDtlSq" th:value="${params.planDtlSq}" />
		<input type="hidden" name="adminYn" th:value="${params.adminYn}" />
		<input type="hidden" name="optCd" />
		<input type="hidden" name="optCd1" />
		<input type="hidden" name="optCd2" />
		<input type="hidden" name="addPrice" />
		<input type="hidden" name="ordQty" />
		<input type="hidden" name="stock" />
		<input type="hidden" name="minOrdQty"/>
		<input type="hidden" name="maxOrdQty"/>
		<input type="hidden" name="currPrice" th:value="${goodsInfo.currPrice}"/>
		<input type="hidden" name="goodsType" th:value="${goodsInfo.goodsType}"/>
		<input type="hidden" name="selfGoodsYn" th:value="${goodsInfo.selfGoodsYn}"/>
<main role="" id="" class="container pd deal" th:with="imgGoodsUrl=${@environment.getProperty('upload.goods.view')}, uxImgUrl=${@environment.getProperty('domain.uximage')}, imgUrl=${@environment.getProperty('upload.image.view')}">

	<!-- ★ 컨텐츠 시작 -->
	<section class="pd_detail">

		<!-- 210409_ 구조변경 : .pd_info, .pd_info1 추가  -->
		<div class="pd_info">
			<div class="pd_info1" data-speed="10">

				<div class="inner wide" th:if="${goodsImgList != null and !goodsImgList.empty}">
					<div class="thumb_box">
						<div class="area_slider">
							<div class="swiper-container thumb_list">
								<div class="swiper-wrapper">
									<th:block th:each="goodsImg, status : ${goodsImgList}">
									<div class="swiper-slide" th:if="${ not (#strings.contains(goodsImg.sysImgNm,'_F1.') 
																or #strings.contains(goodsImg.sysImgNm,'_L1.')
																or #strings.contains(goodsImg.sysImgNm,'_L2.'))}">
										<div class="thumb" ><img th:src="${imgGoodsUrl+'/'+goodsImg.sysImgNm+'?RS=1080'}" alt="" th:onerror="'this.src=\''+@{${uxImgUrl}+ '/images/pc/thumb/bg_item_none.png'}+'\';'"></div></div>  <!--  mov -->
									</th:block>	
								</div>
								<!-- Add Pagination -->
								<div class="swiper-pagination"></div>
							</div>
						</div>
					</div>
				</div>

			</div>
			
			<div class="inner">
				<!-- 210409_ 구조변경 : .covered 추가  -->
				<div class="covered">
					<div class="timer_box" style="display:none;">
						<p>
							<span class="tt">남은시간</span>
							<span class="timer">
								<em id="d-days">0</em>
								<em id="d-hours">0</em>
								<em id="d-minutes">0</em>
								<em id="d-seconds">0</em>
							</span>
						</p>
					</div>
					<div class="descript_box">
						<p class="name" th:text="${goodsInfo.goodsFullNm}">유니 삼단블록 플리스 집업</p>
						<p class="comment"  th:text="${goodsInfo.goodsTnm}">#가을 느낌 물씬!</p>
						<p class="price_blk">
							<span class="sale_price" ><em th:text="${#numbers.formatInteger(goodsInfo.currPrice, 0,'COMMA')}">134,100</em>원 ~</span>
						</p>
						<div class="btn_group_flex">
							<div><button type="button" class="btn btn_default" id="btn_saleCoupon_pop" th:if="${goodsCouponList != null and !goodsCouponList.empty}" th:onclick="cfGoodsCouponInfo([[${goodsInfo.goodsCd}]],[[${goodsInfo.goodsType}]])">쿠폰받기</button></div>
						</div>
					</div>
				</div>
			</div>

			<div class="inner wide" th:if="${not #strings.isEmpty(goodsInfo.delvResDt) }">
				<div class="desc_status">예약판매 상품 - <em th:text="${goodsInfo.delvResDt}">2020.12.30</em> 출고예정</div>
			</div>
			
			<div class="inner" th:if="${(cardInfoList != null and !cardInfoList.empty) or
									(goodsCouponList != null and !goodsCouponList.empty) or
									(tmtbList != null and !tmtbList.empty) or
									(freeGoodsList != null and !freeGoodsList.empty) or 
									(goodsCoupon1List != null and !goodsCoupon1List.empty)}" >
				<div class="benefit_box">
					<dl class="bnf_shopping" th:if="${(goodsCouponList != null and !goodsCouponList.empty) or 
													(tmtbList != null and !tmtbList.empty) or
													(freeGoodsList != null and !freeGoodsList.empty) or 
													(goodsCoupon1List != null and !goodsCoupon1List.empty)}">
						<dt>쇼핑혜택</dt>
						<dd>
							<th:block th:if="${goodsCoupon1List != null and !goodsCoupon1List.empty}">
								<span th:each="goodsCoupon, status : ${goodsCoupon1List}" th:if="${status.first}"><em>
									<th:block th:if="${goodsCoupon.dcWay == 'G240_10'}" th:text="|${#numbers.formatInteger(goodsCoupon.dcVal, 0,'COMMA')}원|"></th:block>
									<th:block th:unless="${goodsCoupon.dcWay == 'G240_10'}" th:text="|${goodsCoupon.dcVal}%|"></th:block>
									</em> 즉시할인
								</span>
							</th:block> 
							<th:block th:if="${goodsCouponList != null and !goodsCouponList.empty}">
								<span th:each="goodsCoupon, status : ${goodsCouponList}" th:if="${status.first}">최대 <em>
									<th:block th:if="${goodsCoupon.dcWay == 'G240_10'}" th:text="|${#numbers.formatInteger(goodsCoupon.dcVal, 0,'COMMA')}원|"></th:block>
									<th:block th:unless="${goodsCoupon.dcWay == 'G240_10'}" th:text="|${goodsCoupon.dcVal}%|"></th:block>
									</em> 쿠폰 할인
								</span>
							</th:block> 
							<th:block th:if="${tmtbList != null and !tmtbList.empty}">
								<span th:each="tmtb, status : ${tmtbList}" th:if="${status.first}">
									<em><th:block th:text="${#numbers.formatInteger(tmtb.sectionVal, 0,'COMMA')}"></th:block><th:block th:text="${(tmtb.sectionGb == 'G810_10')? '개':'금액'}"></th:block></em> 이상 구매 시 
									<em><th:block th:text="${#numbers.formatInteger(tmtb.dcVal, 0,'COMMA')}"></th:block><th:block th:text="${(tmtb.dcWay == 'G240_10')? '원':'%'}"></th:block></em></em> 할인
								</span>
							</th:block>
							<span th:if="${freeGoodsList != null and !freeGoodsList.empty}">
							<th:block th:each="freeGoods, status : ${freeGoodsList}" th:if="${status.first}">
							<th:block th:text="${freeGoods.goodsNm}"></th:block> 증정 <th:block th:if="${freeGoods.allYn == 'Y'}" th:text="${'외 택1'}"></th:block></span>
							<button type="button" id="btn_bnfShopping_pop" class="btn_popup" th:onclick="cfGoodsShopBenefitInfo([[${goodsInfo.goodsCd}]])"><span>자세히</span></button>
						</dd>
					</dl>
					<dl class="bnf_card"  th:if="${cardInfoList != null and !cardInfoList.empty}">
						<dt>카드혜택</dt>
						<dd>
							<th:block th:each="cardInfo, status : ${cardInfoList}">
							<span th:if="${cardInfo.prmtGb == 'A' and cardInfo.dcGb != '3'}"><th:block th:text="${cardInfo.prmtTargetNm}"></th:block> <em><th:block th:text="${#numbers.formatInteger(cardInfo.dcVal, 0,'COMMA')+ cardInfo.dcWayNm}"></th:block></em> <th:block th:text="${cardInfo.prmtGbNm}"></span>
							<span th:if="${cardInfo.prmtGb == 'A' and cardInfo.dcGb == '3'}" th:text="${cardInfo.prmtNm}">프로모션명</span>
							<span th:if="${cardInfo.prmtGb == 'B'}">신용카드 무이자 혜택</span>
							</th:block>
							<button type="button" id="btn_bnfCard_pop" class="btn_popup" onclick="cfCardInfo();return false;"><span>자세히</span></button>
						</dd>
					</dl>
				</div>
			</div>
		</div>

		<!-- //***** 상품소개영역 ***** -->
		<th:block th:include="~{mob/goods/GoodsIncludeFormMob:: goodsDealComposeForm}"></th:block>

		<div class="inner" >
			<div class="recommendedArea">
				<!-- 이상품과 함께 본 상품영역-->
				<div class="pd_clickother" id="goodsTogetherbArea">
				</div>
				<!-- //이상품과 함께 본 상품영역-->
			</div>
		</div>
 
		<!-- 팝업영역 -->
		<div>
			<!-- 구매하기팝업 -->
			<div class="btPop btPopAuto pd_pop Purchase_pop" id="btPopAuto_back">
				<a href="javascript:void(0);"  class="btn btPop_close">Close </a>
				<div class="header btPop_head btPopAuto_head">
					구매하기팝업
				</div>
				<div class="body btPop_body btPopAuto_body">
					<div class="option_result op1">
						<!-- 옵션 -->
						<div class="option_box">
							<div class="opt_select">
								<div class="form_wrap">
									<div class="form_field">
										<div class="select_custom option_open">
											<div class="combo">
												<div class="select">옵션을 선택해주세요.</div>
											</div>
										</div>
									</div>
								</div>
							</div>
							<div class="opt_result">
							</div>
						</div>
						<div style="margin-top:10px;">
							<th:block th:if="${sessionInfo != null and (sessionInfo.custId == 'xodud1202' or sessionInfo.custId == 'jsh77b' or sessionInfo.custId == 'card007')}">
								<th:block th:with="buttonKey=${@environment.getProperty('naverPay.button.key')}">
									<script type="text/javascript" th:src="${@environment.getProperty('naverPay.button.mobile.js.url')}" src="" charset="UTF-8"></script>

									<script th:inline="javascript">
										if(!wcs_add) var wcs_add = {};
										wcs_add["wa"] = "[[${@environment.getProperty('naverPay.common.certification.key')}]]";
										wcs.inflow("style24.com");
										wcs_do();
									</script>

									<script type="text/javascript" >
										/*버튼설정*/
										naver.NaverPayButton.apply({
											BUTTON_KEY              : "[[${buttonKey}]]",       // 네이버페이에서 제공받은 버튼 인증 키 입력
											TYPE                    : "MA",                      // 버튼 모음 종류 설정
											COLOR                   : 1,                        // 버튼 모음의 색 설정
											COUNT                   : 2,                        // 버튼 개수 설정. 구매하기 버튼만 있으면(장바구니 페이지) 1, 찜하기 버튼도 있으면(상품 상세 페이지) 2를 입력.
											ENABLE                  : "Y",                      // 품절 등의 이유로 버튼 모음을 비활성화할 때에는 "N" 입력
											BUY_BUTTON_HANDLER      : buy_nc,                   // 구매하기 버튼 이벤트 Handler 함수 등록, 품절인 경우 not_buy_nc 함수 사용
											WISHLIST_BUTTON_HANDLER : wishlist_nc,              // 찜하기 버튼 이벤트 Handler 함수 등록
											"":""
										});

										/*네이버구매하기*/
										function buy_nc(url) {
											// 자사 일반 상품 정보
											let compsList = [];

											$("#cartForm .result_item input[name=cea]").each(function() {
												let dealGoodsCd = "[[${goodsInfo.goodsCd}]]";
												let goodsType = "[[${goodsInfo.goodsType}]]";
												let goodsCd = $(this).parent().find("input[name=coption]").attr("goodscd");
												let optCd = $(this).attr("optcd");
												let goodsQty = $(this).val();

												if (!goodsCd) {
													mcxDialog.alert("상품정보가 존재하지 않습니다. 새로고침 후 다시 시도해주세요.");
													return false;
												}

												if (!goodsQty || goodsQty < 1) {
													mcxDialog.alert("구매 수량을 확인해주세요.");      /*수량*/
													return false;
												}

												if (!optCd) {
													mcxDialog.alert("상품 옵션을 확인 할 수 없습니다. 새로고침 후 다시 시도해주세요.");   /*옵션*/
													return false;
												}

												var obj = new Object();
												obj.cartGb = "N";
												obj.goodsType = goodsType;
												obj.goodsCd = goodsCd;
												obj.optCd = optCd;
												obj.goodsQty = goodsQty;
												obj.dealGoodsCd = $("#cartForm  input[name=goodsCd]").val();
												obj.afLinkCd =$("#cartForm  input[name=afLinkCd]").val();
												obj.ithrCd =$("#cartForm  input[name=ithrCd]").val();
												obj.contentsLoc =$("#cartForm  input[name=contentsLoc]").val();
												obj.planDtlSq = $("#cartForm  input[name=planDtlSq]").val();
												compsList.push(obj);
											});

											// 장바구니담기
											cfnAddCart(compsList);

											return false;
										}

										function buy_nc_req(cartSqArr) {
											let data = {  cartSqArr : cartSqArr
												, backUrl : location.href
												, goodsUrl : _PAGE_GOODS_DETAIL
											};
											let jsonData = JSON.stringify(data);

											$.ajax( {
												type		: "POST",
												url 		: "/pg/nPayReq",
												dataType 	: 'json',
												data		: jsonData,
												beforeSend : function(xhr, settings) {
													xhr.setRequestHeader("AJAX"			, "true");
													xhr.setRequestHeader('Accept'		, 'application/json');
													xhr.setRequestHeader('Content-Type'	, 'application/json');
												},
												error: function(xhr, status, error) {
													mcxDialog.alert(status + '; ' + error);
												},
												success : function(result) {
													if (result.state == "sucess") {
														enp('create', 'conversion', 'is24', { device: 'M', paySys: 'naverPay' });	// 모비온 네이버주문형 클릭시
														document.nPayForm.action = result.npayOrderUrl + "/" + result.orderKey + "/" + result.resultNo;
														document.nPayForm.submit();
													} else {
														mcxDialog.alert(result.message);
													}
												}
											});
										}

										<!-- 구매불가 -->
										function not_buy_nc() {
											mcxDialog.alert("죄송합니다. 네이버페이로 구매가 불가한 상품입니다.");
											return false;
										}
										
										<!-- 찜하기 -->
										function wishlist_nc() {
											let goodsCd = "[[${goodsInfo.goodsCd}]]";
											let goodsNm = "[[${goodsInfo.goodsNm}]]";
											let colorCd = "[[${goodsInfo.colorCd}]]";
											let currPrice = "[[${goodsInfo.currPrice}]]";
											let sysImgNm = "[[${goodsInfo.sysImgNm}]]";
											let selfGoodsYn = "[[${goodsInfo.selfGoodsYn}]]";
											
											let data = {};
											data.goodsCd = goodsCd;
											data.goodsNm = goodsNm;
											data.colorCd = colorCd;
											data.currPrice = currPrice;
											data.sysImgNm = sysImgNm;
											data.selfGoodsYn = selfGoodsYn;
											
											let jsonData = JSON.stringify(data);
											
											$.ajax({
												type: "POST",
												url: "/pg/create/npay/zzim",
												dataType: 'json',
												data: jsonData,
												beforeSend: function (xhr, settings) {
													xhr.setRequestHeader("AJAX", "true");
													xhr.setRequestHeader('Accept', 'application/json');
													xhr.setRequestHeader('Content-Type', 'application/json');
												},
												error: function (xhr, status, error) {
													mcxDialog.alert(status + '; ' + error);
												},
												success: function (result) {
													if (result.state == "success") {
														$('#nPayWishForm input[name=SHOP_ID]').val(result.shopId);
														$('#nPayWishForm input[name=ITEM_ID]').val(result.itemId);

														document.nPayWishForm.action = result.actionMobile;
														document.nPayWishForm.submit();
													} else {
														mcxDialog.alert(result.message);
													}
												}
											});
										}
									</script>
								</th:block>
							</th:block>
						</div>
					</div>
				</div>
				<div class="body btPop_foot btPopAuto_foot">
					<!-- 총 결재금액, 하단버튼 -->
					<div class="pay_box">
						<div class="price_box"  style="display:none;">
							<p class="number">
								총&nbsp;<span id="goodsTotalQty">0</span>개
							</p>
							<p class="price">
								<span><b id="goodsTotalPrice">0</b><em>원</em></span>
							</p>
						</div>
						<div class="btn_box">
							<button type="button" class="gift" id="btnGift" onclick="fnAddCart('G','Up');" style="display:none;">
								<span><span>선물해보세요!</span></span>
							</button>
							<th:block  th:if="${goodsInfo.stockQty > 0 and goodsInfo.goodsStat == 'G008_90'}">
							<button type="button" class="cart" id="btnGoodsWish" onclick="fnAddCart('C','Up');" >쇼핑백</button>
							<button type="button" class="buyNow" id="btnGoodsCart" onclick="fnAddCart('O','Up');">바로구매</button>
							</th:block>
							<th:block  th:unless="${goodsInfo.stockQty > 0 and goodsInfo.goodsStat == 'G008_90'}">
							<button class="cantbuying" style="display:block;">SOLD OUT</button>
							</th:block>
						</div>
					</div>
				</div>
			</div>
			<!-- 구매하기팝업 -->
			
			<!-- 210528_옵션선택팝업 분리 -->
			<!-- 옵션선택팝업 -->
			<div class="pop_option_select">
				<div class="close">닫기</div>
				<div class="pp_body">
					<div class="pp_cont">
						<div class="opt_select">
							<div class="opt_header">
								<span class="title">옵션선택</span>
								<div class="check_excluding form_field">
									<div>
										<input id="soldoutSkipYn" name="soldoutSkipYn" type="checkbox" value="Y" th:onclick="fnDealCompsGoods('Up',[[${goodsInfo.goodsCd}]]);"><label for="soldoutSkipYn"><span>품절제외</span> </label>
									</div>
									<div class="guidance" >
										<!--210409_ 추가 : .guidance에 .ontoast 추가 시, toast 팝업 작동 -->
										<p>품절 옵션이 제외되었습니다</p>
									</div>
									<script>
										function getGuidance()  {
											if($('.pop_option_select').find('input[name=soldoutSkipYn]').is(":checked")){
												$(".guidance").addClass("ontoast");
												setTimeout(function(){$(".guidance").removeClass("ontoast");}, 5000);
											}
										}
									</script>
								</div>
							</div>
							<div class="form_wrap">
								<div class="form_field mb10" id="form_field_item_Up">
									<div class="select_custom deal_opt_item"> <!-- active -->
										<div class="combo">
											<div class="select">선택</div>
											<ul class="list">
												<!-- 선택처리 class="selected" / 선택불가 aria-disabled="true" / 품절표기 data-soldout="true" 추가  -->
												<li th:each="goodsInfo, status : ${goodsDealComposeList}" 
													th:attr="aria-disabled=${(goodsInfo.goodsStat != 'G008_90' or goodsInfo.stockQty <= 0)? 'true':''}, data-soldout=${(goodsInfo.stockQty <= 0)? 'true':''}"
													th:onclick="fnOption1('Up', [[${goodsInfo.compsGoodsCd}]], [[${goodsInfo.currPrice}]] , [[${goodsInfo.selfGoodsYn}]]);"
													 class="">
													<div class="item_prod" th:attr="goodsCd=${goodsInfo.compsGoodsCd}">
														<div class="item_state">
															<a href="javascript:void(0);" class="itemLink">
																<div class="itemPic">
																	<img alt="" class="vLHTC pd_img" th:src="${imgGoodsUrl+'/'+goodsInfo.sysImgNm+'?RS=44'}" th:onerror="'this.src=\''+@{${uxImgUrl}+ '/images/pc/thumb/bg_item_none.png'}+'\';'">
																</div>
																<div class="itemName" ><span class="tit_option" th:text="${'[상품'+status.count+']'}">[상품1]</span><th:block th:text="${goodsInfo.goodsFullNm}"></th:block></div>
																<p class="itemPrice">
																	<th:block th:text="${#numbers.formatInteger(goodsInfo.currPrice, 0,'COMMA')}"> 134,100</th:block>
																	<span class="itemPrice_original" th:if="${goodsInfo.listPrice > goodsInfo.currPrice}" th:text="${#numbers.formatInteger(goodsInfo.listPrice, 0,'COMMA')}">89,000</span>
																	<span class="itemPercent" th:if="${goodsInfo.dcRate > 0}" th:text="|${#numbers.formatDecimal(goodsInfo.dcRate,0,0)}%|">10%</span>
																</p>
															</a>
															<input type="hidden" name="selectGoods" th:attr="goodsNm=${'[상품'+status.count+']' +goodsInfo.goodsFullNm}, currPrice=${goodsInfo.currPrice}, goodsCd=${goodsInfo.compsGoodsCd}" />
														</div>
													</div>
												</li>
											</ul>
										</div>
									</div>
								</div>
								<div class="form_field" id="form_field1_Up">
									<div class="select_custom item_opt1" disabled>
										<div class="combo">
											<div class="select">선택</div>
											<ul class="list" id="goodsDealOptUp1">
												<!--  옵션 1 -->
											</ul>
										</div>
									</div>
								</div>
								<div class="form_field"  id="form_field2_Up">
									<div class="select_custom item_opt2" disabled>
										<div class="combo">
											<div class="select">선택</div>
											<ul class="list" id="goodsDealOptUp2">
												<!--  옵션 2 -->
											</ul>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!-- //옵션선택팝업 -->
		</div>
		<!-- 팝업영역 -->
	</section>
	<!-- ★ 컨텐츠 종료 -->	

	<!-- 바닥메뉴 -->	
	<div class="product_floormenu" th:classappend="${(goodsInfo.stockQty <= 0 or goodsInfo.goodsStat != 'G008_90')? 'soldout':''}"><!--  ☞☞ 제품이 품절되면 soldout클래스 추가 -->
		<div class="share_like">
			<button type="button" class="share">공유하기</button>
			<button type="button" class="itemLike" th:classappend="${goodsInfo.wishYn == 'Y'}? 'likeit active' : ''"  
					onclick="cfnPutWishList(this);" 
					th:attr="goodsCd=${params.goodsCd}, goodsNm=${goodsInfo.goodsFullNm}, ithrCd=${params.ithrCd}, contentsLoc=${params.contentsLoc}, planDtlSq=${params.planDtlSq}">위시리스트</button>
		</div>
		<div class="prd_buy">
			<button type="button" class="buying btPop_auto" id="btn_purchase">구매하기</button>
			<button type="button" class="cantbuying" >SOLD OUT</button>
		</div>
		<!-- (공통) 공유팝업 -->
		<div class="modal fade" id="tglShare" tabindex="-1" role="dialog" aria-labelledby="aModalLabel" aria-hidden="true">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title" id="aModalLabel">공유하기</h5>
					</div>
					<th:block th:include="~{mob/goods/GoodsIncludeFormMob :: goodsSnsForm}"></th:block>
				</div>
			</div>
		</div>
		<script>
			// 공유팝업
			$('.product_floormenu .share').click(function(e){
				e.preventDefault();
				$('#tglShare').modal("show");
			});
		</script>
	</div>
	<!-- //바닥메뉴 -->
</main>
</form>
<!-- 바로구매 및 선물하기 장바구니 등록 정보 저장을 위한 form -->
<form id="directOrderForm" method="POST" action="/order/noMember"></form>

<script th:inline="javascript">
/*<![CDATA[*/
	
	var cateNm = "";
	
	// 함께본 상품
	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 fnDealCompsGoods = function(flag, goodsCd){
		// 품절제외 여부
		let optionSoldoutSkip = $('.pop_option_select').find('input[name=soldoutSkipYn]').is(":checked") ? 'Y' : 'N';
		let data = {goodsCd : goodsCd
					,optionSoldoutSkip : optionSoldoutSkip 
					};
		let jsonData = JSON.stringify(data);
		
		$('.form_field .select_custom.item_opt1').attr('disabled', true);
		$('.form_field .select_custom.item_opt1').find('.combo .select').html('선택');
		$('.form_field .select_custom.item_opt2').attr('disabled', true);
		$('.form_field .select_custom.item_opt2').find('.combo .select').html('선택');
		
		gagajf.ajaxJsonSubmit('/goods/detail/compsGoods/list', jsonData, function(result) {
			if (result.dataList != null && result.dataList.length > 0) {
				let tagUpS = "";
				$.each(result.dataList, function(idx, item) {
					let tagUp = "";
					let tag1 = "";
					if (idx == 0){
							$objUp = $('.pd_detail .opt_select .select_custom.deal_opt_item');
							$objUp.remove();
						//------
						tag1 += '<div class="select_custom deal_opt_item">\n';	
						tag1 += '<div class="combo">\n';
						tag1 += '<div class="select">선택</div>\n';
						tag1 += '<ul class="list">\n';
						//------
					}
					let soldoutYn = ""; 
					let disabledYn = ""; 
					if (item.stockQty <= 0) soldoutYn = "true";
					if (soldoutYn == "true" || item.goodsStat != 'G008_90') disabledYn = "true";
					tagUp += '<li aria-disabled="'+disabledYn+'" data-soldout="'+soldoutYn +'" onclick="fnOption1(\'Up\', \''+ item.compsGoodsCd+'\', '+ item.currPrice+ ', \''+ item.selfGoodsYn+'\')">\n';
					tagUp += '	<div class="item_prod" goodsCd='+item.compsGoodsCd+'">\n';
					tagUp += '		<div class="item_state">\n';
					tagUp += '			<a href="javascript:void(0);" class="itemLink">\n';
					tagUp += '				<div class="itemPic">\n';
					tagUp += '					<img alt="" class="vLHTC pd_img" src="'+_uploadGoodsUrl+'/'+item.sysImgNm+'?RS=44" onerror="' + _uximgUrl + '/images/pc/thumb/bg_item_none.png" >\n';
					tagUp += '				</div>\n';
					tagUp += '				<div class="itemName" ><span class="tit_option">[상품'+(idx+1)+']</span> '+ item.goodsFullNm +'</div>\n';
					tagUp += '				<p class="itemPrice">\n';
					tagUp += '					 '+item.currPrice.addComma()+'\n';
					if (Number(item.listPrice) > Number(item.currPrice)){
					tagUp += '					<span class="itemPrice_original">'+item.listPrice.addComma()+'</span>\n';	
					}
					if (Number(item.dcRate) > 0){
					tagUp += '					<span class="itemPercent">'+item.dcRate+'%</span>\n';	
					}
					tagUp += '				</p>\n';
					tagUp += '			</a>\n';
					tagUp += '			<input type="hidden" name="selectGoods" goodsNm="[상품'+(idx+1)+']'+item.goodsFullNm +'" currPrice="'+ item.currPrice +'" goodsCd="'+ item.compsGoodsCd +'" />\n';
					tagUp += '		</div>\n';
					tagUp += '	</div>\n';
					tagUp += '</li>\n';
					
					tagUpS += tag1+tagUp
					
				});
				
				if (!gagajf.isNull(tagUpS)){
					//------
					tagUpS += '</ul>\n';
					tagUpS += '</div>\n';
					tagUpS += '</div>\n';
					//------	
				}
				
				$('#form_field_item_'+flag).append(tagUpS);
				var detail_deal_option = new sCombo('.pd_detail .opt_select .select_custom.deal_opt_item');
			}	
		});
		
		//품절 제외 메세지 처리
		getGuidance();
	}
	
	// 옵션1 조회
	var fnOption1 = function(flag, goodsCd, currPrice, selfGoodsYn){
		
		// 품절제외 여부
		let optionSoldoutSkip = $('.pop_option_select').find('input[name=soldoutSkipYn]').is(":checked") ? 'Y' : 'N';
		
		let data = {goodsCd : goodsCd
					,optionSoldoutSkip : optionSoldoutSkip 
					};
		let jsonData = JSON.stringify(data);
		
		$('.form_field .select_custom.item_opt1').find('.combo .select').html('선택');
		$('.form_field .select_custom.item_opt2').attr('disabled', true);
		$('.form_field .select_custom.item_opt2').find('.combo .select').html('선택');
		
		gagajf.ajaxJsonSubmit('/goods/detail/option1/list', jsonData, function(result) {
			
			if (result.dataList != null && result.dataList.length > 0) {
				
				let tagUpS = "";
				let tagUp = "";
				let $objUp = null;
				let qty = 1;
				$.each(result.dataList, function(idx, item) {
					let tag1 = "";
					let tag2 = "";
					if (idx == 0){
							$objUp = $('.pd_detail .opt_select .select_custom.item_opt1');
							$objUp.remove();
						//------
						tag1 += '<div class="select_custom item_opt1">\n';	
						tag1 += '<div class="combo">\n';
						tag1 += '<div class="select">선택</div>\n';
						tag1 += '<ul class="list">\n';
						//------
						//tag1 += '<li class="selected" id="goodsOpt1">옵션1선택</li>\n';	
					}
					
					let soldoutYn = ""; 
					let disabledYn = ""; 
					if (item.stockQty <= 0) soldoutYn = "true";
					if (soldoutYn == "true" || item.goodsStat != 'G008_90') disabledYn = "true";
					tagUp = '<li aria-disabled="'+disabledYn+'" data-soldout="'+soldoutYn +'" onclick="fnOption2(this, \'Up\')">\n';
					tag2 += '<div class="opt_name">'+ item.optCd1Nm+'</div>\n';
					if (item.addPrice > 0){
						tag2 += '<div class="opt_price">+'+ item.addPrice.addComma() +'원</div>\n';	
					}
					tag2 += '<input type="hidden" name="opt1" value="'+ goodsCd +'" currPrice="'+ currPrice+'" optCd1="'+item.optCd1+'"  minOrdQty="'+item.minOrdQty+'"  maxOrdQty="'+item.maxOrdQty+'"   selfGoodsYn="'+selfGoodsYn+'" />\n';
					tag2 += '</li>\n';
					
					tagUpS += tag1+tagUp+tag2;
					
				});
				
				if (!gagajf.isNull(tagUpS)){
					//------
					tagUpS += '</ul>\n';
					tagUpS += '</div>\n';
					tagUpS += '</div>\n';
					//------	
				}
				
				$('#form_field1_'+flag).append(tagUpS);
				var detail_deal_option02 = new sCombo('.pd_detail .opt_select .select_custom.item_opt1');
				
			}
			
		});
		
	}
	
	// 옵션2 조회
	var fnOption2 = function(obj, flag){
		
		let $obj = $(obj);
		let $target = $obj.find('input[name="opt1"]');
		let goodsCd = $target.val();
		let currPrice = $target.attr("currPrice");
		let optCd1 = $target.attr("optCd1");
		let minOrdQty = $target.attr("minOrdQty");
		let maxOrdQty = $target.attr("maxOrdQty");
		let selfGoodsYn = $target.attr("selfGoodsYn");
		
		// 품절제외 여부
		let optionSoldoutSkip = $('.pop_option_select').find('input[name=soldoutSkipYn]').is(":checked") ? 'Y' : 'N';
		
		let data = {goodsCd : goodsCd
					,optCd1 : optCd1
					,optionSoldoutSkip : optionSoldoutSkip
					,mastrGoodsCd : $('#cartFprm input[name=goodsCd]').val()
					};
		let jsonData = JSON.stringify(data);
		
		gagajf.ajaxJsonSubmit('/goods/detail/option2/list', jsonData, function(result) {
			
			if (result.dataList != null && result.dataList.length > 0) {
				let tagUpS = "";
				let tagUp = "";
				let $objUp = null;
				$.each(result.dataList, function(idx, item) {
					let tag1 = "";
					let tag2 = "";
					if (idx == 0){
						
							$objUp = $('.pd_detail .opt_select .select_custom.item_opt2');
					//		$objUp.html('');
							$objUp.remove();
						
						//$('.form_field .select_custom.deal_opt2').attr('disabled', false);	
						//------
						tag1 += '<div class="select_custom item_opt2">\n';	
						tag1 += '<div class="combo">\n';
						tag1 += '<div class="select">선택</div>\n';
						tag1 += '<ul class="list">\n';
						//------
						//tag1 += '<li class="selected" id="goodsOpt2">옵션2</li>\n';	
					}

					let soldoutYn = ""; 
					let disabledYn = "";
					if ("Y" == item.soldoutYn || item.stockQty <= 0) soldoutYn = "true";
					if (soldoutYn == "true")  disabledYn = "true";
					tagUp = '<li aria-disabled="'+disabledYn+'" data-soldout="'+soldoutYn +'" onclick="fnViewStock(this, \'Up\' )">\n';
					tag2 += '<div class="opt_name">'+ item.optCd2+'</div>\n';
					if (item.addPrice > 0){
						tag2 += '<div class="opt_price">+'+ item.addPrice.addComma() +'원</div>\n';	
					}
					tag2 += '<input type="hidden" name="opt2" value="'+ goodsCd +'" currPrice="'+ currPrice+'" addPrice="'+item.addPrice+'"  optCd="'+item.optCd+'"  optCd1="'+item.optCd1+'" optCd1Nm="'+item.optCd1Nm+'"  optCd2="'+item.optCd2+'"  minOrdQty="'+minOrdQty+'"  maxOrdQty="'+maxOrdQty+'" selfGoodsYn="'+selfGoodsYn+'" giftPackYn="'+item.giftPackYn+'"/>\n';
					tag2 += '</li>\n';
					
					tagUpS += tag1+tagUp+tag2;
				});
				
				if (!gagajf.isNull(tagUpS)){
					//------
					tagUpS += '</ul>\n';
					tagUpS += '</div>\n';
					tagUpS += '</div>\n';
					
					//------	
				}
				
				$('#form_field2_'+flag).append(tagUpS);
				var detail_deal_option03 = new sCombo('.pd_detail .opt_select .select_custom.item_opt2');
				
			}
			
		});	
	}
	
	//사이즈 클릭시 - 단품
	var fnViewStock = function(obj, flag ) {
		
		let $obj = $(obj);
		let $target = $obj.find('input[name="opt2"]');
		let goodsCd = $target.val();
		let currPrice = $target.attr("currPrice");
		let optCd = $target.attr("optCd");
		let optCd1 = $target.attr("optCd1");
		let optCd1Nm = $target.attr("optCd1Nm");
		let optCd2 = $target.attr("optCd2");
		let minOrdQty = $target.attr("minOrdQty");
		let maxOrdQty = $target.attr("maxOrdQty");
		let addPrice  = $target.attr("addPrice");
		let selfGoodsYn  = $target.attr("selfGoodsYn");
		let giftPackYn  = $target.attr("giftPackYn");
		let optQty = minOrdQty;
		
		let params = new Object();
		params.goodsCd = goodsCd;
		params.optCd = optCd;
		params.optCd1 = optCd1;
		params.optCd2 = optCd2;
		params.selfGoodsYn = selfGoodsYn;
		
		// 중복선택 확인  opt_result
		var overlap = 0;
		$('.pd_detail .opt_result .number_count').each(function() {
			if ($('input[name="coption"]', this).val() == optCd) {
				++overlap;
			}
		});
		if (overlap > 0) {
			mcxDialog.alert("이미 선택하신 옵션입니다.");
			return false;
		}
		
		$.get("/goods/detail/ajaxGoodsStockQty", $.param(params), function(result) {
			let itemCnt = eval(result); //해당 아이템에 선택되어진 사이즈의 수량
			
			if (maxOrdQty > itemCnt) {
				maxOrdQty = itemCnt;
			}

			if (minOrdQty > itemCnt) {
				mcxDialog.alert("주문 가능한 옵션이 아닙니다. 옵션을 다시  선택해 주세요."); 
				return false;
			}
			
			//상품정보
			let $selObj = null;
			$selObj = $('.pd_detail .opt_select .select_custom.deal_opt_item');
			let $goodsObj =$selObj.find('.combo .select').find('input[name=selectGoods]');
			let goodsNm =  $goodsObj.attr('goodsnm');
			let goodsCd =  $goodsObj.attr('goodscd');
			let price = parseInt(currPrice)+ parseInt(addPrice);
			
			let tag = "";
			tag += '<div class="result_item result_'+optCd+'">\n';
			tag += '	<div class="opt_header">\n';
			tag += '		<div class="bundle">\n';
			tag += '			<span class="item_name">'+goodsNm+'</span>\n';
			tag += '			<span class="item_option">'+optCd1Nm+'/'+optCd2+'</span>\n';
			tag += '		</div>\n';
			tag += '	</div>\n';
			tag += '	<div class="number_count">\n';
			tag += '		<span class="minus min_val" onclick="fnAdjustOrderEa(this);" adjust="-"><em class="sr-only">감소</em></span>\n';
			tag += '		<input type="text" name="cea" optCd="'+optCd+'" maxlength="3" style="ime-mode:disabled" value="' +optQty+'" readonly minOrdQty="'+minOrdQty+'" maxOrdQty="'+maxOrdQty+'" giftPackYn="'+giftPackYn+'">\n';
			tag += '		<input type="hidden" name="coption" value="'+optCd+'"  goodsCd="'+goodsCd+'"  price="'+currPrice+'"  addPrice="'+addPrice+'">\n';
			tag += '		<span class="plus" onclick="fnAdjustOrderEa(this);" adjust="+"><em class="sr-only">추가</em></span>\n';
			tag += '	</div>\n';
			tag += '	<div class="item_price">\n';
			tag += '		<p><em id="goodsPrice">'+price.addComma() +'</em>원</p>\n';
			tag += '	</div>\n';
			tag += '	<button type="button" class="btn_delete_item" onclick="fnSelectGoodsDel(\''+optCd+'\')"><span>삭제</span></button>\n';
			tag += '</div>\n';
			
			let $objUp = null;
			$objUp = $('.pd_detail .opt_result'); 
			$objUp.prepend(tag);
			
			//선물 주문관련 처리
			if ("Y" == giftPackYn) $('#btnGift').show();
			
			$('.price_box').show();
			fnSetTotalPrice();	
			
			var dTag = '';
			dTag += '';
			dTag += '<div class="item_prod">\n';
			dTag += '<div class="item_state">\n';
			dTag += '	<a href="javascript:void(0);" class="itemLink">\n';
			dTag += '		<div class="itemPic">\n';
			dTag +='			<img class="vLHTC pd_img" src="'+_uploadGoodsUrl +'/'+[[${goodsInfo.sysImgNm}]]+'?RS=285" alt="" onerror="' + _uximgUrl + '/images/pc/thumb/bg_item_none.png"  />\n';
			dTag += '		</div>\n';
			dTag += '		<div class="itemName">상품선택</div>\n';
			dTag += '	</a>\n';
			dTag += '</div>\n';
			dTag += '</div>\n';
			
			//$('.pd_detail .opt_select .select_custom.deal_opt_item').find('.combo .select').html(dTag);
			//var opt_selecter_item = new sCombo('.opt_select .select_custom.deal_opt_item');
			$('.form_field .select_custom.deal_opt_item').find('.combo .select').html('선택');
			$('.form_field .select_custom.item_opt1').attr('disabled', true);
			$('.form_field .select_custom.item_opt1').find('.combo .select').html('선택');
			$('.form_field .select_custom.item_opt2').attr('disabled', true);
			$('.form_field .select_custom.item_opt2').find('.combo .select').html('선택');
			
			$('.pop_option_select').css("display", "none");
			
		}, "text");
	}
	
	// 수량 변경 클릭
	var fnAdjustOrderEa = function(obj) {

		let $obj = $(obj);
		let $target = $obj.parent().children('input[name="cea"]');
		let ea =parseInt($target.val());
		let minOrdQty = 0;
		let maxOrdQty = 0;
		if ("Y" == $("#cartForm  input[name=selfGoodsYn]").val() && "G056_N" == $("#cartForm  input[name=goodsType]").val()){
			if(gagajf.isNull($("#cartForm  input[name=optCd2]").val())){
				mcxDialog.alert("사이즈를 선택해 주세요.");
				return false;
			}
			minOrdQty = parseInt($("#cartForm  input[name=minOrdQty]").val());
			maxOrdQty = parseInt($("#cartForm  input[name=maxOrdQty]").val());
		}else{
			
			minOrdQty = parseInt( $target.attr('minOrdQty'));
			maxOrdQty = parseInt( $target.attr('maxOrdQty'));
		}

		if ($obj.attr('adjust') == '-') --ea;
		else ++ea;

		//var maxOrdQty = $("#cartForm  input[name=maxOrdQty]").val();

		//if (maxOrdQty && ea > maxOrdQty) ea = maxOrdQty;
		if (ea.toString().length > maxOrdQty) --ea;
		if (ea < 1) ea = minOrdQty;

		$target.val(ea);
		$target.attr('value', ea);

		fnChangeOrderEa($target[0]);
	
	}

	//옵션 갯수 변경
	var fnChangeOrderEa = function(obj) {
		
		let $obj = $(obj);
		let $target = $obj.parent().children('input[name="cea"]');
		let ea = parseInt($obj.val());
		let optCd =  $(obj).attr('optCd');
		let minOrdQty = parseInt($("#cartForm  input[name=minOrdQty]").val());
		let maxOrdQty = parseInt($("#cartForm  input[name=maxOrdQty]").val());
		if ("Y" == $("#cartForm  input[name=selfGoodsYn]").val() && "G056_N" == $("#cartForm  input[name=goodsType]").val()){
			if(gagajf.isNull($("#cartForm  input[name=optCd2]").val())){
				mcxDialog.alert("사이즈를 선택해 주세요.");
				return false;
			}
		}else{

			maxOrdQty = parseInt($(obj).attr('maxOrdQty'));
			minOrdQty = parseInt($(obj).attr('minOrdQty'));
			optCd =  $(obj).attr('optCd');
		}
		
		let alertMsg = '';
		
		if (ea < minOrdQty) {
			alertMsg = minOrdQty+"개 부터 구매 가능합니다.";
			ea = minOrdQty;
		}

		if (ea > maxOrdQty) {
			alertMsg = maxOrdQty+"개 까지만 구매 가능합니다.";
			ea = maxOrdQty;
		}
		
		if ("Y" == $("#cartForm  input[name=selfGoodsYn]").val() && "G056_N" == $("#cartForm  input[name=goodsType]").val()){
			$("#cartForm  input[name=cea]").val(ea);
			$("#cartForm  input[name=ordQty]").val(ea);
		}
		
		//obj.value = ea;
		$target.val(ea);
		$target.attr('value', ea);
		
		if (alertMsg != ''){
			mcxDialog.alert(alertMsg);
			return false;
		}
		
		if (ea <= 1){
			$('.number_count').find('.minus').addClass('min_val');	
		}else{
			$('.number_count').find('.minus').removeClass('min_val');
		}
		if ("Y" == $("#cartForm  input[name=selfGoodsYn]").val() && "G056_N" == $("#cartForm  input[name=goodsType]").val()){
			
		}else{
			let addPrice = parseInt($obj.parent().find('input[name="coption"]').attr('addprice'));
			let goodsPrice = parseInt($obj.parent().find('input[name="coption"]').attr('price'));
			let totalPrice = ((goodsPrice+addPrice) * ea);
			$('.opt_result .result_'+optCd+' .number_count').find('input[name=cea]').val(ea);
			$('.opt_result .result_'+optCd+' .number_count').find('input[name=cea]').attr('value',ea);
			$('.opt_result .result_'+optCd+' .item_price').find('em').text(totalPrice.addComma());	
		}
		

		fnSetTotalPrice();
	}
	
	//합계 계산
	var fnSetTotalPrice = function() {
		
		$('.price_box').show();
		//let f = document.cartForm;

		let totalEa = 0;
		let totalPrice = 0;
		
		$('input[name="cea"]', document.cartForm).each(function() {
			let ea = parseInt($(this).val());
			let target=$('.select_custom.item_opt2');
			let addPrice = parseInt($(this).parent().find('input[name="coption"]').attr('addprice'));
			let goodsPrice = parseInt($(this).parent().find('input[name="coption"]').attr('price'));

			totalEa += ea;
			if (goodsPrice > 0) {
				totalPrice += ((goodsPrice+addPrice) * ea);
			}
		});

		$('.price_box .number  span').html(totalEa.addComma());
		$('.price_box .price > span').html(totalPrice.addComma());
		
		if ($('input[name="cea"]', document.cartForm).length <= 0 ) {
			$('.price_box').hide();
		}
		
	}
	
	// 선택상품 삭제
	var fnSelectGoodsDel = function(optCd){
		$('.result_'+optCd).remove();
		fnSetTotalPrice();
		
		//선물주문관련 처리
		let $target = $('#cartForm input[name=cea]');
		let giftPackFlag = false;
		$target.each(function() {
			
			let giftPackYn = $(this).attr('giftPackYn');
			if ("Y" == giftPackYn ) giftPackFlag = true;
		});
		
		if (giftPackFlag){
			$('#btnGift').show();
		}else{
			$('#btnGift').hide();
		}
		
	}
	
	//장바구니담기
	var fnAddCart = function(btnType, flag){
		let compsList = [];
		
		let $target = $('#cartForm input[name=cea]');
		let targetSize = $target.length;	//선택성품 갯수
		
		if (targetSize <= 0){
			mcxDialog.alert("옵션을 선택해 주세요.");
			return false;
		}

		if (btnType == "G" && targetSize > 1){
			mcxDialog.alert("선물하기는 1개의 옵션만 선택하실 수 있습니다.");
			return false;
		}
		
		$target.each(function() {
			
			let ea = parseInt($(this).val());
			let goodsCd = $(this).parent().find('input[name="coption"]').attr('goodscd');
			let optCd = $(this).parent().find('input[name="coption"]').val();
			//let addPrice = parseInt($(this).parent().find('input[name="coption"]').attr('addprice'));
			//let goodsPrice = parseInt($(this).parent().find('input[name="coption"]').attr('price'));
			
			var obj = new Object();
			obj.cartGb = btnType;
			obj.goodsType = $("#cartForm  input[name=goodsType]").val();
			obj.goodsCd = goodsCd;
			obj.optCd = optCd;
			obj.goodsQty = ea;
			obj.dealGoodsCd = $("#cartForm  input[name=goodsCd]").val();
			obj.afLinkCd =$("#cartForm  input[name=afLinkCd]").val();
			obj.ithrCd =$("#cartForm  input[name=ithrCd]").val();
			obj.contentsLoc =$("#cartForm  input[name=contentsLoc]").val();
			obj.planDtlSq = $("#cartForm  input[name=planDtlSq]").val();
			compsList.push(obj);
			
		});
		
		// 장바구니담기
		cfnAddCart(compsList);
		
	}
	
	//팝업 - 딜상세팝업 구매하기버튼 > 옵션셀렉트팝업	
	var fnGoodsDealSaleOpen = function(goodsCd){
		$("#pdDescrpPop .close-modal ").click();
		$('.container').addClass('btPop_open');
		$(".pop_option_select").show();
		$('body').css('overflow', 'hidden'); // 210819_ 스크롤 강제 제어
		$('body').css('height', '100%'); // 210819_ 스크롤 강제 제어
		popOpenScroll();
		let selIdx = 0;
		$('.pop_option_select').find('#form_field_item_Up .list li').each(function() { 
			if (goodsCd == $(this).find('.item_prod').attr('goodscd')){
				return false;
			}
			selIdx ++;
		});
		
		$('.pop_option_select').find('#form_field_item_Up .list li').eq(selIdx).trigger("click");
		return false;
	}	
	
	//팝업 - 딜상세정보 옵션선택 > 옵션셀렉트팝업
	var fnGoodsDealOptionOpen = function(goodsCd){
		$('.container').addClass('btPop_open');
		$(".pop_option_select").show();
		$('body').css('overflow', 'hidden'); // 210819_ 스크롤 강제 제어
		$('body').css('height', '100%'); // 210819_ 스크롤 강제 제어
		popOpenScroll();
		let selIdx = 0;
		$('.pop_option_select').find('#form_field_item_Up .list li').each(function() { 
			if (goodsCd == $(this).find('.item_prod').attr('goodscd')){
				return false;
			}
			selIdx ++;
		});
		
		$('.pop_option_select').find('#form_field_item_Up .list li').eq(selIdx).trigger("click");
		return false;
	}	
	
	// pop open
	function popOpenScroll(){
		$('html, body').css({'overflow': 'hidden', 'height': '100%'}); 
		$('#element').on('scroll touchmove mousewheel', function(event) { // 터치무브, 휠 스크롤 방지
			event.preventDefault();
			event.stopPropagation();
			return false;
		});
	}
	// pop close
	function popClsScroll(){
		$('html, body').css({'overflow': 'auto', 'height': '100%'}); //n 해제
		$('#element').off('scroll touchmove mousewheel'); // 터치무브, 휠 스크롤 가능
		return false;
	}
	// pop close
	function popClsScroll2(){
		$('html, body').css({'overflow': 'auto', 'height': '100%'}); //n 해제
		$('#element').off('scroll touchmove mousewheel'); // 터치무브, 휠 스크롤 가능
		return false;
	}
	
	// 상품평 상세 레이어 호출후 콜백에서 호출하므로 여기에 있어야함
	var fnReviewDetailLayerCollBack = function(){
		
	}
	
	 $(document).ready( function() {
		 
		 $('.timer_box').css('display', 'none');
		
		 var params = new Object();
		params.goodsCd = [[${params.goodsCd}]];
		params.colorCd = [[${params.colorCd}]];
		params.viewDt = [[${params.viewDt}]];
		params.preview = [[${params.preview}]];
		params.adminYn = [[${params.adminYn}]];
		params.goodsType = [[${params.goodsType}]];
		params.supplyCompCd = [[${params.supplyCompCd}]];
		params.brandGroupNm = [[${goodsInfo.brandGroupNm}]];
		
		// 함께본 상품(ajax html)
		params.goodsOtherGb = "together";
		params.ithrCd = "tmtb";
		params.contentsLoc = "tmtb";
		fnGoodsTogetherSearch(params);

		if (!gagajf.isNull([[${goodsInfo.socialSq}]])){
			$('.timer_box').css('display', 'block');
			/* 행사 남은시간 */
			function promotionTimer() {
				var endTime = new Date([[${goodsInfo.socialEddt}]]); // 남은시간 지정	30 March 2021 9:56:00 GMT+0900	
					endTime = (Date.parse(endTime) / 1000);
	
					var now = new Date();
					now = (Date.parse(now) / 1000);
	
					var timeLeft = endTime - now;
	
					var days = Math.floor(timeLeft / 86400); 
					var hours = Math.floor((timeLeft - (days * 86400)) / 3600);
					var minutes = Math.floor((timeLeft - (days * 86400) - (hours * 3600 )) / 60);
					var seconds = Math.floor((timeLeft - (days * 86400) - (hours * 3600) - (minutes * 60)));
	
					if (hours < '10') { hours = '0' + hours; }
					if (minutes < '10') { minutes = '0' + minutes; }
					if (seconds < '10') { seconds = '0' + seconds; }
	
					if (Number(days) > 0 ){
					//	hours = Number(hours) + (Number(days) * 24);
						$('#d-days').html(days);
					}else{
						$('#d-days').hide();
					}
					$('#d-hours').html(hours);
					$('#d-minutes').html(minutes);
					$('#d-seconds').html(seconds);		
			}
			setInterval(function() { promotionTimer(); }, 1000);
		}
		
		var opt_selecter_item = new sCombo('.opt_select .select_custom.deal_opt_item');
		//var item_opt01 = new sCombo('.pd .pop_option_select .item_opt1');
		//var item_opt02 = new sCombo('.pd .pop_option_select .item_opt2');
		var opt_select = new sCombo('.pd .op1 .opt_select .select_custom');
	

		//옵션변경 셀렉트
		var opt_selecter01 = new sCombo('.pd .pop_option_select .item_opt1');
		$('.pd .pop_option_select .select_custom .combo .list > li').click(function(e) {
			$(this).parents('.form_field').next('.form_field').find('.select_custom').attr('disabled', false);
			return false;
		});
		var opt_selecter02 = new sCombo('.pd .pop_option_select .item_opt2');
			
		//슬라이드 - 베스트리뷰
		var riviewSwiper = new Swiper('.pd .riview_box .area_slider .swiper-container', {
			slidesPerView: 1,
			spaceBetween: 8,
			speed: 1000,
			loop: true,
			pagination: {
				el: '.swiper-pagination',
				type: 'fraction',
			},
		});
		
		//슬라이드 - 제품사진
		var thumbswiper = new Swiper('.pd .thumb_box .area_slider .swiper-container', {
			slidesPerView:1,
			speed: 1000,
			pagination: {
				el: '.swiper-pagination',
				type: 'fraction',
			},
		});
		 //슬라이드 - 함께하면 할인되는 다다익선 상품
		 var togetherItemSwiper = new Swiper('.pd .pd_together .area_slider .swiper-container', {
			 slidesPerView: 3,
			 spaceBetween: 8,
			 speed: 1000,
		 });  

		 //슬라이드 - 이 상품과 함께 본 상품 
		 var otherItemSwiper = new Swiper('.pd .pd_clickother .area_slider .swiper-container', {
			 slidesPerView: 2,
			 spaceBetween: 8,
			 speed: 1000,
		 });			

		 //슬라이드 - STYLE24의 스타일링 추천
		var rcmdPicimgSwiper = new Swiper('.pd .pd_recommend .area_slider.pic_img .swiper-container', {
			slidesPerView: 1,
			spaceBetween: 0,
			speed: 1000,
			pagination: {
				el: '.swiper-pagination',
				type: 'fraction',
			},
		});
		var rcmdPiclistSwiper = new Swiper('.pd .pd_recommend .area_slider.pic_list .swiper-container', {
			observer: true,
			observeParents: true,
			slidesPerView: 3,
			spaceBetween: 8,
			speed: 1000,
		});

		$(".pic_list > div").hide();
		$(".pic_list > div").eq(0).fadeIn();
		rcmdPicimgSwiper.on('slideChange', function () {
			var pic_index=this.activeIndex;
			$(".pic_list > div").hide();
			$(".pic_list > div").eq(pic_index).fadeIn();
		});
			
			//슬라이드 - 동일브랜드 상품 추천
		 var rcmdItemSwiper = new Swiper('.pd .pd_samebrand .area_slider .swiper-container', {
			 slidesPerView: 3,
			 spaceBetween: 8,
			 speed: 1000,
		 }); 

		 //슬라이드 - 이 상품과 비슷한 상품 
		 var relateItemSwiper = new Swiper('.pd .pd_relate .area_slider .swiper-container', {
			 slidesPerView: 3,
			 spaceBetween: 8,
			 speed: 1000,
		 });	 
			
			//슬라이드 - 베스트리뷰팝업 
		 var bestreviewdetailSwiper = new Swiper('.pd_bestreviewdetail_pop .area_slider .swiper-container', {
			observer: true,
			observeParents: true,
			speed: 1000,
			 slidesPerView: 1,
			 pagination: {
					el: '.swiper-pagination',
					type: 'fraction',
				},
		 });
			
			//슬라이드 - 포토,영상리뷰팝업 
		 var photoreviewdetailSwiper = new Swiper('.pd_photoreviewdetail_pop .area_slider .swiper-container', {
			observer: true,
			observeParents: true,
			speed: 1000,
			 slidesPerView: 1,
			 pagination: {
					el: '.swiper-pagination',
					type: 'fraction',
				},
		 });
		 
		
		//탭 - 사이즈정보 > 탭
		 $(document).on('click','#infoSizePop .tab_nav ul li',function(e){
			 $(this).addClass('active').siblings().removeClass('active');
			 $('#infoSizePop .tab_cont_wrap .tab_cont').hide();		
			 $('#infoSizePop .tab_cont_wrap .tab_cont').eq($(this).index()).show();
			 return false;
		 });

		 //탭 - 사이즈정보 > 서브탭
			$(document).on('click','#infoSizePop .sub_tab_nav ul li',function(e){
				var value=$(this).find("a").text();
				var catTxt=$(".category_open").text();
				console.log(value)
			 $(this).addClass('active').siblings().removeClass('active');
			 $(this).parents('.tab_cont').find('.sub_tab_cont').hide();
			 $(this).parents('.tab_cont').find('.sub_tab_cont').eq($(this).index()).show();
				$(this).parents().parents().parents().parents().parents(".category_box").hide();
				$(this).parents().parents().parents().parents().parents(".category_box").prev(".category_open").text(value);
			 return false;
		 });

			//팝업 - 사이즈정보 > 서브탭 - 카테고리팝오픈
		 $(document).on('click','#infoSizePop .category_open',function(e){
			 $(this).siblings().show();
			 return false;
		 });
			$(document).on('click','#infoSizePop .category_close',function(e){
			 $(this).parents().parents(".category_box").hide();
			 return false;
		 });
		

		//팝업 - 상품문의 리스트	
		$(document).on('click','#btn_pdQnaList_pop',function(e){
			$("#pdQnaListPop").modal("show");
			return false;
		});

		//팝업 - 상품문의 작성
		$(document).on('click','#btn_pdQnaWrite_pop',function(e){
			$("#pdQnaWritePop").modal("show");
			return false;
		});

/* 
		//팝업 - 제품리뷰 > 카테고리팝오픈
		// 오픈
		 $(document).on('click','.pd_review .category_open > li',function(e){
				var dataName=$(this).attr("data_name");
			 $(".pd_review .category_box").show();
				$(".pd_review .category_list").find(".category").hide();
				$(".pd_review .category_list").find("#"+dataName).show();
				return false;
		 });
			// 닫기
			$(document).on('click','.pd_review .category_box .category_close',function(e){
				$(".pd_review .category_box").hide();
			 return false;
		 });
			// 변경
			$(document).on('click','.pd_review .category ul > li',function(e){
				var num=$(".pd_review .category_open > li").length;
				var value=$(this).find("a").attr("data");
				var name=$(this).parent().parent().attr("id");
				$(this).parent().find("li").removeClass("active");
				$(this).addClass("active");
				for(var i=0; i < num; i++){
					var dataname=$(".pd_review .category_open > li").eq(i).attr("data_name");
					if(name==dataname){
						$(".pd_review .category_open > li").eq(i).find("span").text(value);
					}
				}
			 return false;
		 }); */


		// 포토,베스트리뷰숨김
		var review_open=$(".btn_review_open");
		$(document).on('click','.btn_review_open',function(e){
			$(this).toggleClass('active');
			$(this).next(".review_list").toggleClass('active');
			return false;
		});
		
		
			// =============구매하기팝업========================================================



		//팝업 - 구매하기 > 옵션선택 > 옵션셀렉트팝업
		$(document).on('click','.Purchase_pop .option_result .option_open',function(e){
		 	$(".pop_option_select").show();
		 	$('body').css('overflow', 'hidden'); // 210819_ 스크롤 강제 제어
			$('body').css('height', '100%'); // 210819_ 스크롤 강제 제어
			 return false;
		 });
		$(document).on('click','.pop_option_select .close',function(e){
			$(".pop_option_select").hide();
			$(".option_open").removeClass("on");
			$('.form_field .select_custom.deal_opt_item').find('.combo .select').html('선택');
			$('.form_field .select_custom.item_opt1').attr('disabled', true);
			$('.form_field .select_custom.item_opt1').find('.combo .select').html('선택');
			$('.form_field .select_custom.item_opt2').attr('disabled', true);
			$('.form_field .select_custom.item_opt2').find('.combo .select').html('선택');
			 return false;
		 })
//			//팝업 - 딜상세정보 옵션선택 > 옵션셀렉트팝업 ==> fnGoodsDealOptionOpen()대체
//		$(document).on('click','.pd_dealitem .item_prod .btn_default',function(e){
//				$('.container').addClass('btPop_open');
//				$(".Purchase_pop .pop_option_select").show();
//				popOpenScroll();
//			 return false;
//		 });

		//팝업 - 딜상세팝업 구매하기버튼 > 옵션셀렉트팝업  ==> fnGoodsDealSaleOpen()대체
//		$(document).on('click','#pdDescrpPop .modal-footer button',function(e){
//			$("#pdDescrpPop .close-modal ").click();
//			$('.container').addClass('btPop_open');
//			$(".Purchase_pop .pop_option_select").show();
//			popOpenScroll();
//		 return false;
//		 });
			
		
		// ============================================================================//


		// =============딜리스트팝업========================================================
			//팝업 - 딜리뷰상품 리스트팝업
			$(document).on('click','.deal_listReview_open',function(e){
				$("#listReviewPop").show();
				return false;
			}).on('click','#listReviewPop .close, #listReviewPop .deal_list_select ul > li',function(e){
				$("#listReviewPop").hide(); 
				return false;
			});

			//팝업 - 딜문의상품 리스트팝업
			$(document).on('click','.deal_listQna_open',function(e){
				$("#listQnaPop").show();
				return false;
			}).on('click','#listQnaPop .close, #listQnaPop .deal_list_select ul > li',function(e){
				$("#listQnaPop").hide(); 
				return false;
			});

			//팝업 - 딜배송상품 리스트팝업
			$(document).on('click','.deal_listDelivery_open',function(e){
				$("#listDeliveryPop").show();
				return false;
			}).on('click','#listDeliveryPop .close, #listDeliveryPop .deal_list_select ul > li',function(e){
				$("#listDeliveryPop").hide(); 
				return false;
			});

			//팝업 - 딜상세정보 리스트팝업
			$(document).on('click','#pdDescrpPop .deal_listDescrp_open',function(e){
				$(this).toggleClass("active");
				$("#listDescrpPop").toggle();
				return false;
			}).on('click','#listDescrpPop .deal_list_select ul > li',function(e){
				$("#pdDescrpPop .deal_listDescrp_open").removeClass("active");
				$("#listDescrpPop").hide(); 
				return false;
			});
			// ============================================================================//	
		
		 //탭 - 딜상품 > 상품상세정보 탭
		 $(document).on('click','.pd.deal .tab_detail_nav ul li',function(e){
			 $(this).addClass('active').siblings().removeClass('active');
			 $('.pd.deal .tab_detail_cont').hide();		
			 $('.pd.deal .tab_detail_cont').eq($(this).index()).show();
			 
			/*  //상품상세정보 호출
			 $('.pd_review .cont_body').load('pd_review_pop.html');
			 $('.pd_qnalist .cont_body').load('pd_qnalist_pop.html');
			 $('.pd_delivery .cont_body').load('pd_delivery_pop.html');
			 return false; */
		 }); 
		

			//탭 - 딜상품 > 상세정보 탭 고정
		 $(window).scroll(function(){
			 var scrollTop= $(window).scrollTop();
				var tabTop=$('.pd_desc_wrap').offset().top;

			 if (scrollTop >= tabTop){
				 $('.tab_detail_nav').addClass('fix');
			 } else {
				 $('.tab_detail_nav').removeClass('fix');
			 }
		 });

		$('.Purchase_pop .btPop_close').click(function(){
			$('html, body').css({'overflow': 'visible', 'height': '100%'});
			$('.container').removeClass('btPop_open');
			autome.style.top  = 100 + "%";
			return false;
		});
			

		  //관심상품 등록
		$(document).on('click','.pd .itemLike',function(e){
			$(this).toggleClass('active');
			return false;
		});   
	  
		  
	  //pd전용 - 썸네일/헤더 블라인드 생성 : 210520_ 추가
		$('.pd .thumb_box .thumb_list .swiper-slide').prepend('<span></span>');
		// pd전용 - 스크롤 스크립트
		//탭 - 딜상품 > 상세정보 탭 고정
		$(window).scroll(function(){
			var scrollTop= $(window).scrollTop();
			var tabTop=$('.pd_desc_wrap').offset().top;

			if (scrollTop >= tabTop){
				$('.tab_detail_nav').addClass('fix');
			} else {
				$('.tab_detail_nav').removeClass('fix');
			}
			
			var lastScrollTop = 0;
			var st = $(this).scrollTop();
			if($('header').hasClass("main") !== true){
				if (st > lastScrollTop){
					$(".app .gnb").css("position", "fixed");
					$(".htop").css("background", "#fff");
					$(".app .gnb .btn-expand").css("position", "fixed");
					$(".tabbar").removeClass("fixed");
					$(".thumb_list .swiper-slide span").animate({"opacity": 0}, 30);
				} else {
					$(".app .gnb").css("position", "fixed");
					$(".htop").css("background", "#fff");
					$(".app .gnb .btn-expand").css("position", "fixed");
					$(".tabbar").addClass("fixed");
					$(".thumb_list .swiper-slide span").animate({"opacity": 0.5}, 30);
					setTimeout(function(){
						if($(window).scrollTop() === 0){
							$(".app .gnb").css("position", "relative");
							$(".app .gnb .btn-expand").css("position", "absolute");
						}
					},300)
				}
				if(st < 10) {
					$(".htop").css("background", "transparent");
					$(".thumb_list .swiper-slide span").animate({"opacity": 0.5}, 0);
				}
				lastScrollTop = st;
			}
		});
		
		$(document).on('click','.pop_open_btn',function(){
			$('.modal.photo_comment_popup .pop_detail').toggleClass('active');
		});

		let vh = window.innerHeight * 0.01;
		document.documentElement.style.setProperty('--vh', `${vh}px`);

		// 210407_스크롤감지 헤더 그림자
		$('.pd_delivery_pop').scroll(function(){
        	$(".pd_delivery_pop .modal-header").css("box-shadow", "rgb(0 0 0 / 20%) 0px 0px 5px");
        	$(".pd_delivery_pop .modal-header").css("border-bottom", "0px none");
			if($(".pd_delivery_pop").scrollTop() === 0){
				$(".pd_delivery_pop .modal-header").css("box-shadow", "none");
				$(".pd_delivery_pop .modal-header").css("border-bottom", "1px solid #eee");
			}
		});
		$('.pd_review_pop').scroll(function(){
			$(".pd_review_pop .modal-header").css("box-shadow", "rgb(0 0 0 / 20%) 0px 0px 5px");
			$(".pd_review_pop .modal-header").css("border-bottom", "0px none");
			if($(".pd_review_pop").scrollTop() === 0){
				$(".pd_review_pop .modal-header").css("box-shadow", "none");
				$(".pd_review_pop .modal-header").css("border-bottom", "1px solid #eee");
			}
		});
		$('.pd_qnalist_pop').scroll(function(){
			$(".pd_qnalist_pop .modal-header").css("box-shadow", "rgb(0 0 0 / 20%) 0px 0px 5px");
			$(".pd_qnalist_pop .modal-header").css("border-bottom", "0px none");
			if($(".pd_qnalist_pop").scrollTop() === 0){
				$(".pd_qnalist_pop .modal-header").css("box-shadow", "none");
				$(".pd_qnalist_pop .modal-header").css("border-bottom", "1px solid #eee");
			}
		});
		  
			// 광고 스크립트용
			var goodsNavigation = [[${goodsNavigation}]];
			var cate1No = "";
			var cate2No = "";
			var cate3No = "";
			var cate4No = "";
			var cate5No = "";
			var cate1Nm = "";
			var cate2Nm = "";
			var cate3Nm = "";
			var cate4Nm = "";
			var cate5Nm = "";
			if (!gagajf.isNull(goodsNavigation)) {
				cate1No = goodsNavigation.cate1No;
				cate2No = goodsNavigation.cate2No;
				cate3No = goodsNavigation.cate3No;
				cate4No = goodsNavigation.cate4No;
				cate5No = goodsNavigation.cate5No;
				cateNm  = cate3No;
				cate1Nm = goodsNavigation.cate1Nm;
				cate2Nm = goodsNavigation.cate2Nm;
				cate3Nm = goodsNavigation.cate3Nm;
				cate4Nm = goodsNavigation.cate4Nm;
				cate5Nm = goodsNavigation.cate5Nm;
			}
			// 광고 스크립트용
			
			var snsGoodsImg = _uploadGoodsUrl + "/"+ [[${goodsInfo.sysImgNm}]];
			var snsUrl = location.protocol + _PAGE_GOODS_DETAIL + params.goodsCd +'&colorCd =' + params.colorCd  ;
			var snsGoodsFullNm = [[${goodsInfo.goodsFullNm}]];
			
			<!-- 페이스북 카카오스토리 연동 관련 메타태그 -->
			$("meta[property='og:url']").attr('content', snsUrl);
			$("meta[property='og:title']").attr('content', snsGoodsFullNm);
			$("meta[property='og:description']").attr('content', snsGoodsFullNm);
			$("meta[property='og:image']").attr('content', snsGoodsImg);

			<!-- 트위터 관련 메타태그 -->
			$("meta[name='twitter:url']").attr('content', snsUrl);
			$("meta[name='twitter:title']").attr('content', snsGoodsFullNm);
			$("meta[name='twitter:description']").attr('content', snsGoodsFullNm);
			$("meta[name='twitter:image']").attr('content', snsGoodsImg);

			// 추천솔류션 meta 설정
			$("meta[property='eg:type']").attr('content',"product");
			$("meta[property='eg:cuid']").attr('content',eglqueueCuid);
			$("meta[property='eg:itemId']").attr('content', [[${goodsInfo.goodsCd}]] );
			$("meta[property='eg:itemName']").attr('content',[[${goodsInfo.goodsFullNm}]] );
			$("meta[property='eg:itemImage']").attr('content', snsGoodsImg);
			$("meta[property='eg:itemUrl']").attr('content',snsUrl);
			$("meta[property='eg:originalPrice']").attr('content',[[${goodsInfo.listPrice}]]);
			$("meta[property='eg:salePrice']").attr('content',[[${goodsInfo.currPrice}]]);
			$("meta[property='eg:category1']").attr('content',cate1No);
			$("meta[property='eg:category2']").attr('content',cate2No);
			$("meta[property='eg:category3']").attr('content',cate3No);
			$("meta[property='eg:category4']").attr('content',cate4No);
			$("meta[property='eg:category5']").attr('content',cate5No);
			$("meta[property='eg:category1_name']").attr('content',cate1Nm);
			$("meta[property='eg:category2_name']").attr('content',cate2Nm);
			$("meta[property='eg:category3_name']").attr('content',cate3Nm);
			$("meta[property='eg:category4_name']").attr('content',cate4Nm);
			$("meta[property='eg:category5_name']").attr('content',cate5Nm);
			$("meta[property='eg:brandId']").attr('content',[[${goodsInfo.brandGroupNo}]]);
			$("meta[property='eg:brandName']").attr('content',[[${goodsInfo.brandGroupNm}]]);
			$("meta[property='eg:regDate']").attr('content',[[${goodsInfo.regDt}]].toDate("YYYYMMDDHHmmss").format("YYYY-MM-DDTHH:mm:ssZ"));
			$("meta[property='eg:updateDate']").attr('content',[[${goodsInfo.updDt}]].toDate("YYYYMMDDHHmmss").format("YYYY-MM-DDTHH:mm:ssZ"));
			$("meta[property='eg:stock']").attr('content',[[${goodsInfo.goodsStockQty}]]);
			$("meta[property='eg:state']").attr('content',[[${goodsInfo.goodsStat}]]);
			$("meta[property='eg:description']").attr('content',null);
			$("meta[property='eg:extraImage']").attr('content',null);
			$("meta[property='eg:locale']").attr('content',"KR");
			$("meta[property='eg:isNew']").attr('content',([[${goodsInfo.formalGb}]] == 'G009_10')? 'True' :'False');
			$("meta[property='eg:etc1']").attr('content', [[${goodsInfo.selfGoodsYn}]]);
			
			
			// 탭별 선택시 기본 상품 설정
			let selIdx = 0;
			$('.pd_pop.pd_listDelivery_pop').find('.deal_list_select .list li').each(function() { 
				if (typeof ($(this).attr('aria-disabled')) == 'undefined' || !$(this).attr('aria-disabled')){
					return false;
				}
				selIdx ++;
			});
			$('.pd_pop.pd_listReview_pop').find('.deal_list_select .list li').eq(selIdx).trigger("click");
			
			$('.pd_pop.pd_listQna_pop').find('.deal_list_select .list li').eq(selIdx).trigger("click");
					
			$('.pd_pop.pd_listDelivery_pop').find('.deal_list_select .list li').eq(selIdx).trigger("click");
	 });
		
/*]]>*/
</script>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>

<!-- 네이버페이 랜딩페이지 -->
<script th:inline="javascript">
	if(!wcs_add) var wcs_add = {};
	wcs_add["wa"] = "[[${@environment.getProperty('naverPay.common.certification.key')}]]";
	wcs.inflow("style24.com");
	wcs_do();
</script>

<!-- 광고 스크립트 -->
<th:block th:replace="~{mob/common/advertisements/GoodsDetailScriptsMob :: scripts}"></th:block>
<!-- //광고 스크립트 -->

</th:block>

</body>
</html>