﻿
$(document).ready(function() {
    $("#ctl00_ContentMain_B2C_Index_AirSearch1_B2C_AirCity11_tCity").AutoCom
      (
        "/Ajax/AirAutoCity.aspx",
        {
            delay: 10,
            minChars: 1,
            matchSubset: 1,
            matchContains: 1,
            cacheLength: 10,
            matchContains: true,
            scrollHeight: 100,
            width: 200,
            onItemSelect: sItem,
            onFindValue: fValue,
            fItem: formantItem,
            autoFill: false
        });

});
function fValue(li) {

    $("#ctl00_ContentMain_B2C_Index_AirSearch1_B2C_AirCity11_CityValue").val("");
    $("#ctl00_ContentMain_B2C_Index_AirSearch1_B2C_AirCity11_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_AirSearch1_B2C_AirCity11_Text").value = sText;
        document.getElementById("ctl00_ContentMain_B2C_Index_AirSearch1_B2C_AirCity11_CityValue").value = sValue;
    }
    else {
        var sValue = li.selectValue;

        // document.getElementById("ctl00_ContentMain_CityControl1_hidCityValue").value=sValue;
    }
}
function sItem(li) {
    fValue(li);
}
function formantItem(row) {
    return row[0] + "&nbsp;&nbsp;&nbsp;" + row[1];
}
function lookupAjax() {
    var oSuggest = $("#ctl00_ContentMain_B2C_Index_AirSearch1_B2C_AirCity11_tCity")[0].autocompleter;

    oSuggest.findValue();

    return false;
}
function lookupLocal() {
    var oSuggest = $("#ctl00_ContentMain_B2C_Index_AirSearch1_B2C_AirCity11_tCity")[0].autocompleter;

    oSuggest.findValue();

    return false;

}

