var autoSuggestControl;

/**
* Provides suggestions for state names (USA).
* @class
* @scope public
*/
function CitySuggestions() {
}

/**
* Request suggestions for the given autosuggest control. 
* @scope protected
* @param oAutoSuggestControl The autosuggest control to provide suggestions for.
*/
CitySuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/) {

    autoSuggestControl = oAutoSuggestControl;

    var partiallyTypedValue = oAutoSuggestControl.textbox.value;
    var exlusion = oAutoSuggestControl.conjugateTextbox.value;
    oAutoSuggestControl.showLoadingPanel();

    $.ajax({
        url: "/AviaRequest/Cities",
        type: "POST",
        data: {
            partiallyTypedCityName: partiallyTypedValue,
            exclusion: exlusion
        },
        cache: false,
        success: this.GetCities_callback
        // error: OnFlightsRequestCallbackError
    });
};

CitySuggestions.prototype.GetCities_callback = function (response /*:response object*/) {
    if (response && response.error)
        alert(response.error);
    else
        autoSuggestControl.autosuggest(response);
}
