
/**
 * Provides suggestions for state names (USA).
 * @class
 * @scope public
 */
function StateSuggestions() {
    this.states = [
		"Same", "Landini", "Allgaier", "Lanz", "Lamborghini", "Deutz" 
    ];
}

/**
 * Request suggestions for the given autosuggest control. 
 * @scope protected
 * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
 */
StateSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
                                                          bTypeAhead /*:boolean*/) {

    var sTextboxValue = oAutoSuggestControl.textbox.value;
	var aSuggestions = [];
	
	if (!sTextboxValue || sTextboxValue == "") {
		oAutoSuggestControl.autosuggest([], bTypeAhead)
		return;
	}
	
	
	
	$.getJSON("/trattori_soci/get_suggestion",
	{ query : sTextboxValue },
        function(data){
              //provide suggestions to the control

    	oAutoSuggestControl.autosuggest(data, bTypeAhead);
     });

};
