<!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/SubLayoutMob">
<!--
 *******************************************************************************
 * @source  : PlanningDetailFormMob.html
 * @desc    : 기획전/이벤트 상세 Page
 *============================================================================
 * STYLE24
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 
 * ===  ===========  ==========  =============================================
 * 1.0  2021.05.12   sowon     최초 작성
 *******************************************************************************
 -->
<body>
<th:block layout:fragment="content">

<!-- 이벤트를 위한 임시 script 및 style 추가 시작 (21.10.22 by junghwan)  -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/bxslider/4.2.12/jquery.bxslider.css" th:if="${planInfo.planSq}==38 or ${planInfo.planSq}==43">
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" th:if="${planInfo.planSq}==38 or ${planInfo.planSq}==43"></script> -->
<script src="https://cdn.jsdelivr.net/bxslider/4.2.12/jquery.bxslider.min.js" th:if="${planInfo.planSq}==38 or ${planInfo.planSq}==43"></script>

<!-- 스타일데이 -->
<script src="https://mattstow.com/experiment/responsive-image-maps/jquery.rwdImageMaps.min.js" th:if="${planInfo.planSq}==38"></script>
<script th:if="${planInfo.planSq}==38">
	$(function(){
		$('.gift_slider').bxSlider({
			wrapperClass: 'sliderwrap2',
			auto: true,
			controls: false,
			speed: 300,
		});
		
        $('img[usemap]').rwdImageMaps();
        $("#img").width("100%");
	});
	
	$(document).ready(function() {
    	$("#modal-gift").click(function() {
	        $("#giftPop").css('display','block');
	        $("body").addClass('ohidden');
	    });
	    $("#close-modal").click(function() {
	   		$("#giftPop").css('display','none');
	        $("body").removeClass('ohidden');
	        location.reload();
	  	});
	});
