var assistGoodNames = new Array(); var goodInfoList = new Array(); var goodItemInfoList = new Array(); //품목 try { document.execCommand("BackgroundImageCache", false, true);} catch(err) {} //탑메뉴 function top2menuView(a) { //2차메뉴보기 if(this.id){ eidStr = this.id; eidNum=eidStr.substring(eidStr.lastIndexOf("m",eidStr.length)+1,eidStr.length); a = parseInt(eidNum); } top2menuHideAll(); top1Menu = document.getElementById("top1m"+a); top2Menu = document.getElementById("top2m"+a); $("#top1m"+a).parent().addClass("on"); if(a<100){ann='0'+a;} else {ann=''+a;} if (a=0) { //메인은2차메뉴활성화안함 } else { if (top1Menu) { //top1Menu.getElementsByTagName("img")[0].src=top1Menu.getElementsByTagName("img")[0].src.replace("_off.","_on."); //if (top2Menu) { top2Menu.style.display = 'inline'; } $("#lnb .top2m").show(); $('#lnb, #header_bg').addClass('on'); } } } function top2menuHide(a) { //2차메뉴감추기 if(this.id){ eidStr = this.id; eidNum=eidStr.substring(eidStr.lastIndexOf("m",eidStr.length)+1,eidStr.length); a = parseInt(eidNum); } top2menuHideAll(); top1Menu = document.getElementById("top1m"+a); top2Menu = document.getElementById("top2m"+a); if(a<100){ann='0'+a;} else {ann=''+a;} $("#top1m"+a).parent().removeClass("on"); //$('#header_bg').removeClass(); if (top1Menu) { //top1Menu.getElementsByTagName("img")[0].src=top1Menu.getElementsByTagName("img")[0].src.replace("_on.","_off."); //if (top2Menu) { top2Menu.style.display = 'none'; } $("#lnb .top2m").hide(); $('#lnb, #header_bg').removeClass('on'); } } function top2menuHideAll() { //2차메뉴모두감추기 top1menuEl = document.getElementById("top1menu").childNodes; for (var i=1;i<=top1menuEl.length;i++) { top1Menu = document.getElementById("top1m"+i); top2Menu = document.getElementById("top2m"+i); if(i<100){inn='0'+i;} else {inn=''+i;} if (top1Menu) { //top1Menu.getElementsByTagName("img")[0].src=top1Menu.getElementsByTagName("img")[0].src.replace("_on.","_off."); if (top2Menu) { top2Menu.style.display = 'none'; } $("#lnb .top2m").hide(); $('#lnb, #header_bg').removeClass('on'); $('#top1menu li').removeClass('on'); } } } function initTopMenu(d1,d2,color) { d1n = d1; d2n = d2; colorn = color; d1nn = (d1n<100) ? '0'+d1n : d1n; d2nn = (d2n<100) ? '0'+d2n : d2n; var topMenuSize = $('.topMenuLi').length+1; for (var i=1; i < topMenuSize; i++) { top1Menu = document.getElementById("top1m"+i); top2Menu = document.getElementById("top2m"+i); top1Menu.onmouseover = top1Menu.onfocus = top2menuView; top1Menu.onmouseout = top2menuHide; top2Menu.onmouseover = top2menuView; top2Menu.onmouseout = top2menuHide; } var subMenuSize = $('.topSubm').length; $("#topSubMenu"+subMenuSize).focusout(function() { top2menuHide(); }); //$('.topSubm').on("blur", alert("11")); top2MenuCurr = document.getElementById("top2m"+d1n); if (top2MenuCurr) {// top2MenuCurr.style.display = 'inline'; $("#lnb .top2m").show(); $('#lnb, #header_bg').addClass('on'); } top2MenuCurrAct = document.getElementById("top2m"+d1n+"m"+d2n); if (top2MenuCurrAct) { top2MenuCurrAct.getElementsByTagName("a")[0].style.color=colorn; } if (top2MenuCurrAct) { top2MenuCurrAct.getElementsByTagName("a")[0].style.fontWeight="bold"; } } // 탭메뉴 공통적으로 사용 //ex) tabOn(1,1); function tabOn(tabid,a) { for (var i=1;i<=10;i++) { if(i<10){inn="0"+i;} else {inn=""+i;} tabMenu = document.getElementById("tab"+tabid+"m"+i); tabContent = document.getElementById("tab"+tabid+"c"+i); tabMore = document.getElementById("tab"+tabid+"more"+i); if (tabMenu) { //객체가존재하면 if (tabMenu.tagName=="IMG") { tabMenu.src = tabMenu.src.replace("_on.", "_off."); } //이미지일때 if (tabMenu.tagName=="A") { tabMenu.className=""; } //앵커일때 } if (tabContent) { tabContent.style.display="none"; } if (tabMore) { tabMore.style.display="none"; } } if(a<10){ann="0"+a;} else {ann=""+a;} tabMenu = document.getElementById("tab"+tabid+"m"+a); tabContent = document.getElementById("tab"+tabid+"c"+a); tabMore = document.getElementById("tab"+tabid+"more"+a); // alert(tabMenu.tagName); if (tabMenu) { //객체가존재하면 if (tabMenu.tagName=="IMG") { tabMenu.src = tabMenu.src.replace("_off.", "_on."); } //이미지일때 if (tabMenu.tagName=="A") { tabMenu.className="on"; } //앵커일때 } if (tabContent) { tabContent.style.display="block"; } if (tabMore) { tabMore.style.display="block"; } } function goContent(){ $('#contents').focus(); } function goMainContent(){ $('#contents').focus(); } $(document).ready(function(){ //이미지 롤오버 $(".overimg").mouseover(function (){ var file = $(this).attr('src').split('/'); var filename = file[file.length-1]; var path = ''; for(var i=0 ; i < file.length-1 ; i++){ path = ( i == 0 )?path + file[i]:path + '/' + file[i]; } $(this).attr('src',path+'/'+filename.replace('_off.','_on.')); }).mouseout(function(){ var file = $(this).attr('src').split('/'); var filename = file[file.length-1]; var path = ''; for(var i=0 ; i < file.length-1 ; i++){ path = ( i == 0 )?path + file[i]:path + '/' + file[i]; } $(this).attr('src',path+'/'+filename.replace('_on.','_off.')); }); /* 배너모음 */ var bannerAuto=null; function rightBanner(){ $(".banner_img").stop().animate( {left:"-=151px"},0,function(){ var $bannerObj=$(".banner_img li:first").clone(true); $(".banner_img li:first").remove(); $(".banner_img").css("left",0); $(".banner_img").append($bannerObj); } ); if(bannerAuto)clearTimeout(bannerAuto); bannerAuto=setTimeout(rightBanner,3000); } function leftBanner(){ $(".banner_img").stop().animate( {left:"0px"},0,function(){ var $bannerObj=$(".banner_img li:last").clone(true); $(".banner_img li:last").remove(); $(".banner_img").css("left","0"); $(".banner_img").prepend($bannerObj); } ); if(bannerAuto)clearTimeout(bannerAuto); bannerAuto=setTimeout(rightBanner,3000); } $(document).ready(function(){ bannerAuto=setTimeout(rightBanner,3000); $leftB=$(".banner_control .prev_banner a"); $rightB=$(".banner_control .next_banner a"); $pauseB=$(".banner_control .pause_banner a"); $bannerP_btn=$(".banner_control .pause_banner a img"); var bPlay = false; $leftB.click(function(){ if (bPlay == true){ clearTimeout(bannerAuto); }else{ clearTimeout(bannerAuto); leftBanner(); return false; } }); $rightB.click(function(){ if (bPlay == true){ clearTimeout(bannerAuto); }else{ clearTimeout(bannerAuto); rightBanner(); return false; } }); $pauseB.click(function(){ if (bPlay == false){ clearTimeout(bannerAuto); $bannerP_btn.attr("src","/tprice/images/portal/common/banner_btn_play.gif"); $bannerP_btn.attr("alt","배너재생"); bPlay = true; }else{ bPlay = false; $bannerP_btn.attr("src","/tprice/images/portal/common/banner_btn_stop.gif"); $bannerP_btn.attr("alt","배너일시정지"); bannerAuto=setTimeout(rightBanner,1500); } }); $(".banner_img li a").bind("mouseover focusin", function(){ clearTimeout(bannerAuto); $bannerP_btn.attr("src","/tprice/images/portal/common/banner_btn_play.gif"); $bannerP_btn.attr("alt","배너재생"); }); $(".banner_img li a").bind("mouseleave focusout", function(){ bPlay = false; bannerAuto=setTimeout(rightBanner,1500); $bannerP_btn.attr("src","/tprice/images/portal/common/banner_btn_stop.gif"); $bannerP_btn.attr("alt","배너일시정지"); }); }); // 메인화면 상단 자동완성 검색어 조회 $.ajax({ type:"POST", url:"/tprice/common/code/getAutoCompleteGoodNameList.do", dayaType:"json", success:function(data) { goodNameList = data.autoCompleteGoodNameList; $.each(goodNameList, function(i) { assistGoodNames.push(goodNameList[i].GOOD_NAME); goodInfoList[i] = new Array(); goodInfoList[i] = [goodNameList[i].GOOD_ID ,goodNameList[i].GOOD_NAME ,goodNameList[i].GOOD_SMLCLS_CODE ,goodNameList[i].GOOD_SMLCLS_NAME ,goodNameList[i].GOOD_MIDCLS_CODE ,goodNameList[i].GOOD_MIDCLS_NAME ,goodNameList[i].FILE_RGTN_SEQ ]; }); } ,failure:function(data) { } }); var $search = $('#schWord'); var $list = $('#autocomplete-list'); // 입력 필드에서 검색어를 입력할 때마다 자동완성 목록을 업데이트 $search.on('input', function() { var query = $(this).val().toLowerCase(); $list.empty().hide(); // 목록 비우고 숨기기 // 검색어가 있으면 저장된 데이터에서 자동완성 항목을 필터링 if (query) { var matches = assistGoodNames.filter(function(item) { return item.toLowerCase().includes(query); // 대소문자 구분 없이 필터링 }); if (matches.length > 0) { matches.forEach(function(item) { var $li = $('