// 인기검색어 function getPopkeyword() { var target = "popword"; var range = "D"; var collection = "_ALL_"; var datatype = "xml"; $.ajax({ type: "POST", url: "/total_search/popword.do", dataType: "xml", data: { "target" : target, "range" : range, "collection" : collection , "datatype" : datatype }, success: function(xml) { var str = "
    "; $(xml).find("Query").each(function(index){ index = index + 1; if(index > 6){ str += "
  1. " +index+". "+ $(this).text() + "
  2. "; }else if(index == 6){ str += "
"; str += "
    "; str += "
  1. " +index+". "+ $(this).text() + "
  2. "; }else{ str += "
  3. " +index+". "+ $(this).text() + "
  4. "; } }); str += "
"; $("#popword").html(str); } }); } // 인기검색어, 내가찾은 검색어 function doKeyword(query,event) { var searchForm = document.search; searchForm.search_query.value = query; event.preventDefault(); doSearch(); } // 쿠키값 조회 function getCookie(c_name) { var i,x,y,cookies=document.cookie.split(";"); for (i=0;i 0 ) { var existsKeyword = false; for( var i = 0; i < myKeywords.length; i++) { if( myKeywords[i] == keyword) { existsKeyword = true; break; } } if( !existsKeyword ) { myKeywords.push(keyword); if( myKeywords.length == MYKEYWORD_COUNT) { myKeywords = myKeywords.slice(1,MYKEYWORD_COUNT); } } setCookie("mykeyword", myKeywords.join("^%"), 365); } showMyKeyword(myKeywords.reverse()); } // 내가 찾은 검색어 삭제 function removeMyKeyword(keyword) { var myKeyword = getCookie("mykeyword"); if( myKeyword == null) { myKeyword = ""; } var myKeywords = myKeyword.split("^%"); var i = 0; while (i < myKeywords.length) { if (myKeywords[i] == keyword) { myKeywords.splice(i, 1); } else { i++; } } setCookie("mykeyword", myKeywords.join("^%"), 365); showMyKeyword(myKeywords); } // 내가 찾은 검색어 function showMyKeyword(myKeywords) { var str = "
  • \"내가
  • "; for( var i = 0; i < myKeywords.length; i++) { if( myKeywords[i] == "") continue; str += "
  • "+myKeywords[i]+"
  • "; } $("#mykeyword").html(str); } // 오타 조회 function getSpell(query) { $.ajax({ type: "POST", url: "./popword/popword.jsp?target=spell&charset=", dataType: "xml", data: {"query" : query}, success: function(xml) { if(parseInt($(xml).find("Return").text()) > 0) { var str = "
    "; $(xml).find("Data").each(function(){ if ($(xml).find("Word").text() != "0" && $(xml).find("Word").text() != query) { str += "이것을 찾으셨나요? " + $(xml).find("Word").text() + ""; } }); str += "
    "; $("#spell").html(str); } } }); return true; } // 기간 설정 function setDate(range) { var startDate = ""; var endDate = ""; var currentDate = new Date(); var year = currentDate.getFullYear(); var month = currentDate.getMonth() +1; var day = currentDate.getDate(); if (parseInt(month) < 10) { month = "0" + month; } if (parseInt(day) < 10) { day = "0" + day; } var toDate = year + "." + month + "." + day; // 기간 버튼 이미지 초기화 for (i = 1;i < 5 ;i++) { $("#range"+i).attr ("src", "images/btn_term" + i + ".gif"); } // 기간 버튼 이미지 선택 if (range == "D") { startDate = getAddDay(currentDate, -0); $("#range2").attr ("src", "images/btn_term22.gif"); } else if (range == "W") { startDate = getAddDay(currentDate, -6); $("#range3").attr ("src", "images/btn_term32.gif"); } else if (range == "M") { startDate = getAddDay(currentDate, -29); $("#range4").attr ("src", "images/btn_term42.gif"); } else { startDate = "1970.01.01"; endDate = toDate; $("#range1").attr ("src", "images/btn_term12.gif"); } if (range != "A" && startDate != "") { year = startDate.getFullYear(); month = startDate.getMonth()+1; day = startDate.getDate(); if (parseInt(month) < 10) { month = "0" + month; } if (parseInt(day) < 10) { day = "0" + day; } startDate = year + "." + month + "." + day; endDate = toDate; } $("#range").val(range); $("#startDate").val(startDate); $("#endDate").val(endDate); } // 날짜 계산 function getAddDay ( targetDate, dayPrefix ) { var newDate = new Date( ); var processTime = targetDate.getTime ( ) + ( parseInt ( dayPrefix ) * 24 * 60 * 60 * 1000 ); newDate.setTime ( processTime ); return newDate; } // 정렬 function doSorting(sort) { var searchForm = document.search; searchForm.search_sort.value = sort; searchForm.search_reQuery.value = "2"; if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} ajaxSearch(); //searchForm.submit(); } // 검색 function doSearch() { var searchForm = document.search; var rex = /^[\x20-\x7e]*$/g; if(searchForm.search_query.value.trim()==""){ // alert("please input a search Keyword."); // searchForm.search_query.focus(); Message.get(function(msg){ alert( msg ); searchForm.search_query.focus(); },589); return; } if(!searchForm.search_query.value.match(rex)){ // alert("Sorry, the keyword you filled in is not in English. \nplease input keyword in English again."); // searchForm.search_query = ""; // searchForm.search_query.focus(); Message.get(function(msg){ alert( msg ); searchForm.search_query = ""; searchForm.search_query.focus(); },590) return; } // [url] 변경 if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} var replQuery = searchForm.search_query.value.replaceAll("%20", "_").replaceAll(" ", "_").replaceAll("\\.", "-").replaceAll("/", "-").replaceAll("\"", "-").replaceAll("%", "-").replaceAll("#", "-").replaceAll("#", "-"); searchForm.action = '/'+((searchForm.search_c_collection.value == 'product')||(searchForm.search_c_collection.value == '')?'products':'')+(searchForm.search_c_collection.value == 'company'?'companies':'')+(searchForm.search_c_collection.value == 'buyer'?'buyers':'')+'/'+(searchForm.search_query.value == ""?'tradekorea':replQuery)+'.html'; //searchForm.certificate.value = setCertificate(); searchForm.search_reQuery.value = "0"; searchForm.search_startDate.value = ""; searchForm.search_endDate.value = ""; searchForm.search_startCount.value = 0; searchForm.search_searchField.value = "ALL"; searchForm.search_sortField.value = "RANK/DESC"; searchForm.submit(); } // 컬렉션별 검색 function doCollection(coll, event) { event.preventDefault(); var searchForm = document.search; searchForm.search_c_collection.value = coll; if(coll != "company"){ searchForm.search_price.value = ""; } if(searchForm.search_c_collection.value == "product"){ $(".certificateList > .company > label > input").attr("checked",false); }else if(searchForm.search_c_collection.value == "company"){ $(".certificateList > .product > label > input").attr("checked",false); }else{ $(".certificateList > li > label > input").attr("checked",false); } searchForm.search_certificate.value=""; searchForm.search_reQuery.value = "2"; searchForm.search_startCount.value = 0; // [url] 변경 var replQuery = searchForm.search_query.value.replaceAll("%20", "_").replaceAll(" ", "_").replaceAll("\\.", "-").replaceAll("/", "-").replaceAll("\"", "-").replaceAll("%", "-").replaceAll("#", "-").replaceAll("#", "-"); searchForm.action = '/'+((searchForm.search_c_collection.value == 'product')||(searchForm.search_c_collection.value == 'product_grade')?'products':'')+(searchForm.search_c_collection.value == 'company'?'companies':'')+(searchForm.search_c_collection.value == 'buyer'?'buyers':'')+'/'+(searchForm.search_query.value == ""?'tradekorea':replQuery)+'.html'; searchForm.submit(); return; } // 추가 : : 컬렉션 선택 function ChoiceCollection(c_coll) { var searchForm = document.search; searchForm.search_c_collection.value = c_coll; return; } // 추가 : : certificate 필터 조건 function setCertificate() { var certificateFilter = ''; var num = 0; var searchForm = document.search; $(".certificateList > li > label > input:checked").each(function(){ if(num > 0){ certificateFilter = certificateFilter+','+$(this).val(); }else{ certificateFilter = $(this).val(); } num++; }); var searchForm = document.search; searchForm.search_certificate.value = certificateFilter; searchForm.search_reQuery.value = "2"; searchForm.search_startCount.value = 0; if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} ajaxSearch(); } // 추가 : 국가 체크박스 처리 function nationCheckbox(){ var num = 0; var nationFilter = ''; $("[name=nation]:checked").each(function(){ if(num > 0){ nationFilter = nationFilter+','+$(this).val(); }else{ nationFilter = $(this).val(); } num++; }); var searchForm = document.search; searchForm.search_nation.value = nationFilter; //searchForm.certificate.value = setCertificate(); searchForm.search_reQuery.value = "2"; searchForm.search_startCount.value = 0; if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} ajaxSearch(); } // 추가 : 국가 목록 전체 보이기 function showNationList(){ $("[name=nation]").each(function(){ $(this).closest("li").css("display","block"); }); } // 추가 : 대륙 체크박스 처리 function continentCheckbox(){ var num = 0; var continentFilter = ''; $("[name=continent]:checked").each(function(){ if(num > 0){ continentFilter = continentFilter+','+$(this).val(); }else{ continentFilter = $(this).val(); } num++; }); var searchForm = document.search; searchForm.search_continent.value = continentFilter; //searchForm.certificate.value = setCertificate(); searchForm.search_reQuery.value = "2"; searchForm.search_startCount.value = 0; if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} ajaxSearch(); } // 추가 : 등급 체크박스 처리 function gradeCheckbox(){ var num = 0; var gradeFilter = ''; $("[name=grade]:checked").each(function(){ if(num > 0){ gradeFilter = gradeFilter +','+$(this).val(); }else{ gradeFilter = $(this).val(); } num++; }); var searchForm = document.search; searchForm.search_grade.value = gradeFilter ; searchForm.search_reQuery.value = "2"; searchForm.search_startCount.value = 0; if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} ajaxSearch(); } // 추가 : 카테고리 목록 검색 function setCategory(event){ event.preventDefault(); var category = ""; if($(event.target).closest("li").attr("data-no1") != 0){ category += $(event.target).closest("li").attr("data-no1") } if($(event.target).closest("li").attr("data-no2") != 0){ category += "^"+$(event.target).closest("li").attr("data-no2") } if($(event.target).closest("li").attr("data-no3") != 0){ category += "^"+$(event.target).closest("li").attr("data-no3") } if($(event.target).closest("li").attr("data-no4") != 0){ category += "^"+$(event.target).closest("li").attr("data-no4") } var searchForm = document.search; searchForm.search_category.value = category; searchForm.search_reQuery.value = "2"; searchForm.search_startCount.value = 0; if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} ajaxSearch(); } // 추가 : 카테고리 검색 (all category) function setAllCategory(event, level){ event.preventDefault(); var category = ""; var tag = "li"; if(level == '2'){ tag="div"; } if($(event.target).closest(tag).attr("data-no1") != 0){ category += $(event.target).closest(tag).attr("data-no1") } if($(event.target).closest(tag).attr("data-no2") != 0){ category += "^"+$(event.target).closest(tag).attr("data-no2") } if($(event.target).closest(tag).attr("data-no3") != 0){ category += "^"+$(event.target).closest(tag).attr("data-no3") } if($(event.target).closest(tag).attr("data-no4") != 0){ category += "^"+$(event.target).closest(tag).attr("data-no4") } var searchForm = document.search; searchForm.search_category.value = category; searchForm.search_reQuery.value = "2"; searchForm.search_startCount.value = 0; searchForm.submit(); } // 추가 : 정렬방식 변경 function changeSort(event){ var sort = $(event.target).val(); var searchForm = document.search; searchForm.search_sortField.value = sort; searchForm.search_reQuery.value = "2"; searchForm.search_startCount.value = 0; if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} ajaxSearch(); } // YEARS 검색 function yearsSearch(){ var years = $("[title=years]").val(); var numPattern = /([^0-9])/; numPattern = years.match(numPattern); if(numPattern != null){ // alert("Please enter a number only."); Message.get(function(msg){ alert( msg ); },591); return } if(years.trim()==""){ // alert("please input \"Years in Business\""); // $("[title=years]").focus(); Message.get(function(msg){ alert( msg ); $("[title=years]").focus(); },592); return; } var searchForm = document.search; searchForm.search_years.value = years; searchForm.search_reQuery.value = "2"; searchForm.search_startCount.value = 0; if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} ajaxSearch(); } // list 타입 변경 function listType(event){ var listType = $(event.target).text(); var searchForm = document.search; searchForm.search_list.value = listType; if(listType == 'L'){ $("#listType").css("display","block"); $("#albumType").css("display","none"); $("#gallery_li").attr("class"," "); $("#list_li").attr("class","current"); event.preventDefault(); return; }else if(listType == 'G'){ $("#listType").css("display","none"); $("#albumType").css("display","block"); $("#list_li").attr("class"," "); $("#gallery_li").attr("class","current"); event.preventDefault(); return; } return; } // 추가 : 하위 카테고리 show function showCategory(event){ var $cur_cate = $(event.target); var cur_depth = $cur_cate.parent('li').data('depth'); var target_depth = cur_depth + 1; var no = $cur_cate.parent('li').data('no'+cur_depth); var $target_lists = $('.category_data_list li[data-depth="'+target_depth+'"][data-no'+cur_depth+'='+no+']'); var text = ''; $cur_cate.parent('li').append(text); } // 추가 : 가격 커스텀 데이터 담기 function setCustomPrice(event){ var high = $("#highprice").val(); var low = $("#lowprice").val(); var numPattern = /([^0-9])/; var highCheck = high.match(numPattern); var lowCheck = low.match(numPattern); if(highCheck != null || lowCheck != null){ // alert("Please enter a number only."); Message.get(function(msg){ alert( msg ); },591); return } if(high.trim()=="" || low.trim()==""){ // alert("please input a Price"); Message.get(function(msg){ alert( msg ); },593); return; } if(parseInt(high.trim()) < parseInt(low.trim())){ var temp = high; high = low; low = temp; } var data = low+"^"+high; var $price = $("#Price11"); $price.attr("data-price",data); event.preventDefault(); var searchForm = document.search; searchForm.search_price.value = data; searchForm.search_startCount.value = 0; searchForm.search_reQuery.value = "2"; if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} ajaxSearch(); } // 추가 : 가격 검색 function setPrice(event){ var price = $(event.target).data("price"); var searchForm = document.search; searchForm.search_price.value = price; searchForm.search_startCount.value = 0; searchForm.search_reQuery.value = "2"; event.preventDefault(); if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} ajaxSearch(); } // 추가 : 숫자 체크 function onlyNumber(obj){ $(obj).keyup(function(){ $(this).val($(this).val().replace(/[^0-9]/g,"")); }); } // 추가 : clear all 버튼 처리 function clearAdvancedSearch(event){ var searchForm = document.search; searchForm.search_certificate.value = ""; searchForm.search_nation.value = ""; searchForm.search_continent.value = ""; searchForm.search_category.value = ""; searchForm.search_grade.value = ""; searchForm.search_years.value = ""; searchForm.search_price.value = ""; searchForm.search_reQuery.value = "2"; event.preventDefault(); ajaxSearch(); } // 추가 : location collection 처리 function location_clearAdvanced(event){ var searchForm = document.search; searchForm.search_certificate.value = ""; searchForm.search_nation.value = ""; searchForm.search_continent.value = ""; searchForm.search_category.value = ""; searchForm.search_grade.value = ""; searchForm.search_years.value = ""; searchForm.search_price.value = ""; searchForm.search_reQuery.value = "2"; event.preventDefault(); searchForm.submit(); } // 엔터 체크 function pressCheck(event) { if (event.keyCode == 13) { if($(event.target).attr("id")=="search_query"){ return doSearch(); }else if($(event.target).attr("id")=="yearSearch"){ return yearsSearch(); }else if($(event.target).attr("id")=="search_within_results"){ return checkReSearch(); }else if($(event.target).attr("id")=="lowprice"||$(event.target).attr("id")=="highprice"){ return setCustomPrice(event); }else{ return; } }else{ return false; } } var temp_query = ""; // 결과내 재검색 function checkReSearch() { var searchForm = document.search; var query = searchForm.search_query.value; var reQuery = searchForm.search_reQuery; var reSearchKeyword = $("#search_within_results").val(); var rex = /^[\x20-\x7e]*$/g; if(reSearchKeyword.trim()==""){ // alert("please input a search Keyword."); // $("#search_within_results").focus(); Message.get(function(msg){ alert( msg ); $("#search_within_results").focus(); },589); return; } if(!reSearchKeyword.match(rex)){ // alert("Sorry, the keyword you filled in is not in English. \nplease input keyword in English again."); // $("#search_within_results").val(""); // $("#search_within_results").focus(); Message.get(function(msg){ alert( msg ); $("#search_within_results").val(""); $("#search_within_results").focus(); },590) return; } searchForm.search_query.value = query+" "+reSearchKeyword; searchForm.search_reQuery.value = "1"; searchForm.search_startDate.value = ""; searchForm.search_endDate.value = ""; searchForm.search_startCount.value = 0; searchForm.search_searchField.value = "ALL"; searchForm.search_sortField.value = "RANK/DESC"; // [url] 변경 if(searchForm.search_c_collection.value == "product_grade"){ searchForm.search_c_collection.value = "product"} var replQuery = searchForm.search_query.value.replaceAll("%20", "_").replaceAll(" ", "_").replaceAll("\\.", "-").replaceAll("/", "-").replaceAll("\"", "-").replaceAll("%", "-").replaceAll("#", "-").replaceAll("#", "-"); searchForm.action = '/'+((searchForm.search_c_collection.value == 'product')||(searchForm.search_c_collection.value == '')?'products':'')+(searchForm.search_c_collection.value == 'company'?'companies':'')+(searchForm.search_c_collection.value == 'buyer'?'buyers':'')+'/'+(searchForm.search_query.value == ""?'tradekorea':replQuery)+'.html'; searchForm.submit(); } // 페이징 function doPaging(count) { var searchForm = document.search; searchForm.search_startCount.value = count; searchForm.search_reQuery.value = "2"; searchForm.submit(); return false; } // 기간 적용 function doRange() { var searchForm = document.search; if($("#search_startDate").val() != "" || $("#search_endDate").val() != "") { if($("#search_startDate").val() == "") { // alert("시작일을 입력하세요."); // $("#search_startDate").focus(); Message.get(function(msg){ alert( msg ); $("#search_startDate").focus(); },594); return; } if($("#search_endDate").val() == "") { // alert("종료일을 입력하세요."); // $("#search_endDate").focus(); Message.get(function(msg){ alert( msg ); $("#search_startDate").focus(); },595); return; } if(!compareStringNum($("#search_startDate").val(), $("#search_endDate").val(), ".")) { // alert("기간이 올바르지 않습니다. 시작일이 종료일보다 작거나 같도록 하세요."); Message.get(function(msg){ alert( msg ); $("#search_startDate").focus(); },596) // $("#search_startDate").focus(); return; } } searchForm.search_startDate.value = $("#search_startDate").val(); searchForm.search_endDate.value = $("#search_endDate").val(); searchForm.search_range.value = $("#search_range").val(); searchForm.search_reQuery.value = "2"; searchForm.submit(); } // 영역 function doSearchField(field) { var searchForm = document.search; searchForm.search_searchField.value = field; searchForm.search_reQuery.value = "2"; searchForm.submit(); } // 문자열 숫자 비교 function compareStringNum(str1, str2, repStr) { var num1 = parseInt(replaceAll(str1, repStr, "")); var num2 = parseInt(replaceAll(str2, repStr, "")); if (num1 > num2) { return false; } else { return true; } } // Replace All function replaceAll(str, orgStr, repStr) { return str.split(orgStr).join(repStr); } // 공백 제거 function trim(str) { return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); } // allCategory 카테고리 메뉴 선택 -> 해당 하위 카테고리 show function categoryMenu(cateno, event){ event.preventDefault(); $(".active").attr("class",""); $(event.target).attr("class","active"); $(event.target).parent("a").attr("class","active"); $(".catelist").hide(); $("#"+cateno).show(); } // 카테고리 하위 리스트 열기 function CateListUp(event, px){ event.preventDefault(); event.stopPropagation(); var $child = $(event.target).parent("a").siblings("ul"); if($child.css("display")=="none"){ $child.slideDown(500); $(event.target).parent("a").attr("class","active"); $(event.target).attr("class",$(event.target).attr("class")+"_active"); }else if($child.css("display")=="block"){ $child.slideUp(500); $(event.target).parent("a").attr("class",""); $(event.target).css("background-position",""); }else{ if($(event.target).parent("a").attr("class")=="active"){ $(event.target).parent("a").attr("class",""); $(event.target).css("background-position",""); }else{ $(event.target).parent("a").attr("class","active"); $(event.target).attr("class",$(event.target).attr("class")+"_active"); } } return false; } // 카테고리 리스트 화면 로드 function drawCateList(category){ if(category != ""){ var cate = category.split("^"); var location = ""; for(i=0;i"+$temp.children("a").eq(1).first().text()+""; }else if(cate.length == i+1){ if(cate.length == 4){ $temp.children("a").eq(0).css("color","#0da8c4"); location += "
  • "+$temp.children("a").eq(0).text()+"
  • "; continue; } $temp.children("a").eq(1).css("color","#0da8c4"); location += "
  • "+$temp.children("a").eq(1).text()+"
  • "; } } if($("#search_realQuery").val()!=""){ location += "
  • "+$("#search_realQuery").val()+"
  • "; } $(".location").append(location); } } // all 카테고리 리스트 화면 로드 function drawAllCateList(cateno){ if(cateno != ""){ var cate = cateno.split("^"); var $cate1Node = $("a[data-cate=\""+cate[0]+"\"]"); $cate1Node.attr("class","active"); $("#"+cate[0]).show(); var scrollPosition = $("#"+cate[1]).offset().top; $("html, body").animate({ scrollTop: scrollPosition }, 1000); } } // 비동기 검색결과 받기[상세검색] function ajaxSearch(){ // 로딩 이미지 생성하고, ajax 호출이 끝나면 로딩 이미지를 숨긴다. $(document).ajaxStart($.blockUI({ message: '' })).ajaxStop($.unblockUI); try{ var url = "/total_search/search_ajax.do"; // 검색 정보 가져오기(비동기통신) $('.container').load( url ,$("#search").serialize() ,function(p_response, p_status, p_xhr){ // 상태가 에러인 경우 if(p_status == 'error') { if(JsUtil.checkAjaxError(p_xhr.status)) { alert(p_xhr.status + 'An error has occurred. Please contact the administrator.'); } } $(".dimmedLayer").hide(); $("body").css("overflow-y","auto"); //$(".categories-lnb").addClass("active"); } ); }catch(e){ alert("[/js/egovframework/tradekorea/www/tatal_search/search.js's ajaxSearch] error : " + e.description); } //console.log($("#search").serializeObject()); //var query = 'd'; var state = $("#search").serializeObject(); var title = ''; var url = '?#search'; history.pushState(state,title,url); } //비동기 검색결과 받기[상세검색] function ajaxReload(state){ $("#search_realQuery").val(state.search_realQuery); $("#search_reQuery").val(state.search_reQuery); $("#search_collection").val(state.search_collection); $("#search_c_collection").val(state.search_c_collection); $("#search_sortField").val(state.search_sortField); $("#search_searchField").val(state.search_searchField); $("#search_startDate").val(state.search_startDate); $("#search_endDate").val(state.search_endDate); $("#search_debug").val(state.search_debug); $("#search_certificate").val(state.search_certificate); $("#search_nation").val(state.search_nation); $("#search_continent").val(state.search_continent); $("#search_category").val(state.search_category); $("#search_grade").val(state.search_grade); $("#search_years").val(state.search_years); $("#search_price").val(state.search_price); $("#search_list").val(state.search_list); $("#search_startCount").val(state.search_startCount); $("#search_viewCount").val(state.search_viewCount); $("#search_query").val(state.search_query); // 로딩 이미지 생성하고, ajax 호출이 끝나면 로딩 이미지를 숨긴다. $(document).ajaxStart($.blockUI({ message: '' })).ajaxStop($.unblockUI); try{ var url = "/total_search/search_ajax.do"; // 검색 정보 가져오기(비동기통신) $('.container').load( url ,$("#search").serialize() ,function(p_response, p_status, p_xhr){ // 상태가 에러인 경우 if(p_status == 'error') { if(JsUtil.checkAjaxError(p_xhr.status)) { alert(p_xhr.status + 'An error has occurred. Please contact the administrator.'); } } $(".dimmedLayer").hide(); $("body").css("overflow-y","auto"); //$(".categories-lnb").addClass("active"); } ); }catch(e){ alert("[/js/egovframework/tradekorea/www/tatal_search/search.js's ajaxSearch] error : " + e.description); } } jQuery.fn.serializeObject = function() { var obj = null; try { if (this[0].tagName && this[0].tagName.toUpperCase() == "FORM") { var arr = this.serializeArray(); if (arr) { obj = {}; jQuery.each(arr, function() { obj[this.name] = this.value; }); }//if ( arr ) { } } catch (e) { alert(e.message); } finally { } return obj; }; /* 검색엔진 카테고리클릭 공통함수선언 */ function n_logging_category(page, ldepthnm, mdepthnm, sdepthnm, ddepthnm) { var _n_logging_image = new Image(); _n_logging_image.src = "/html/wclickareabysearch.html?page=" + page + "&ldepthnm=" + ldepthnm + "&mdepthnm=" + mdepthnm + "&sdepthnm=" + sdepthnm + "&ddepthnm=" + ddepthnm; }