
/**
 * Provides suggestions for state names (USA).
 * @class
 * @scope public
 */
function ProductSuggestions(ArrayNames) {
//   for(var i=0; i<ArrayNames.length; i++)
//   {
//    ArrayNames[i] = ArrayNames[i].replace("&amp;", "&");
//   }
        this.product = ArrayNames;
}

/**
 * Request suggestions for the given autosuggest control. 
 * @scope protected
 * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
  * Converted to Lowercase for matching non-case senstive data by rupika
 */
ProductSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
                                                          bTypeAhead /*:boolean*/) {
                                                          
    var aSuggestions = [];
    var sTextboxValue = oAutoSuggestControl.textbox.value;
    
    //changed for issue mgr #3201 (point 1)
    if (sTextboxValue.length > 1){
    
        //search for matching product
        for (var i=0; i < this.product.length; i++) { 
            if (this.product[i].toLowerCase().indexOf(sTextboxValue.toLowerCase()) == 0) {
                aSuggestions.push(this.product[i]);
            } 
        }
    }

    //provide suggestions to the control
    oAutoSuggestControl.autosuggest(aSuggestions, bTypeAhead);
};
