// 価格検索
function changePrice(selctprice, categoryID)
{
	//価格検索
	var priceValue=selctprice.options[selctprice.selectedIndex].value;
	PriceSearchCtrl.GetCategoryList_ByKeyword(priceValue, "", categoryID, changeDDL_CallBack);
}

// カテゴリ検索
function changeCategory(selctcategory, priceID)
{
	//カテゴリ検索
	var categoryValue=selctcategory.options[selctcategory.selectedIndex].value;
	PriceSearchCtrl.GetPriceList(categoryValue, "", priceID, changeDDL_CallBack);
}

// キーワード+ 価格検索
function changePriceAndKeyword(selctprice, category, keyword)
{
	//価格検索
	var priceValue=selctprice.options[selctprice.selectedIndex].value;
	SearchResultCtrl.GetCategoryList_ByKeyword(priceValue, '', category, changeDDL_CallBack);
}

// キーワード+ カテゴリ検索
function changeCategoryAndKeyword(selctcategory, price, keyword)
{
	//カテゴリ検索
	var categoryValue=selctcategory.options[selctcategory.selectedIndex].value;
	SearchResultCtrl.GetPriceList(categoryValue, '', price, changeDDL_CallBack);
}

function changeDDL_CallBack(response)
{
	var obj;    // return param
	var selectedval;
	var selectedindex;
	
	if (response != null && response != ''){
		obj = eval("(" + response.value+ ")");
    var i;
    var index = 0;
    if(!obj.dpid){return;}
    if(obj.selectIndex){index=obj.selectIndex;}
    var ddobj = document.getElementById(obj.dpid);
    selectedval = ddobj[ddobj.selectedIndex].value;
    
    if(!ddobj || obj.items.length <= 0){return;}
    ddobj.options.length = 0;

    for(i = 0; i < obj.items.length; i++){
      ddobj.options[i] = new Option(obj.items[i].name, obj.items[i].value);
      if (selectedval == obj.items[i].value){
        selectedindex = i;
      }
    }
    
    try{
      ddobj.selectedIndex = selectedindex;
    } catch (e){
      ddobj.selectedIndex = selectIndex;
    }
	}  
}