﻿
$(document).ready(function() {

    $("#ctl00_ContentMain_B2C_Index_HotelSearch1_B2C_HotelCity1_tCity").AutoCom
      (
        "/Ajax/HotelAutoCity.aspx",
        {
            delay: 10,
            minChars: 1,
            matchSubset: 1,
            matchContains: 1,
            cacheLength: 10,
            matchContains: true,
            scrollHeight: 100,
            width: 200,
            onItemSelect: sbbItem,
            onFindValue: fbbValue,
            fItem: formantItemcc,
            autoFill: false
        });

});
function fbbValue(li) {

   
    $("#ctl00_ContentMain_B2C_Index_HotelSearch1_B2C_HotelCity1_CityValue").val("");
    $("#ctl00_ContentMain_B2C_Index_HotelSearch1_B2C_HotelCity1_tCity").html("");
    if (li == null) {
        return ""; //$("#<%=city.ClientID %>").html("未匹配值!");
    }
    if (!!li.extra) {
       
        var sText = li.extra[0];

        var sValue = li.extra[1];
       
       
        //文本域的值
        //alert("1:"+sValue);
        //$("#hidCityValue").val(sValue)
        document.getElementById("ctl00_ContentMain_B2C_Index_HotelSearch1_B2C_HotelCity1_Text").value = sText;
        document.getElementById("ctl00_ContentMain_B2C_Index_HotelSearch1_B2C_HotelCity1_CityValue").value = sValue;
    }
    else {
        var sValue = li.selectValue;

        // document.getElementById("ctl00_ContentMain_CityControl1_hidCityValue").value=sValue;
    }
}
function sbbItem(li) {

    fbbValue(li);
}
function formantItemcc(row) {
    return row[0] + "&nbsp;&nbsp;&nbsp;" + row[1];
}
function lookupAjax() {
    var oSuggest = $("#ctl00_ContentMain_B2C_Index_HotelSearch1_B2C_HotelCity1_tCity")[0].autocompleter;

    oSuggest.findValue();

    return false;
}
function lookupLocal() {
    var oSuggest = $("#ctl00_ContentMain_B2C_Index_HotelSearch1_B2C_HotelCity1_tCity")[0].autocompleter;

    oSuggest.findValue();

    return false;

}

