

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*/) {

    var sTextboxValue = oAutoSuggestControl.textbox.value;
    autoSuggestControl = oAutoSuggestControl;
    TownRail.GetCities(sTextboxValue, this.GetCities_callback);


};
CitySuggestions.prototype.GetCities_callback = function(response /*:response object*/) {
    if (response.error != null) {
        alert(response.error);
        return;
    }
    var aSuggestions = string2JsonObj(response.value);
    //provide suggestions to the control
    autoSuggestControl.autosuggest(aSuggestions);
}