var assistGoodName = new Array();
$(window).load(function(){
// 타이틀 변경
$(document).attr("title",'한국소비자원 참가격 상품정보');
// 상품 대분류코드
fn_getCodeStatI("selectD","1","",$("#dflag").val());
// 상품 중분류코드
if($("#dflag").val() != ""){
fn_getCodeStatI("selectJ","2",$("#dflag").val(),$("#jflag").val());
}
// 상품 소분류코드
if($("#jflag").val() != ""){
fn_getCodeStatI("selectS","3",$("#jflag").val(),$("#sflag").val());
}
$.ajax({
type:"POST",
url:"/tprice/portal/saleinfo/saleinfo/getAssistWords2.do",
dayaType:"json",
success:function(data) {
goodName = data.goodNames;
$.each(goodName, function(key) {
assistGoodName.push(goodName[key].goodName);
});
}, failure:function(data) {
}
});
});
$(document).ready(function(){
$("#searchCondition3").change(function(){
var searflag = $("#searchCondition3 option:selected").val();
$("#searflag").val(searflag);
});
// 검색버튼
$("#search_btn").click(function(){
// 페이지 번호 초기화
$("[name=pageNo]").val("1");
var sflag = $("#selectS option:selected").val();
$("#sflag").val(sflag);
var jflag = $("#selectJ option:selected").val();
$("#jflag").val(jflag);
var dflag = $("#selectD option:selected").val();
$("#dflag").val(dflag);
$("#listForm")
.attr("action", "/tprice/portal/pricenewsandtpriceintro/iteminfo/getItemList.do")
.submit();
});
// 중분류값
$("#selectD").change(function(){
$('#selectJ, #selectS, #selectP').find("option").each(function(){
$(this).remove();
});
$('#selectJ').append("");
$('#selectS').append("");
$('#selectP').append("");
var highCode = $(this).val();
if(highCode != '0'){
fn_getCodeStatI("selectJ","2",highCode,"");
}
});
// 소분류값
$("#selectJ").change(function(){
$('#selectS, #selectP').find("option").each(function(){
$(this).remove();
});
$('#selectS').append("");
$('#selectP').append("");
var highCode = $(this).val();
if(highCode != '0'){
fn_getCodeStatI("selectS","3",highCode,"");
}
});
$("#searchKeyword").autocomplete({
source: assistGoodName,
minLength:0
});
$("#searchKeyword").dblclick(function(){
$("#searchKeyword").autocomplete("search","");
});
});
/* pagination 페이지 링크 function */
function fn_gotoPage(page){
var url = "/tprice/portal/pricenewsandtpriceintro/iteminfo/getItemList.do";
$("#sendFields").html(makeField("useflag", $("#useflag").val()));
$("#sendFields").append(makeField("searflag", $("#searflag").val()));
$("#sendFields").append(makeField("dflag", $("#dflag").val()));
$("#sendFields").append(makeField("jflag", $("#jflag").val()));
$("#sendFields").append(makeField("sflag", $("#sflag").val()));
$("#sendFields").append(makeField("searchKeyword", $("#searchKeyword").val()));
gotoPageSend(page, url);
}