</script>
<style type="text/css" th:if="${planInfo.planSq}==38">
    .gift_box .gift_section{max-width:960px; width:auto; background-color:#fff; padding:4rem 3rem; margin:0 auto 4rem; overflow: hidden;}
    .gift_box .gift_section h3{text-align: center; }
    .gift_box .gift_section h3 img{max-width:280px; margin-bottom:30px;}
    .gift_box p{font-size:16px; text-align:left; float:left; margin-top:20px;}

    .sliderwrap2{position:relative; max-width:850px; margin-bottom:10rem; text-align: center;}
    .sliderwrap2 .bx-pager{position:absolute; left:50%; bottom:-3rem; transform:translateX(-50%);}
    .sliderwrap2 .bx-pager div{display:inline-block;padding:0 3px;}
    .sliderwrap2 .bx-pager div a{display:block; width:13px; height:13px; border:2px solid #222; background:#fff; border-radius:100%; color:transparent; font-size:0px;}
    .sliderwrap2 .bx-pager div .active{background:#222; width:22px; border-radius:12px;}
    .btn_giftPopup{float:right; max-width:20rem; margin-top:-6rem;}
    .btn_giftPopup{display: block; height:100%;}
    

    .tomato_section{background-color:#d3410e; text-align:center; padding:6rem 2rem;}
    .blue1_section{background-color:#202a7a; text-align:center; padding:6rem 2rem;}
    .blue2_section{background-color:#0a1252; text-align:center; padding:6rem 2rem;}
    .img_max_960{max-width:960px; width:100%;}
    .img_max_900{max-width:900px; width:100%;}
    .img_max_800{max-width:800px; width:100%;}
    .img_max_470px{max-width:470px; width:100%;}
    .img_max_480px{max-width:480px; width:100%;}
    .marginb5{margin-bottom:5rem;}
    .marginb4{margin-bottom:4rem;}
    .marginb3{margin-bottom:3rem;}
    .marginb2{margin-bottom:2rem;}
    .w55p{width:50%;}
    .border_grey{border:1px solid #919191;}

    .brandSection_Link{max-width:960px; overflow:hidden; margin:0 auto;}
    .linkBox_left{float:left; max-width:48%; margin:0 4% 25px 0;}
    .linkBox_right{float:right; max-width:48%; margin-bottom:25px;}
    #giftPop {position: fixed; top: 0; right: 0;bottom: 0;left: 0;width: 100%;height: 100%;overflow: auto;z-index: 999;padding: 0;box-sizing: border-box;
	background-color: #fff;text-align: center;}
    .ohidden{overflow:hidden;}
    .gift-modal-info{position:absolute; top:60px;}
    @media (max-width:450px){
        .btn_giftPopup{float:none; width:100%; margin:-6rem auto 0;}
    }
</style>
<!-- 핸드크림 -->
<script th:if="${planInfo.planSq}==43">
	$(function(){
	    $('.gift_slider2').bxSlider({
	    wrapperClass: 'sliderwrap3',
	    auto: true,
	    speed: 300,
	    controls: false,
	    });
	});
	$(document).ready(function() {
	  	$("#modal-gift2").click(function() {
	     	$("#giftPop2").css('display','block');
	     	$("body").addClass('ohidden');
		});
	 	$("#close-modal").click(function() {
			$("#giftPop2").css('display','none');
        	$("body").removeClass('ohidden');
        	location.reload();
		});
	});	
</script>
<style type="text/css" th:if="${planInfo.planSq}==43">
	.gift_promotion2{padding:6rem 0; background:url('http://image.istyle24.com/Statics/design/event/2021/1022Gift/1025_bg_gift.jpg') center no-repeat; background-size: cover; text-align:center;}
    .gift_promotion2 img{max-width:1080px; width:100%;}
    .gift_box2{margin:5rem auto; max-width:1080px;}
    .gift_box2 .gift_section{width:100%; width:auto; padding:0 2.2rem;}
    .gift_box2 p{font-size:18px;}
    .gift_box2 .gift_section{position:relative;}
    .gift_box2 .gift_section #modal-gift2{position:absolute; bottom:2rem; left:50%; transform: translateX(-50%); max-width:18rem;;}
    .gift_box2 .gift_section #modal-gift2 img{width:100%;}
    .sliderwrap3{position:relative; width:100%; margin-bottom:80px; text-align: center;}
    .sliderwrap3 .bx-pager{position:absolute; left:50%; bottom:-2rem; transform:translateX(-50%);}
    .sliderwrap3 .bx-pager div{display:inline-block;padding:0 3px;}
    .sliderwrap3 .bx-pager div a{display:block; width:6px; height:6px; background:#fff; border-radius:100%; color:transparent; font-size:0px;}
    .sliderwrap3 .bx-pager div .active{background:#fd4802;}
    .gift_slider2 li{text-align:right;}

    #giftPop2 {position: fixed; top: 0; right: 0;bottom: 0;left: 0;width: 100%;height: 100%;overflow: auto;z-index: 999;padding: 0;box-sizing: border-box;
	background-color: #fff;text-align: center;}
    .ohidden{overflow:hidden;}
    .green_section{background-color:#638b57; text-align:center; padding:6rem 2rem;}

    .brandSection_Link2{max-width:960px; overflow:hidden; margin:0 auto; border-bottom:1px solid #000;}
    .linkBox_left2{float:left; width:50%; text-align:center; border-top:1px solid #000; border-left:1px solid #000; border-right:1px solid #000; box-sizing: border-box;}
    .linkBox_left2 img{max-width:300px; width:100%;}
    .linkBox_right2{float:right; width:50%; text-align:center;border-top:1px solid #000; border-right:1px solid #000; box-sizing: border-box;}
    .linkBox_right2 img{max-width:300px; width:100%;}
    .gift-modal-info{position:absolute; top:60px;}
</style>
<!-- 이벤트를 위한 임시 script 및 style 추가 종료 (21.10.22 by junghwan)  -->

<main role="" id="" class="container dp">
			<section class="content">
				<div class="inner">
					<div class="promotion_tit">
						<h3 th:text="${planInfo.planNm}"></h3>
						<div class="period">
							<span th:text="${planInfo.dispStdt}"></span> - <span th:text="${planInfo.dispEddt}"></span>
						</div>
						<button type="button" class="share_btn"><img th:src="${@environment.getProperty('domain.uximage')} + '/images/mo/ico_share_btn.png'" alt="공유" /></button>
					</div>
				</div>
				<div class="inner wide">
					<div class="promotion_visual type1" th:if="${fsrcInfoTop != null}" th:utext="${#strings.replace(#strings.replace(fsrcInfoTop.fsrcMob,'&amplt;','<'),'&ampgt;','>')}">
					</div>
				</div>
				<th:block th:each="a, template : ${templateOrd}">
					<th:block th:if="${a.tmplType == 'G082_10'}">
		                <div class="inner bg_gray" th:id="${a.tmplType}" style="display: none">
						</div>
					</th:block>
					<th:block th:if="${a.tmplType == 'G082_20'}">
		                <div class="inner" th:id="${a.tmplType}" style="display: none">
						</div>
					</th:block>
					<th:block th:if="${a.tmplType == 'G082_30'}"><!-- 이미지 -->
						 <div class="inner wide" th:id="${a.tmplType}" style="display: none">
						</div>
					</th:block>
					<th:block th:if="${a.tmplType == 'G082_50'}">
						<div class="inner wide" th:id="${a.tmplType + a.planContSq}" style="display: none">
                		</div>
					</th:block>
					<th:block th:if="${a.tmplType == 'G082_51'}">
						<div class="inner" th:id="${a.tmplType + a.planContSq}" style="display: none">
							<div class="dp_listItems_wrap">
								<h2 class="dp_subtitle">
									<th:block th:if="${a.linkUrl!=null && a.linkUrl!=''}">
										<a th:href="${a.linkUrl}" th:text="${a.title}"></a>
									</th:block>
									<th:block th:unless="${a.linkUrl!=null && a.linkUrl!=''}">
										[[${a.title}]]
									</th:block>
								</h2>
								<div class="itemsGrp" th:id="'group_'+${a.planContSq}">

								</div>
								<button class="btn btn_default" th:id="'moreBtn_'+${a.planContSq}" th:onclick="moreBtn([[${a.planContSq}]])">더보기</button>
							</div>
						</div>
					</th:block>
					<th:block th:if="${a.tmplType == 'G082_52'}">
						<div class="inner" th:id="${a.tmplType + a.planContSq}" style="display: none">
                    	</div>
					</th:block>
					<th:block th:if="${a.tmplType == 'G082_60'}">
						<div class="inner" th:id="${a.tmplType}" style="display: none">
						</div>
					</th:block>
				</th:block>
				<div class="inner wide">
					<div class="promotion_visual type1" th:if="${fsrcInfoBtm != null}"  th:utext="${#strings.replace(#strings.replace(fsrcInfoBtm.fsrcMob,'&amplt;','<'),'&ampgt;','>')}">
					</div>
				</div>
				<div class="inner" th:if="${planInfo.pollSq != null}">
					<div class="dp_btn_area">
						<div class="btn_wrap">
							<a href="javascript:;" id="btn_survey" class="btn btn_primary" onclick="javascript:fnJoinConfirm()"><span>설문조사 참여하기</span></a>
						</div>
					</div>
				</div>

					<!-- 댓글리스트 -->
				<th:block th:if="${planInfo.replyYn == 'Y'}">
				<div class="inner wide">
					<form action="" class="form_wrap">
						<div class="cmt_wrap">
							<div class="cmt_write">
								<div class="cmt_tarea">
									<div class="form_field">
										<div class="ui_col_12 comment_textarea">
											<div class="input_wrap">
												<textarea class="doc_contactus" name="replyText" id="replyText" placeholder="500자 이내로 입력해 주세요." style="resize: none;" onclick="fnTextConfirm()" maxlength="500"></textarea>
												<p class="txt_cnt">
													<span id="contactus_cnt" class="contactus_cnt"><em class="c_primary" id="cmt_cnt">0</em>/500</span>
												</p>
											</div>
										</div>
									</div>
								</div>
								<div class="cmt_thumb">
									<div class="form_field">
										<div class="input_wrap">
											<div class="form_field">
												<div class="imgUpload">
													<label for="fileAdd" class="fileAdd" id="fileAdd_reply">첫번째업로드</label>
													<input type="file" id="fileAdd" name="files" accept=".jpeg, .jpg, .png">
												</div>
											</div>
										</div>
									</div>
								</div>
								<div class="btn_wrap">
									<button type="button" id="btn_cmt_regist" class="btn btn_dark" onclick="fnReplySave()"><span>등록</span></button>
								</div>
							</div>
							<!-- 댓글 -->
							<div class="cmt_group" id="replyList">

							</div>
						</div>
					</form>
				</div>
				</th:block>

				<th:block th:if="${#lists.size(planCornerList)>0 && planInfo.cornerNmDispYn == 'Y'}">
				<div class="inner" id="cornerInner">
					<div class="dp_listItems_wrap typeSelector">
						<div class="items_option">
							<div class="open_categori" style="position: relative; width: 100%; z-index: 0;">
								<a id="filter"></a>
							</div>
						</div>
					</div>
				</div>
				<div id="cornerGoodsList"></div>
				</th:block>
				<th:block th:if="${planList != null and planList.size() > 0}">
					<div class="inner">
						<div class="other_promotion_slide">
							<h2 th:if="${planInfo.planGb == 'P'}" class="dp_subtitle">다른 기획전 보기</h2>
							<h2 th:if="${planInfo.planGb == 'E'}" class="dp_subtitle">다른 이벤트 보기</h2>
							<div class="swiper-container">
								<div class="swiper-wrapper">
								  <th:block th:each="PlanData, PlanStat : ${planList}">
									<div class="swiper-slide">
										<a th:onclick="cfnGoToPlanDetail([[${PlanData.planSq}]])" class="dp_lookbook_item" tabindex="0">
											<div class="img">
												<img th:src="${@environment.getProperty('upload.image.view')+PlanData.mainImg+'?RS=960'}" th:alt="${PlanData.planNm}">
											</div>
											<div class="txt">
												<div class="tit" th:text="${PlanData.planNm}"></div>
											</div>
										</a>
									</div>
									</th:block>
								</div>
							</div>
						</div>
					</div>
				</th:block>
			</section>

			<!-- 코너 클릭 팝 -->
            <div id="odDatePop" class="popup_box odDatePop">
                <div class="lap">
                    <div class="popup_close">카테고리닫기</div>
                    <div class="popup_head sr-only">
                        <h2 class="">기간 선택 팝업</h2>
                    </div>
                    <div class="popup_con">
                        <div class="button_list clear">
                        	<th:block th:if="${planCornerList!=null && planInfo.cornerNmDispYn == 'Y'}" th:each="a, cornerStat : ${planCornerList}">
                           	 <button type="button" th:onclick="fnCornerClick([[${cornerStat.index+1}]], [[${a.cornerNm}]])"><span th:text="${a.cornerNm}"></span></button>
                            </th:block>
                        </div>
                    </div>
                </div>
            </div>


			<!-- 쿠폰사용안내 팝업 -->
			<div class="modal fade couponInfo_pop" id="couponInfoPop" tabindex="-1" role="dialog" aria-labelledby="couponInfoLabel" aria-hidden="true">
				<div class="modal-dialog" role="document">
					<div class="modal-content">
						<!-- 쿠폰사용안내 팝업 내용 -->
					</div>
				</div>
				<a href="#close-modal" rel="modal:close" id="couponInfoPop_close" class="close-modal">Close</a>
			</div>
		</main>

	<!-- (공통) 공유팝업 -->
		<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>
					<div class="modal-body">
						<!-- toggle contents -->
						<div id="layerShare" class="setShare open"
							th:with="stylelUrl=${@environment.getProperty('domain.front')},  planView=${@environment.getProperty('upload.image.view')}">
							<span>
								<button type="button" id="kakao-link-btn" class="kk" th:attr="onclick=|cfnSendToKakao('${stylelUrl+'/planning/detail/form?planSq='+planInfo.planSq}', '${planInfo.planNm}', '${planView+ '/'+planInfo.mainMimg}');|">
									<span>카카오톡</span>
								</button>
								<button type="button" class="fb"
									th:attr="onclick=|sendSns('facebook', '${stylelUrl+'/planning/detail/form?planSq='+planInfo.planSq}', '${planInfo.planNm}', '', '');|">
									<span>페이스북</span>
								</button>
								<button type="button" class="tw"
									th:attr="onclick=|sendSns('twitter', '${stylelUrl+'/planning/detail/form?planSq='+planInfo.planSq}',  '${planInfo.planNm+ '#style24몰'}', '', '');|">
									<span>트위터</span>
								</button>
								<button type="button" class="url btn_copy">
									<span>URL</span>
								</button>
							</span>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script>
			// 공유팝업
			$('.share_btn').click(function(e){
				e.preventDefault();
				$('#tglShare').modal("show");
			});
		</script>

<th:block th:each="a, template : ${templateOrd}">
	<th:block th:if="${a.tmplType == 'G082_51'}">
		<form th:id="'searchForm1_'+${a.tmplType + a.planContSq}" name="searchForm1" th:action="@{'/planning/goods/list'}" th:method="post">
			<input type="hidden" name="pageNo2" value="1" />
			<input type="hidden" name="pageSize2" value="6" />
			<input type="hidden" name="tmplType" th:value="${a.tmplType}" />
			<input type="hidden" name="planContSq" th:value="${a.planContSq}" />
			<input type="hidden" name="planSq" th:value="${planInfo.planSq}" />
		</form>
	</th:block>
</th:block>
<form id="searchForm" name="searchForm" th:action="@{/planning/reply/list}" th:method="post">
	<input type="hidden" name="pageNo" value="1" />
	<input type="hidden" name="planSq" th:value="${planInfo.planSq}" />
	<input type="hidden" name="pageSize" value="10" />
</form>
<script src="/ux/plugins/gaga/gaga.paging.js"></script>
<script th:inline="javascript">
let review = [[${reviewInfo}]];
let reviewContent = [[${reviewContent}]];
let coupon = [[${couponInfo}]];
let couponContent = [[${couponContent}]];
let plan = [[${planInfo}]];
let image = [[${imageInfo}]];
let notice = [[${noticeInfo}]];
let goods1 = [[${goods1Info}]];
let goods1Content = [[${goods1Content}]];
let goods2 = [[${goods2Info}]];
let goods2Content = [[${goods2Content}]];
let goods4 = [[${goods4Info}]];
let goods4Content = [[${goods4Content}]];
let template =[[${templateOrd}]];
let replyList = [[${replyList}]];
let replyCount = [[${replyCount}]];
let replyAttachList = [[${replyAttachList}]];
let planCornerGoodsList = [[${planCornerGoodsList}]];
let planCornerList = [[${planCornerList}]];

var ajaxReplyList = function () {
	gagaPaging.init('searchForm', fnSearchCallback, 'paging', 10);
	gagaPaging.load(1);
}

var fnSearchCallback = function (result) {
	 $("#replyList").html('');
	 if (result!=null) {
		var html = '';

		html += '<div class="cmt_list_tit">';
		html += '	<strong>댓글</strong><span class="cnt">('+result.replyCount.addComma()+')</span> ';
		html += '</div>';
		 if (result.replyList.length>0) {
			 html += '<ul class="cmt_list">';
			 $.each(result.replyList, function (idx, item) {
				 html += '	<li>';
					html += '		<div class="cmt_top">';
					html += '			<span class="writer">'+item.maskingCustId+'</span>';
					html += '			<span class="date">'+item.entryDt+'</span>';
					if (item.entryCustNo == result.custNo) {
						html += '			<button type="button" id="btn_cmt_delete" class="btn_del" value="'+item.planEntrySq+'" onclick="fnDelReply(this.value)">삭제</button>';
					}
					html += '		</div>';
					html += '		<div class="cmt_cont">';
					if (result.replyAttachList.length>0) {
						html += '			<div class="img_wrap clear">';
						var j = 0;
						for (var i = 0; i < result.replyAttachList.length; i++) {
							if(result.replyAttachList[i].planEntrySq == item.planEntrySq){
								html += '				<div class="pics"><img class="picsThumbs" src="'+ _uploadImageUrl +'/'+result.replyAttachList[i].sysFileNm +'" onclick="cfPlanReplyDetail(\''+item.planSq+'\',\''+item.planEntrySq+'\',\''+result.replyAttachList[i].planEntryAtSq+'\', \''+ j +'\');"></div>';
								j++;
							}

						}
						html += '			</div>';
					}
					html += '			<p>'+item.entryVal1.escapeHtml()+'</p>';
					html += '		</div>';
					html += '	</li>';
			 });
				html += '</ul>';
				html += '<div class="paging_wrap">';
				html += '	<ul class="pageNav" id="paging">';
				html += '	</ul>';
				html += '</div>';

		 }else{
			 html += '<div class="nodata"> ';
				html += '	<div class="txt_box">             ';
				html += '		<p>                           ';
				html += '			등록된 댓글이 없습니다.             ';
				html += '		</p>                          ';
				html += '	</div>                            ';
				html += '</div>                                ';
		 }
	 }
	 $("#replyList").append(html);

	// Create pagination
	gagaPaging.createSinglePagination(result.paging.pageable);
}

// 댓글 삭제
var fnDelReply = function(obj) {

	data = {planEntrySq : obj};
	var jsonData = JSON.stringify(data);

	mcxDialog.confirm("댓글을 삭제 하시겠습니까?", {
		cancelBtnText : "취소",
		sureBtnText : "확인",
		sureBtnClick : function() {

		gagajf.ajaxJsonSubmit('/planning/reply/delete', jsonData,function() {
			ajaxReplyList();
			});
		}
	})
}

$('#fileAdd').on('change', function() { fnChooseFile(this); });

var fnChooseFile = function(obj) {
	var picLength = $(".pics").length;

	// multiple 속성이 있으면 files에는 다수의 객체가 할당됨
	var file = obj.files[0];

	if (!gagajf.isNull(file.name)) {
		var extension = "\.(jpg|jpeg|png)$";
		if (!(new RegExp(extension, "i")).test(file.name)) {
			mcxDialog.alertC('이미지는 [jpg, jpeg, png] 파일만 가능합니다.', {
				sureBtnText: "확인",
				sureBtnClick: function() {
					//$(obj).parent('.imgUpload').find('.removes').trigger('click');
					$('.imgUpload').find('span').eq(0).remove();
				}
			});
			return false;
		}
	}
	// 이거 왜 안먹히지
	if (!gagajf.isNull(file.size) && Number(file.size) > (10 * 1000000)) {
		mcxDialog.alertC('이미지는 최대 10MB 이하 파일만 가능합니다.', {
			sureBtnText: "확인",
			sureBtnClick: function() {
				$(obj).parent('.imgUpload').find('.removes').trigger('click');
			}
		});
		return false;
	}

	// 파일 업로드
	 gagajf.ajaxFileUpload('/common/file/upload?subDir=/reply'
			, file
			, function(result) {
				// 업로드한 파일명 설정
			$(".imgUpload").find('.pics').last().append("<input type='hidden' name='orgFileNm' id='orgFileNm"+(picLength+1)+"' value='"+result.oldFileName+"'>");
			$(".imgUpload").find('.pics').last().append("<input type='hidden' name='sysFileNm' id='sysFileNm"+(picLength+1)+"' value='"+result.newFileName+"'>");
		}
	);
}

//댓글 등록 버튼 클릭 시
var fnReplySave = function() {
	var fileLength = $("input[name='sysFileNm']").length;

	var content = $('#replyText').val();
	if (content.length < 2){
		mcxDialog.alert("최소 2자 이상 입력해주세요.");
		return;
	}

	var yokList = new Array('<script>','script','D쥐고','D지고','jonna','jot같','mi쳤','ssㅑ','tlqkf','wlfkf','같은새끼','같은새끼','개새끼','개같','개넷','개년','개념빠가','개독','개련','개련','개마이','개부랄','개삼성','개새기','개새끼','개섹','개셈','개소리','개쓰래기','개저씨','계새끼','골빈','골1빈','골빈','괘새끼','껒여','꺼지세요','꺼져요','로꺼져','로꺼져','로꺼.져','꺼.지','나빼썅','나쁜새끼','년놈','늬믜','늬미','니년','니믜','니미럴','닝기리','다꺼져','닥쳐라','닥치세','도라이','뒈져','뒤져버','디져라','디졌','디지고','디질','딴년','또라이','또라인','똘아이','ㅁㅊ','ㅁ친','맘충','보이루','망돌','머갈','먹.금','먹.끔','먹1금','먹금','먹끔','명존','믜칀','믜친','미:놈','미:놈','미1친','미놈','미시친발','미쳣네','미쳤나','미쳤니','미췬','미칀','미친새','미친~','미친개','미친새','미친색','미친ㅋ','미틴','및힌','별창','병1신','병1크','병맛','병신','병크','봊','븅신','빠큐','빡새끼','빻았','빻은','뻐규','뻐큐','뻑유','뻑큐','뻨큐','뼈큐','뽄새','뽄세','삐걱','ㅄ','ㅅ','ㅂ','ㅅ.ㅂ','ㅅ1ㅂ','ㅅ1발','ㅅㄲ네','ㅅㄲ들','ㅅ루','ㅅㅋ','ㅅㅡ루','사새끼','새.끼','새1끼','새1키','새77ㅣ','새끼라','새끼야','새퀴','새킈','새키','색희','색히','샊기','샊히','샹년','섀키','솔1친','솔친','쉬발','쉬버','쉬이바','쉬이이','쉬이이이','쉬펄','슈1발','슈레기','슈발','슈벌','슈우벌','슈ㅣ발','스.루','스벌','스죄','스타죄국','싑창','시1발','시미발친','시미친발','시바','시바류','시바시바','시바알','시바앙','시발','시방새','시벌탱','시볼탱','시부럴','시부렬','시부울','시뷰럴','시뷰렬','시빨','시새발끼','시이발','시친발미','시키가','시팔','시펄','십창','십팔','ㅆ1ㄺ','ㅆ1ㅂ','ㅆㄹㄱ','ㅆㄺ','ㅆㅂ','싸가지없','싸가지없','싸물어','쌉가','쌍년','쌍놈','쌔끼','썅','썌끼','쒸펄','쓰1레기','쓰래기같','쓰레기새','쓰레기새','쓰렉','씝창','씨1발','씨바라','씨바알','씨발','씨방새','씨버럼','씨벌','씨벌탱','씨볼탱','씨부럴','씨부렬','씨뷰럴','씨뷰렬','씨빠빠','씨빨','씨뻘','씨새발끼','씨이발','씨팔','씹귀','씹덕','씹못','씹뻐럴','씹새끼','씹쌔','씹창','씹치','씹팔','씹할','ㅇㅍㅊㅌ','아가리','아닥','아오ㅅㅂ','아오시바','아오ㅅㅂ','아오시바','애미','앰','앰창','얘쁘','얘쁜','얪','에라이퉤','에라이퉷','에라이퉤','에라이퉷','엠뷩신','엠븽신','엠빙신','엠생','엠창','엿같','엿이나','예.질','예1질','예질','옘병','외1퀴','외퀴','웅앵','웅엥','은년','은새끼','이새끼','이따위','이새끼','입털','입털','ㅈ.ㄴ','ㅈㄴ','ㅈㄹ','절라','정병','젖같','젗같','젼나','젼낰','졀라','졀리','졌같은','졏같','조낸','조온','조온나','족까','존나','존나','존','나','존.나','존1','존1나','존귀','존귘','존ㄴ나','존나','존낙','존내','졸라','좁밥','조센징','짱깨','짱개','짱꼴라','꼴라','착짱','죽짱','짱골라','좃','종나','좆','좆까','좇같','죠낸','죠온나','죤나','죤내','죵나','죶','죽어버려','죽여버리고','죽여버리고','죽여불고','죽여뿌고','중립충','줬같은','쥐랄','쥰나','쥰내','쥰니','쥰트','즤랄','지랄','지1랄','지1뢰','지껄이','지들이','지랄','지롤','지뢰','지인지조','짱깨','짱께','쪼녜','쪼다','착짱죽짱','섬숭이','쪽본','쪽1바리','쪽바리','쪽발','쫀맛','쫀1','쫀귀','쫀맛','쫂','쫓같','쬰잘','쬲','찝째끼','창년','창녀','창놈','창넘','처먹','凸','첫빠','쳐마','친년','친놈','친구년','친년','친노마','친놈','손놈','남미새','여미새','혐석','호로새끼','호로잡','화낭년','화냥년','후.려','후1려','후1빨','후려','후빨','ㅗ');

	if(yokList.indexOf(content)>=0){
		mcxDialog.alert("입력 불가한 내용을 포함하고 있습니다.");
		$('#replyText').val('');
		$('#cmt_cnt').text(0);
		return;
	}

	//파일관련 데이터 담기
	var multiReplyOrgFile = [];
	var multiReplySysFile = [];
	for (var i = 0; i < fileLength; i++) {
		multiReplyOrgFile.push($(".pics").eq(i).find('input[name="orgFileNm"]').val());
		multiReplySysFile.push($(".pics").eq(i).find('input[name="sysFileNm"]').val());
	}
	data = {entryVal1 : content,
			planSq : plan.planSq,
			multiReplyOrgFile : multiReplyOrgFile,
			multiReplySysFile : multiReplySysFile};
	var jsonData = JSON.stringify(data);

	mcxDialog.confirm("댓글을 등록 하시겠습니까?", {
		cancelBtnText : "취소",
		sureBtnText : "확인",
		sureBtnClick : function() {

		gagajf.ajaxJsonSubmit('/planning/reply/save', jsonData,function() {
			ajaxReplyList();
			$('#replyText').val('');
			$('.pics').remove();
			$('.fileAdd').show();
			//댓글 작성시 글자 카운트
			$('#cmt_cnt').text(0);
			});
		}
	})
}

if (notice.length>0) {
	$("#G082_60").show();

	var html = '';

	html += '<div class="announce_txt">';
	html += '	<div class="note_txt">';
	html += '		<img src="' + _uximgUrl + '/images/mo/ico_content_find03.png" alt="유의사항">';
	html += '		<p>유의사항</p>';
	html += '	</div>';
	html += '	<div class="announce_list">';
	html += '		<ul>';
	$.each(notice, function(idx, item)  {
	html += '			<li>' +item.itemVal.escapeHtml();+ '</li>';
	});
	html += '		</ul>';
	html += '	</div>';
	html += '</div>';

	$("#G082_60").append(html);
}

if(planCornerList.length>0 && plan.cornerNmDispYn == "Y"){

	var html = '';
	$.each(planCornerList, function(idx, item)  {
		html += '<div class="inner" >\n';
		html += '	<div class="dp_listItems_wrap type'+(idx+1)+'">\n											';
		html += '		<h2 class="dp_subtitle">'+item.cornerNm+'</h2>\n';
		html += '		<div class="list_content">\n';
		html += '			<div class="itemsGrp">\n';
		$.each(planCornerGoodsList, function(idx2, item2)  {
			if (item2.cornerNm == item.cornerNm) {
				html += '				<div class="item_prod">\n';
				html += '					<div class="item_state">\n';
				html += '						<button type="button" class="itemLike';
				if(item2.likeIt == 'likeit'){
					html += ' likeit';
				}
				html += ' "';
				html += 'onClick="cfnPutWishList(this);" goodsCd=\''+item2.goodsCd+'\', goodsNm=\'' + item2.goodsNm + '\', ithrCd=\'\', contentsLoc=\'\', planDtlSq=\'\'>관심상품 추가</button>\n';
				html += '						<a href="javascript:void(0);" onclick="cfnGoToGoodsDetail(\'' + item2.goodsCd + '\',\'\',\'IN12_01\',\'\',\'' + item.planDtlSq+ '\')"  class="itemLink">\n';
				html += '							<div class="itemPic">\n';
				html += '								<img class="vLHTC pd_img" src="'+ _uploadGoodsUrl +'/'+item2.sysImgNm +'?RS=550">\n';
				html += '							</div>\n';
				html += '							<p class="itemBrand">'+item2.brandGroupNm+'</p>\n';
				if(item2.goodsTnm != null){
					html += '							<div class="itemComment">'+item2.goodsTnm+'</div>\n';
				}
				html += '							<div class="itemName">'+item2.goodsNm+'</div>\n';
				html += '							<p class="itemPrice">\n';
				if (item2.currPrice != item2.listPrice) {
					html += '								<span class="itemPrice_original">'+item2.listPrice.addComma()+'</span>\n';
				}
				html += item2.currPrice.addComma();
				if (item2.dcRate != 0) {
					html += '								<span class="itemPercent">'+item2.dcRate.addComma()+'%</span>\n';
				}
				html += '							</p>\n';
				html += '							<div class="itemcolorchip">\n';
				if(!gagajf.isNull(item2.colorChips)){
					var colorArr = item2.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'){
							html += '	<span class="chip_color" style="background-color: '+rgbColor+';border:1px solid #aaa;" value="'+colorCd+'">'+colorCd+'</span>\n';
						}else{
							html += '	<span class="chip_color" style="background-color: '+rgbColor+'" value="'+colorCd+'">'+colorCd+'</span>\n';
						}
					}
				}
				html += '							</div>\n';
				if(!gagajf.isNull(item2.icon)){
					var iconArr = item2.icon.split(",");
					var iconGb = '';
					var iconNm = '';
					html += '	<p class="itemBadge">\n';
					for(let i=0; i<iconArr.length; i++){
						var iconInfo = iconArr[i].split(":");
						iconGb = iconInfo[0];
						iconNm = iconInfo[1];
						html += '	<span class="badge13" value="'+iconGb+'">'+iconNm+' </span>\n';
					}
					html += '	</p>\n';
				}
				html += '						</a>\n';
				html += '					</div>\n';
				html += '				</div>\n';
			}
		});
		html += '			</div>\n';
		html += '		</div>\n';
		html += '	</div>\n';
		html += '</div>\n';

	});

	$("#cornerGoodsList").append(html);

}

if(template.length>0){
	var array = [];

	for (var j = 0; j < template.length; j++) {
		if(template[j].tmplType == 'G082_50'){
			array.push(template[j].planContSq);
		}
	}
	var html = '';
	for (var i = 0; i < template.length; i++) {
		html = '';
		if(template[i].tmplType == 'G082_50' && array[0] == template[i].planContSq && typeof array[0] != 'undefined') {
			if(template[i].title != null && template[i].title != ''){
				$("#G082_50" +template[i].planContSq).show();
			}
			html += '<div class="dp_listItems_cont type1">\n';
			html += '	<h2 class="dp_subtitle">\n';
			if (template[i].linkUrl != null && template[i].linkUrl != '') { /* 링크 변경 예정 */
				if (template[i].linkOpenGb == 'M') { //본창
					html += '        <a href="'+template[i].linkUrl+'" target="_self">'+template[i].title+'</a>\n';
				}else{
					html += '        <a href="'+template[i].linkUrl+'" target="_blank">'+template[i].title+'</a>\n';
				}
			}else{
				html +=template[i].title;
			}
			html += '   </h2>\n';
			html += '	<div class="swiper-container item01">\n';
			html += '		<div class="swiper-wrapper">\n';
			$.each(goods1, function(idx, item)  {
				if (item.planContSq == template[i].planContSq) {
					$("#G082_50" + item.planContSq).show();
					html += '			<div class="swiper-slide">\n';
					html += '				<div class="item_prod">\n';
					html += '					<div class="item_state">\n';
					html += '						<a href="javascript:void(0);" onclick="cfnGoToGoodsDetail(\'' + item.goodsCd + '\',\'\',\'IN12_01\')" class="itemLink">\n';
					html += '							<div class="itemPic">\n';
					html += '								<img class="vLHTC pd_img" src="'+ _uploadGoodsUrl +'/'+item.sysImgNm +'?RS=780" alt="">\n';
					html += '							</div>\n';
					html += '							<p class="itemBrand">'+item.brandGroupNm+'</p>\n';
					if(item.goodsTnm != null){
						html += '							<div class="itemComment">'+item.goodsTnm+'</div>\n';
					}
					html += '							<div class="itemName">'+item.goodsNm+'</div>\n';
					html += '							<p class="itemPrice">\n';
					if (item.currPrice != item.listPrice) {
						html += '								<span class="itemPrice_original">'+item.listPrice.addComma()+'</span>\n';
					}
					html +=                             item.currPrice.addComma();
					if (item.currPrice != item.listPrice) {
						html += '								<span class="itemPercent">'+Math.floor(item.dcRate)+'%</span>\n';
					}
					html += '							</p>\n';
					html += '						</a>\n';
					html += '					</div>\n';
					html += '				</div>\n';
					html += '			</div>\n';
				}
			});
			html += '		</div>\n';
			html += '		<div class="swiper-pagination"></div>\n';
			html += '	</div>\n';
			html += '</div>\n';
			$("#G082_50" +array[0]).append(html);
		}

		if($("#G082_50" +template[i].planContSq).length){
			array.shift();
		}
	}
}

var fnCompleteList = function () {
	$.each(template, function(idx, item)  {
		if(item.tmplType == "G082_51"){
			if(item.title != null && item.title != ''){
				$("#G082_51" +item.planContSq).show();
			}
			var form = '#searchForm1_G082_51'+item.planContSq;
			gagajf.ajaxFormSubmit('/planning/goods/list', form, fnGetCompleteCallback);
		}
	});
}

var fnGetCompleteCallback = function (result) {
	if(template.length>0){
		if (result.dataList != null && result.dataList.length > 0) {
			var html = '';
			$.each(result.dataList, function(idx, item) {
				html += '		<div class="item_prod">\n';
				html += '			<div class="item_state">\n';
				html += '				<a onclick="cfnGoToGoodsDetail(\'' + item.goodsCd + '\',\'\',\'IN12_01\')" class="itemLink">\n';
				html += '					<div class="itemPic">\n';
				html += '						<img class="vLHTC pd_img" src="'+ _uploadGoodsUrl +'/'+item.sysImgNm +'">\n';
				html += '					</div>\n';
				html += '					<p class="itemBrand">'+item.brandGroupNm+'</p>\n';
				if(item.goodsTnm != null){
					html += '					<div class="itemComment">'+item.goodsTnm+'</div>\n';
				}
				html += '					<div class="itemName">'+item.goodsNm+'</div>\n';
				html += '					<p class="itemPrice">\n';
				if (item.currPrice != item.listPrice) {
					html += '						<span class="itemPrice_original">'+item.listPrice.addComma()+'</span>\n';
				}
				html += 						item.currPrice.addComma();
				if (item.currPrice != item.listPrice) {
					html += '						<span class="itemPercent">'+Math.floor(item.dcRate)+'%</span>\n';
				}
				html += '					</p>\n';
				html += '				</a>\n';
				html += '			</div>\n';
				html += '		</div>\n';
		});
			$('#group_'+result.dataList[0].planContSq).append(html);
			if (result.paging1.pageable2.totalPage > result.paging1.pageable2.pageNo) {

				$('#moreBtn_' + result.dataList[0].planContSq).show();
				$('#searchForm1_G082_51'+result.dataList[0].planContSq +' input[name=pageNo2]').val(result.paging1.pageable2.pageNo + 1);

			}else{
				$('#moreBtn_' + result.dataList[0].planContSq).hide();
			}
		}
	}
}

var moreBtn = function (obj) {
	var form = '#searchForm1_G082_51'+obj;
	gagajf.ajaxFormSubmit('/planning/goods/list', form, fnGetCompleteCallback);
}



if(template.length>0){
	var array = [];
	var html = '';
	for (var j = 0; j < template.length; j++) {
		if(template[j].tmplType == 'G082_52'){
			array.push(template[j].planContSq);
		}
	}

	for (var i = 0; i < template.length; i++) {
		html = '';
		if(template[i].tmplType == 'G082_52' && array[0] == template[i].planContSq && typeof array[0] != 'undefined'){
			if(template[i].title != null && template[i].title != ''){
				$("#G082_52" +template[i].planContSq).show();
			}
			html += '<div class="dp_listItems_cont type2">\n';
			if (template[i].linkUrl != null && template[i].linkUrl != '') { /* 링크 변경 예정 */
				if (template[i].linkOpenGb == "M") { //본창
					html += '	<h2 class="dp_subtitle"><a href="'+template[i].linkUrl+'" target="_self">'+template[i].title+' </a></h2>\n';
				}else{
					html += '	<h2 class="dp_subtitle"><a href="'+template[i].linkUrl+'" target="_blank">'+template[i].title+' </a></h2>\n';
				}
			}else{
				html += '	<h2 class="dp_subtitle">'+template[i].title+'</h2>\n';
			}

			html += '	<div class="swiper-container item02">\n';
			html += '		<div class="swiper-wrapper">\n';
			$.each(goods4, function(idx, item) {
				if (item.planContSq == template[i].planContSq) {
					$("#G082_52" + item.planContSq).show();
					html += '			<div class="swiper-slide">\n';
					html += '				<div class="item_prod">\n';
					html += '					<div class="item_state">\n';
					html += '						<a href="javascript:void(0);" onclick="cfnGoToGoodsDetail(\'' + item.goodsCd + '\',\'\',\'IN12_01\')" class="itemLink">\n';
					html += '							<div class="itemPic">\n';
					html += '								<img class="vLHTC pd_img" src="' + _uploadGoodsUrl + '/' + item.sysImgNm + '">\n';
					html += '							</div>\n';
					html += '							<p class="itemBrand">' + item.brandGroupNm + '</p>\n';
					if (item.goodsTnm != null) {
						html += '							<div class="itemComment">' + item.goodsTnm + '</div>\n';
					}
					html += '							<div class="itemName">' + item.goodsNm + '</div>\n';
					html += '							<p class="itemPrice">\n';
					if (item.currPrice != item.listPrice) {
						html += '								<span class="itemPrice_original">' + item.listPrice.addComma() + '</span>\n';
					}

					html += item.currPrice.addComma();
					if (item.currPrice != item.listPrice) {
						html += '								<span class="itemPercent">' + Math.floor(item.dcRate) + '%</span>\n';
					}
					html += '							</p>\n';
					html += '						</a>\n';
					html += '					</div>\n';
					html += '				</div>\n';
					html += '			</div>\n';
				}
			})

			html += '		</div>\n';
			html += '		<div class="swiper-pagination"></div>\n';
			html += '	</div>\n';
			html += '</div>\n';
			$("#G082_52" +array[0]).append(html);
		}
		if($("#G082_52" +template[i].planContSq).length){
			array.shift();
		}
	}
}

if(template.length>0){
	if(review.length>0 || (reviewContent.length>0 && !gagajf.isNull(reviewContent[0].title)) ){
		$("#G082_10").show();
		var html = '';

		html += '<div class="dp_review_cont">\n';
		html += '	<div class="dp_review">\n';
		html += '		<h2 class="dp_subtitle">'+reviewContent[0].title+'</h2>\n';
		html += '		<div class="review">\n';
		html += '			<div class="swiper-container review_list">\n';
		html += '				<div class="swiper-wrapper">\n';
		$.each(review, function(idx, item)  {
			html += '					<div class="swiper-slide">\n';
			html += '						<div>\n';
			html += '							<div class="best_review">\n';
			if(item.reviewSysImg!= null){
				if (item.bestYn == 'Y') {
					html += '								<a href="javascript:void();" onclick="cfPlanningReviewDetail(\''+item.goodsCd+'\',\'Y\', \'Y\',\''+item.reviewSq+'\',1);">\n';
				}else{
					html += '								<a href="javascript:void();" onclick="cfPlanningReviewDetail(\''+item.goodsCd+'\',\'N\', \'Y\',\''+item.reviewSq+'\',1);">\n';
				}
			}else{
				if (item.bestYn == 'Y') {
					html += '								<a href="javascript:void();" onclick="cfPlanningReviewDetail(\''+item.goodsCd+'\',\'Y\', \'N\',\''+item.reviewSq+'\',1);">\n';
				}else{
					html += '								<a href="javascript:void();" onclick="cfPlanningReviewDetail(\''+item.goodsCd+'\',\'N\', \'N\',\''+item.reviewSq+'\',1);">\n';
				}
			}
			html += '									<div class="lap">\n';
			html += '										<div class="pic">\n';
			if(item.reviewSysImg!= null){
				if (item.fileGb == 'M') {
					html += '											<span class="thumb mov" style="background-image:url('+ _kollusMediaUrl+'/poster/'+item.kmcKey +');"></span>\n';
				}else{
					html += '											<span class="thumb" style="background-image:url('+ _uploadImageUrl +item.reviewSysImg +'?RS=333);"></span>\n';
				}
			}else{
				html += '											<span class="thumb" style="background-image:url('+ _uploadGoodsUrl+'/'+item.sysImgNm +'?RS=333);"></span>\n';
			}
			html += '										</div>\n';
			html += '										<div class="info">\n';
			html += '											<div>\n';
			html += '												<div class="star_score">\n';
			html += '													<span class="star">\n';
			html += '														<em class="progbar" style="width:'+(item.score*20)+'%;"></em>\n';
			html += '													</span>\n';
			if(item.bestYn == 'Y'){
				html += '													<em class="ico ico_besttag"></em>\n';
			}
			html += '												</div>\n';
			html += '												<div class="txt_best_review">\n';
			html += '													<p>'+item.reviewContent+'</p>';
			html += '												</div>\n';
			html += '												<div class="writer">\n';
			html += '													<span class="wr_id">'+item.maskingCustId+'</span>\n';
			html += '													<span class="wr_date">'+item.regDt+'</span>\n';
			html += '												</div>\n';
			html += '											</div>\n';
			html += '										</div>\n';
			html += '									</div>\n';
			html += '								</a>\n';
			html += '							</div>\n';
			html += '							<div class="product_view">\n';
			html += '								<div class="item_prod">\n';
			html += '									<div class="item_state">\n';
			html += '										<a href="javascript:void(0);" onclick="cfnGoToGoodsDetail(\'' + item.goodsCd + '\',\'\',\'IN12_01\')" class="itemLink">\n';
			html += '											<div class="itemPic">\n';
			html += '												<img alt="" class="vLHTC pd_img" src="'+ _uploadGoodsUrl +'/'+item.sysImgNm +'">\n';
			html += '											</div>\n';
			html += '											<div class="itemName">'+item.goodsNm+'</div>\n';
			html += '											<p class="itemPrice">\n';
			html += '												<span class="itemPrice_sale">'+item.currPrice.addComma()+'</span>\n';
			html += '											</p>\n';
			html += '										</a>\n';
			html += '									</div>\n';
			html += '								</div>\n';
			html += '							</div>\n';
			html += '						</div>\n';
			html += '					</div>\n';
		});
		html += '				</div>\n';
		html += '				<div class="swiper-pagination"></div>\n';
		html += '			</div>\n';
		html += '		</div>\n';
		html += '	</div>\n';
		html += '</div>\n';

		$("#G082_10").append(html);
	}
}

/* 이미지 */
if(image.length>0){
	if (image[0].itemVal != null && image[0].itemVal != '') {
		$("#G082_30").show();

		var html = '';

		html += '<div class="promotion_visual type2">\n';
		html += '	<div class="big_banner_slide">\n';
		html += '		<div class="swiper-container">\n';
		html += '			<div class="swiper-wrapper">\n';
		$.each(image, function(idx, item)  {
			html += '				<div class="swiper-slide">\n';
			if (item.linkOpenGb == 'M') {
				html += '					<a href="'+item.linkUrl+'" target="_self"><img src="'+ _uploadImageUrl + item.itemVal +'?RS=1206" ></a>\n';
			}else{
				html += '					<a href="'+item.linkUrl+'" target="_blank"><img src="'+ _uploadImageUrl + item.itemVal +'?RS=1206" ></a>\n';
			}
			html += '				</div>\n';
		});

		html += '			</div>\n';
		html += '			<div class="swiper-pagination"></div>\n';
		html += '		</div>\n';
		html += '	</div>\n';
		html += '</div>\n';

		$("#G082_30").append(html);
	}
}


if(template.length>0){
	if(coupon.length>0 || (couponContent.length > 0 && !gagajf.isNull(couponContent[0].title)) || (couponContent.length > 0 && !gagajf.isNull(couponContent[0].cpnNote0))){
		$("#G082_20").show();

		var html = '';

		html += '<div class="dp_coupon">\n';
		html += '	<h2 class="dp_subtitle">'+couponContent[0].title+'</h2>\n';
		html += '	<div class="coupon_list">\n';
		html += '		<ul class="clear">\n';
		$.each(coupon, function(idx, item) {
			if (item.couponStat == '쿠폰받기') {
				html += '			<li>\n';
			}else{
				html += '			<li class="off">\n';
			}

			html += '				<div class="cp_top">\n';
			html += '					<div class="cp_detail">\n';
			html += '						<p class="tit">'+item.cpnNm+'</p>\n';
			html += '						<strong class="sale_t won_t"><span>'+item.dcVal.addComma()+'</span>'+item.dcWay+'</strong>\n';
			html += '						<p class="cp_cont">'+item.useCondition+'</p>\n';
			html += '						<span class="cp_cnt">'+item.issueCondition+'</span>\n';
			html += '					</div>\n';
			html += '					<span class="cp_shape"></span>\n';
			html += '				</div>\n';
			html += '				<div class="cp_date" id="dp_coupon1">\n';
			if (item.couponStat == '쿠폰받기') {
				html += '					<button type="button" id="coupon_'+item.cpnId+'" onclick="fnPlanCouponDown('+item.cpnId+')"><span>쿠폰 받기</span></button>\n';
			}else{
				html += '					<button type="button" id="coupon_'+item.cpnId+'" onclick="fnPlanCouponDown('+item.cpnId+')"><span>받기 완료</span></button>\n';
			}
			html += '				</div>\n';
			html += '				<div class="cp_info">\n';
			html += '					<button type="button" id="modalBasic" class="btn_couponInfo_pop" onclick="usePlanInfoCoupon('+item.cpnId+')"><span>사용안내</span></button>\n';
			html += '				</div>\n';
			html += '			</li>\n';
		});
		html += '		</ul>\n';
		html += '	</div>\n';
		if (couponContent[0].cpnNote0 != null && couponContent[0].cpnNote0 != '') {
			html += '	<div class="announce_txt">\n';
			html += '		<div class="note_txt">\n';
			html += '			<img src="' + _uximgUrl + '/images/mo/ico_content_find.png" alt="유의사항">\n';
			html += '			<p>유의사항</p>\n';
			html += '		</div>\n';
			html += '		<div class="announce_list">\n';
			html += '			<ul>\n';
			html += '                  <li>' + couponContent[0].cpnNote0.escapeHtml(); +'</li>\n';
			if(couponContent[0].cpnNote1 != null && couponContent[0].cpnNote1 != '')
				html += '                  <li>' + couponContent[0].cpnNote1.escapeHtml(); +'</li>\n';
			if(couponContent[0].cpnNote2 != null && couponContent[0].cpnNote2 != '')
				html += '                  <li>' + couponContent[0].cpnNote2.escapeHtml(); +'</li>\n';
			if(couponContent[0].cpnNote3 != null && couponContent[0].cpnNote3 != '')
				html += '                  <li>' + couponContent[0].cpnNote3.escapeHtml(); +'</li>\n';
			if(couponContent[0].cpnNote4 != null && couponContent[0].cpnNote4 != '')
				html += '                  <li>' + couponContent[0].cpnNote4.escapeHtml(); +'</li>\n';
			if(couponContent[0].cpnNote5 != null && couponContent[0].cpnNote5 != '')
				html += '                  <li>' + couponContent[0].cpnNote5.escapeHtml(); +'</li>\n';
			if(couponContent[0].cpnNote6 != null && couponContent[0].cpnNote6 != '')
				html += '                  <li>' + couponContent[0].cpnNote6.escapeHtml(); +'</li>\n';
			if(couponContent[0].cpnNote7 != null && couponContent[0].cpnNote7 != '')
				html += '                  <li>' + couponContent[0].cpnNote7.escapeHtml(); +'</li>\n';
			if(couponContent[0].cpnNote8 != null && couponContent[0].cpnNote8 != '')
				html += '                  <li>' + couponContent[0].cpnNote8.escapeHtml(); +'</li>\n';
			if(couponContent[0].cpnNote9 != null && couponContent[0].cpnNote9 != '')
				html += '                  <li>' + couponContent[0].cpnNote9.escapeHtml(); +'</li>\n';
			html += '			</ul>\n';
			html += '		</div>\n';
			html += '	</div>\n';
		}
		html += '</div>\n';

		$("#G082_20").append(html);
	}
}


//쿠폰 사용안내 모달
var usePlanInfoCoupon = function (id) {
	var data = {cpnId : id
			    ,planSq : plan.planSq};
	var jsonData = JSON.stringify(data);

	 $.ajax( {
		type		: "POST",
		url 		: '/planning/coupon/detailpop',
		data		: jsonData,
		contentType: 'application/json',
		dataType 	: 'html',
		success 	: function(result) {
			if (result != null) {
				$("#couponInfoPop").html(result);
				$("#couponInfoPop").modal("show");
			}
		}
	});

	return false;
}

//설문조사 참여 버튼 클릭
var fnJoinConfirm = function () {
	let planSq = plan.planSq;
	if (!cfCheckLogin()) {
		// mcxDialog.alert("로그인 후 참여 가능합니다.");
		mcxDialog.alertC("로그인 후 참여 가능합니다.", { //내용
			sureBtnText: "로그인",  //버튼명
			sureBtnClick: function(){
				location.href="/signin";
			}
		});
		return false;
	}else{
		cfnGoToPollDetail(planSq);
	}

}

//쿠폰 다운로드
var fnPlanCouponDown = function(obj){

	if (!cfCheckLogin()) {
		cfnGoToPage(_PAGE_LOGIN);
		return false;
	}

	let cpnId = obj;
	gagajf.ajaxJsonSubmit(_PAGE_PLANNING_CPN_DOWNLOAD, JSON.stringify({cpnId: cpnId}), fnPlanCouponCallBack);
}

// 쿠폰다운로드 콜백
var fnPlanCouponCallBack = function(result){
	$.each(result.couponList, function (idx, item) {
		if (Number(item.custPubLimitQty) > 0){
			if (Number(item.custPubLimitQty) <= Number(item.custCouponCnt)){
				$('#coupon_'+ item.cpnId).html('<span>받기완료</span>');
				$('#coupon_'+ item.cpnId).attr('disabled', true);
			}
		}
	});
}


var fnCornerClick = function(obj,obj2) {
	$("#filter").text(obj2);
	var offset = $('.dp_listItems_wrap.type'+obj).offset(); //선택한 태그의 위치를 반환
	//animate()메서드를 이용해서 선택한 태그의 스크롤 위치를 지정해서 0.4초 동안 부드럽게 해당 위치로 이동함
	$('html').animate({scrollTop :  offset.top - 60}, 400);
}

//상품평 상세 레이어 호출후 콜백에서 호출하므로 여기에 있어야함
var fnReviewDetailLayerCollBack = function(){

}

//댓글 입력 확인
var fnTextConfirm = function() {
	//로그인 확인
	if (!cfCheckLogin()) {
		//mcxDialog.alert("로그인 후 참여 가능합니다.");
		mcxDialog.alertC("로그인 후 참여 가능합니다.", { //내용
			sureBtnText: "로그인",  //버튼명
			sureBtnClick: function(){
				location.href="/signin";
			}
		});
		$("#replyText").val('');
		return false;
	}
}



$(document).ready(function(){
	if(plan.planGb == "P"){
		$('#htopTitle').text('기획전');
	}else{
		$('#htopTitle').text('이벤트/혜택');
	}
	ajaxReplyList();

	fnCompleteList();
	if (planCornerList.length>0 && planCornerList != null) {
		$("#filter").text(planCornerList[0].cornerNm);
	}


	//Q3 글자 수 카운트
	$('.doc_contactus').keyup(function (e){
		var content = $(this).val();
		$('#contactus_cnt em').html(content.length);
		if (content.length > 500){
			$(this).val(content.substring(0, 500));
			$('#contactus_cnt em').html("500");
		}
	});

	$(document).on('click','.pop_open_btn',function(){
		$('.modal.photo_comment_popup .pop_detail').toggleClass('active');
	});

	$('.btn_copy').bind('click', function() {
		copyToClipboard();
	});

	//상단 빅배너 슬라이드
	var big_banner_slide = new Swiper('.big_banner_slide .swiper-container', {
		slidesPerView: 1,
		spaceBetween: 0,
		speed: 1000,
		centerMode: true,
		a11y: {
			enabled: true,
			notificationClass: 'swiper-notification',
			prevSlideMessage: '이전 슬라이드',
			nextSlideMessage: '다음 슬라이드',
			firstSlideMessage: '첫번째 슬라이드 입니다',
			lastSlideMessage: '마지막 슬라이드 입니다',
			paginationBulletMessage: '슬라이드 {{index}}로 이동',
		},
		pagination: {
			el: '.big_banner_slide .swiper-pagination',
		},
	});
	//review 슬라이드
	// 210615_ 수정 : 슬라이드 간격, width값, centeredSlides 수정.
	var dp_reviewitem_slide = new Swiper('.review .swiper-container', {
		slidesPerView: 'auto',
		spaceBetween: 15,
		speed: 1000,
		loop: true,
		centeredSlides: true,
		pagination: {
			el: '.review .swiper-pagination',
			type: 'fraction',
		},
	});
	// 아이템스라이드(리스트갯수1)
	var dp_listItems_cont1 = new Swiper('.dp_listItems_cont .swiper-container.item01', {
		slidesPerView: 1,
		spaceBetween: 0,
		speed: 1000,
		a11y: {
			enabled: true,
			notificationClass: 'swiper-notification',
			prevSlideMessage: '이전 슬라이드',
			nextSlideMessage: '다음 슬라이드',
			firstSlideMessage: '첫번째 슬라이드 입니다',
			lastSlideMessage: '마지막 슬라이드 입니다',
			paginationBulletMessage: '슬라이드 {{index}}로 이동',
		},
		centerMode: true,
		pagination: {
			el: '.dp_listItems_cont .swiper-container.item01 .swiper-pagination',
		},
	});

	// 아이템스라이드(리스트갯수2)
	var dp_listItems_slide3 = new Swiper('.dp_listItems_cont .swiper-container.item02', {
		slidesPerView: "auto",
		spaceBetween: 8,
		speed: 1000,
		centerMode: true,
		a11y: {
			enabled: true,
			notificationClass: 'swiper-notification',
			prevSlideMessage: '이전 슬라이드',
			nextSlideMessage: '다음 슬라이드',
			firstSlideMessage: '첫번째 슬라이드 입니다',
			lastSlideMessage: '마지막 슬라이드 입니다',
			paginationBulletMessage: '슬라이드 {{index}}로 이동',
		},
	});

	// 아이템스라이드(리스트갯수3)
	var dp_listItems_slide3 = new Swiper('.dp_listItems_slide .swiper-container.item03', {
		slidesPerView: 3,
		spaceBetween: 8,
		speed: 1000,
		centerMode: true,
		a11y: {
			enabled: true,
			notificationClass: 'swiper-notification',
			prevSlideMessage: '이전 슬라이드',
			nextSlideMessage: '다음 슬라이드',
			firstSlideMessage: '첫번째 슬라이드 입니다',
			lastSlideMessage: '마지막 슬라이드 입니다',
			paginationBulletMessage: '슬라이드 {{index}}로 이동',
		},
	});

	/* SLIDE - 다른 기획전,이벤트 보기 */
	var other_promotion_slide = new Swiper('.other_promotion_slide .swiper-container', {
		slidesPerView: "auto",
		spaceBetween: 8,
		speed: 1000,
		centerMode: true,
		a11y: {
			enabled: true,
			notificationClass: 'swiper-notification',
			prevSlideMessage: '이전 슬라이드',
			nextSlideMessage: '다음 슬라이드',
			firstSlideMessage: '첫번째 슬라이드 입니다',
			lastSlideMessage: '마지막 슬라이드 입니다',
			paginationBulletMessage: '슬라이드 {{index}}로 이동',
		},
	});

	 $(document).on('click','.popup_box .button_list button',function(){
         $('.popup_box .button_list button').removeClass('on');
         $(this).addClass('on');
		});

	//기간 선택 팝업
    $(document).on("click", ".open_categori", function(){
        $('#odDatePop').show().addClass("active");
        $("body").css({"overflow":"hidden"});
    });

    $('#replyText').bind('input paste', function() {
		  $(this).trigger('keyup');
	});


  //팝업_닫기
    $('.popup_close').on("click",function(){
        $('.popup_box').hide().removeClass('active');
        $("body").css({"overflow":"visible"});
    });

    $('#btn1').click(function(){
		var offset = $('.dp_listItems_wrap.type1').offset(); //선택한 태그의 위치를 반환
		//animate()메서드를 이용해서 선택한 태그의 스크롤 위치를 지정해서 0.4초 동안 부드럽게 해당 위치로 이동함
		$('html').animate({scrollTop : offset.top}, 400);
	});

 	// Full size Popup
/* 	$(document).on('click','.cmt_wrap .cmt_cont .pics',function(){
		$("#photo_full_popup").modal("show");
	});
	$(".close-modal").click(function() {
		$("#photo_full_popup").modal("hide");
	}); */

	// 210602_드롭박스 상단고정
	/*var itemTopTxt=$('.dp .dp_listItems_wrap.type1 .dp_subtitle').text();
	var itemTop2Txt=$('.dp .dp_listItems_wrap.type2 .dp_subtitle').text();
	var itemTop3Txt=$('.dp .other_promotion_slide .dp_subtitle').text();
	$(window).scroll(function(){
		var scrollTop= $(window).scrollTop();
		var itemTop=$('.dp .dp_listItems_wrap.type1').offset().top - 61;  // 210720_위치 이동 치수 추가
		var itemTop2=$('.dp .dp_listItems_wrap.type2').offset().top - 61; // 210720_위치 이동 치수 추가
		var itemTop3=$('.dp .other_promotion_slide').offset().top - 61;   // 210720_위치 이동 치수 추가
		$('.dp .dp_listItems_wrap .items_option').css('display', 'block');

		if (scrollTop >= itemTop-120 && scrollTop < itemTop2){
			$('.dp .dp_listItems_wrap .items_option').addClass('fix');
			$('.dp .dp_listItems_wrap .items_option').closest('.inner').css('padding-top', '7rem');
			$('.dp .dp_listItems_wrap .items_option #filter').text(itemTopTxt);
		} else if(scrollTop >= itemTop2 && scrollTop < itemTop3) {
			$('.dp .dp_listItems_wrap .items_option #filter').text(itemTop2Txt);
		}
		// else if(scrollTop >= itemTop3) {
		// 	$('.dp .dp_listItems_wrap .items_option #filter').text(itemTop3Txt);
		// }
		else {
			$('.dp .dp_listItems_wrap .items_option').removeClass('fix');
			$('.dp .dp_listItems_wrap .items_option').closest('.inner').css('padding-top', '0');
			// $('.dp .dp_listItems_wrap .items_option #filter').text('모이몰른');
		}
		if($(window).scrollTop() + $(window).height() == $(document).height()) {
			$('.dp .dp_listItems_wrap .items_option').css('display', 'none');
		}
		//210622_ 추가 : 헤더에 gnb 있을 경우. gnb 노출 제어.
		if($(".typeSelector .items_option").hasClass("fix")){
			$("#gnb").hide();
		}else{
			$("#gnb").show();
		}
	});
	*/
	
	// 210927_드롭박스 상단고정 수정
	$(window).scroll(function(){
		var scrollTop= $(window).scrollTop();
		var itemTop=$('.dp .dp_listItems_wrap.type1').offset().top;

	    if (scrollTop >= itemTop){
	        $('.dp .dp_listItems_wrap .items_option').addClass('fix');
	    } else {
	        $('.dp .dp_listItems_wrap .items_option').removeClass('fix');
	    }
	    
	    // 해당 코너영역 선택 활성화 210812
	    var cornerList = $("#cornerGoodsList > div.inner .dp_subtitle"); 
		$.each(cornerList, function(idx, item){
			var target   = $("#cornerGoodsList > div.inner .dp_subtitle").eq(idx), 
				targetHig = $("#cornerGoodsList > div.inner").eq(idx).outerHeight(),
				targetTop = target.offset().top - 61;

			if (targetTop < scrollTop && scrollTop < (targetTop+targetHig)) {
				if( $("#filter").html() != $(target).text()){
					$("#filter").text($(target).text());
					$(".button_list button").removeClass("on");
					$(".button_list button").eq(idx).addClass("on");
				}
			}
		});
	    
		 //210622_ 추가 : 헤더에 gnb 있을 경우. gnb 노출 제어.
		if($(".typeSelector .items_option").hasClass("fix")){
			$("#gnb").hide();
		}else{
			$("#gnb").show();
		}
	});
	
	//210510_추가 : 토스트 팝업 button 클릭 시 팝업 닫기.
	$(document).on('click','.popup_box.odDatePop .button_list button',function(){
		$(this).parents('.popup_box.odDatePop').hide().removeClass('active');
		$("body").css({"overflow":"visible"});
	})

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

        categoryOpen.on("click",function(){
            categoryPop.show();
            categoryPop.addClass("active");
            $("body").css({"overflow":"hidden"});
        });

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

});
</script>
</th:block>

</body>
</html>