/**
 * Provides suggestions for state names (USA).
 * @class
 * @scope public
 */
function RecipeSuggestions() {
   this.suggestionList = [];
}

RecipeSuggestions.prototype.getSuggestions = function (textboxValue)
{
	this.suggestionList = ajaxGetSuggestions(textboxValue);
}

/**
 * Request suggestions for the given autosuggest control. 
 * @scope protected
 * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
 */
RecipeSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
                                                          bTypeAhead /*:boolean*/) {
    var aSuggestions = [];
    var sTextboxValue = oAutoSuggestControl.textbox.value;
    
    if (sTextboxValue.length > 0)
	{
    	//search for matching strings
        this.getSuggestions(sTextboxValue);
		for(var i=0;i<this.suggestionList.length;i++)
		{
			aSuggestions.push(this.suggestionList[i]);
		}
    }

    //provide suggestions to the control
    oAutoSuggestControl.autosuggest(aSuggestions, false);
};
