function scroll_faq_list(){$(".divFAQWrap .divFAQList .ulFAQ").length&&$(window).scrollTop()+$(window).height()>=$(".divFAQWrap .divFAQList .ulFAQ").scrollTop()+$(".divFAQWrap .divFAQList .ulFAQ").height()&&load_faq_list()}function on_keyup_faq_search(){clearTimeout($.data(this,"faq_search_timer"));var e=setTimeout((function(){g_faq_page=1,g_faq_fully_loaded=!1,load_faq_list()}),400);$(this).data("faq_search_timer",e)}$((function(){if($(".divInquiryTypeWrap > .divInquiryType").length&&$(".divInquiryTypeWrap > .divInquiryType").on("click",click_inquiry_type),$("#buttonInquiry").length&&$("#buttonInquiry").on("click",click_send_inquiry),$(".divFAQWrap > .divTabWrap > .divTab").length&&$(".divFAQWrap > .divTabWrap > .divTab").on("click",click_faq_tab_type),$("#inputFAQSearchKeyword").length&&$("#inputFAQSearchKeyword").on("keyup",on_keyup_faq_search),$(".divFAQWrap .divFAQList .ulFAQ").length&&load_faq_list(),$(".divFAQWrap .divFAQList .ulFAQ").length&&$(window).on("scroll",scroll_faq_list),$(".divInquiryTypeWrap").length){let e="https://www.google.com/recaptcha/api.js";e+="?render="+$("#hiddenReCaptchaSiteKey").val()+"&badge=bottomleft",$.getScript(e,(function(e,i,a){}))}$(".divInquiryForm .divForm #inputTel").on("input",(function(e){var i=$(e.currentTarget),a=i.val();i.val(a.replace(/[^0-9.]/g,"").replace(/(\..*)\./g,"$1"))})),reset_inquiry_form(),$(".divInquiryTypeWrap > .divInquiryType").length&&$(".divInquiryTypeWrap > .divInquiryType[type=QUOTATION]").click()}));var g_faq_page=1,g_faq_fully_loaded=!1,g_faq_loading=!1;function load_faq_list(){if(!g_faq_loading&&!g_faq_fully_loaded){g_faq_loading=!0;var e="";$(".divFAQWrap > .divTabWrap > .divTab.selected").length&&(e=$(".divFAQWrap > .divTabWrap > .divTab.selected").attr("type"));var i="";$("#inputFAQSearchKeyword").length&&(i=$("#inputFAQSearchKeyword").val()),show_loading(),$.post("/webapi/cs",{mode:"faq_get",faq_type:e,faq_title:i,page:g_faq_page},(function(e){hide_loading();var i=$(".divFAQWrap .divFAQList .ulFAQ"),a=[],t=0;$.each(e,(function(e,i){var r=i.faq_type,n=(i.faq_id,i.faq_title),d=i.faq_body,l=i.brand_en_name,s=i.brand_ko_name,p="";"INFO"==r?p="정보":"HOWTO"==r?p="기술":"ORDER"==r?p="주문/배송":"ETC"==r&&(p="기타");var o="";o+="<li>",o+='<div class="divHeader">',o+='<h1><span class="spanType">'+html_encode(p)+"</span><span>"+html_encode(n)+"<span></h1>",o+="<h2><span>"+html_encode(l)+'</span><span class="spanKo">'+html_encode(s)+"</span></h2>",o+="</div>",o+='<div class="divBody toastui-editor-contents">'+d+"</div>",o+="</li>",a[t]=o,t++})),g_faq_page<=1&&i.empty(),i.append(a.join("")).ready((function(){$(".ulFAQ > li > .divHeader").off("click").on("click",click_faq_header)})),t<=0&&($(".divFAQWrap .divFAQList .ulFAQ > li").length||i.empty().append('<li class="liNoData">데이터가 없습니다.</li>'),g_faq_fully_loaded=!0,console.log("Fully loaded")),g_faq_page++,g_faq_loading=!1}),"json")}}function click_faq_tab_type(e){$(".divFAQWrap > .divTabWrap > .divTab").removeClass("selected"),$(e.currentTarget).addClass("selected"),$("#inputFAQSearchKeyword").length&&$("#inputFAQSearchKeyword").val(""),g_faq_page=1,g_faq_fully_loaded=!1,load_faq_list()}function click_inquiry_type(e){var i="";$(".divInquiryTypeWrap > .divInquiryType.selected").length&&(i=$(".divInquiryTypeWrap > .divInquiryType.selected").attr("type")),$(".divInquiryTypeWrap > .divInquiryType").removeClass("selected");var a=$(e.currentTarget);a.addClass("selected");var t=a.attr("type");["PRODUCT","QUOTATION","DATA","AS"].includes(t)?($("#spanProduct").show(),$("#spanBrand").show(),$("#spanAddress1").show(),$("#spanAddress2").show()):($("#spanProduct").hide(),$("#spanBrand").hide(),$("#spanAddress1").hide(),$("#spanAddress2").hide());var r=a.attr("desc");$("#divInquiryHeader > h3").text(r),i!=t&&reset_inquiry_form(),$(".divInquiryWrap .divInquiryForm").hide().fadeIn(400)}function init_inquiry_address(){$("#selectAddressDepth1").empty();for(var e=0;e<g_area_list.length;e++){var i='<option value="'+g_area_list[e].id+'">'+html_encode(g_area_list[e].area_name)+"</option>";$("#selectAddressDepth1").append(i)}$("#selectAddressDepth1").select2("destroy"),$("#selectAddressDepth1").off().on("change",change_inquiry_address_depth1),$("#selectAddressDepth1").createSelect2(),$("#selectAddressDepth2").empty(),$("#selectAddressDepth2").append('<option value="">전체</option>'),$("#selectAddressDepth2").select2("destroy"),$("#selectAddressDepth2").createSelect2()}function change_inquiry_address_depth1(){var e=$("#selectAddressDepth1").select2("data");if(e.length>0){var i=e[0].id;$("#selectAddressDepth2").empty();for(var a=0,t=0;t<g_area_list.length;t++)if(g_area_list[t].id==i)for(var r=0;r<g_area_list[t].area_list.length;r++){var n='<option value="'+g_area_list[t].area_list[r].id+'">'+html_encode(g_area_list[t].area_list[r].area_name)+"</option>";$("#selectAddressDepth2").append(n),a++}0==a&&$("#selectAddressDepth2").append('<option value="">전체</option>')}}function reset_inquiry_form(){$(".divInquiryForm .divForm").length&&($(".divInquiryForm .divForm input[type=text]").val(""),$(".divInquiryForm .divForm textarea").val(""),$(".divInquiryForm .divForm input[type=checkbox]").prop("checked",!1),$("#selectBrand").val("0").trigger("change"),init_inquiry_address())}function click_send_inquiry(e){e.preventDefault(),send_inquiry()}function send_inquiry(){var e=$("#inputCompany").val(),i=$("#inputPerson").val(),a=$("#inputTel").val(),t=$("#inputEmail").val(),r=$("#inputProduct").val(),n=$("#inputTitle").val(),d=$("#textareaBody").val(),l=0,s="",p=$("#selectBrand").select2("data");p.length>=0&&(l=p[0].id,s=p[0].text);var o="",c="",_=$("#selectAddressDepth1").select2("data");_.length>=0&&(o=_[0].id,c=_[0].text);var u="",y="",v=$("#selectAddressDepth2").select2("data");v.length>=0&&(u=v[0].id,y=v[0].text);var h="";if(""!=c&&""!=y&&(h=c+" "+y),$(".divInquiryTypeWrap > .divInquiryType.selected").length){var q=$(".divInquiryTypeWrap > .divInquiryType.selected").attr("type");if(""!=$.trim(e))if(""!=$.trim(i))if(""!=$.trim(a))if(""!=$.trim(t))if(validate_email(t)){if($("#spanProduct").is(":visible")){if(""==$.trim(o))return void alert("시/도 주소를 선택해주세요.");if(""==$.trim(u))return void alert("정확한 상담을 위해 시/구/군 주소를 선택해주세요.");if(parseInt(l)<=0)return void alert("브랜드를 선택해주세요.");if(""==$.trim(r))return void alert("제품을 입력해주세요.")}""!=$.trim(n)?""!=$.trim(d)?$("#checkboxPrivacy").prop("checked")?confirm("해당 내용을 전송하시겠습니까?")&&grecaptcha.ready((function(){let p=$("#hiddenReCaptchaSiteKey").val();grecaptcha.execute(p,{action:"submit"}).then((function(p){""!=$.trim(p)?($("#buttonInquiry").prop("disabled",!0),$.post("/webapi/cs",{mode:"inquiry_send",token:p,inquiry_type:q,inquiry_company:e,inquiry_person:i,inquiry_tel:a,inquiry_email:t,inquiry_product:r,inquiry_title:n,inquiry_body:d,inquiry_brand_id:l,inquiry_brand_name:s,inquiry_address:h}).done((function(e){$("#buttonInquiry").prop("disabled",!1),"OK"==e?(alert("전송되었습니다. 빠른 시일 내에 답변드리겠습니다."),$(location).attr("href","/cs/inquiry")):"ERR_NO_PARAM"==e?alert("필수 데이터가 누락되었습니다."):alert("에러가 발생했습니다.")}))):alert("토큰이 잘못되었습니다.")}))})):alert("개인정보 수집 및 이용약관에 동의해주세요."):alert("내용을 입력해주세요."):alert("제목을 입력해주세요.")}else alert("정확한 이메일을 입력해주세요.");else alert("이메일을 입력해주세요.");else alert("연락처를 입력해주세요.");else alert("이름을 입력해주세요.");else alert("소속 기업/단체명과 부서를 입력해주세요.")}else alert("문의 유형이 선택되지 않았습니다.")}