
/**
 * Provides suggestions for hotel names of choosen city.
 * @class
 * @scope public
 */
function HotelSuggestions() {
    this.hotelNames = [];
}

/**
 * Request suggestions for the given autosuggest control. 
 * @scope protected
 * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
 */
HotelSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
                                                          bTypeAhead /*:boolean*/) {
    var aSuggestions = [];
    var sTextboxValue = oAutoSuggestControl.textbox.value;
    
    if (sTextboxValue.length > 0){
    
        //search for matching states
        for (var i=0; i < this.hotelNames.length; i++) { 
            lowhotelName=this.hotelNames[i].toLowerCase();
            sTextboxValue=sTextboxValue.toLowerCase();
            if (lowhotelName.indexOf(sTextboxValue) != -1) {
                aSuggestions.push(this.hotelNames[i]);
            } 
        }
    }

    //provide suggestions to the control
    oAutoSuggestControl.autosuggest(aSuggestions, false);
};

/**
* 
* seting current hotelNames of currentCity from Ajax Service
*/
HotelSuggestions.prototype.setcurrentSuggestions= function (hotelNames)
{
	this.hotelNames=hotelNames;
}; 
