
/**
 * Provides dropdown list for Product Category.
 * @class
 * @scope public
 */
function ProductCategories(aList, aIDs, aCatIDs) {
	
   /* this.categories = [
        "Steel and Wood", "Structural Concrete", "Gypsum", "Tectum", "Lightweight Concrete",
        "Lightweight Insulating Concrete", "Pressure Plates & Pressure Bars", "Specialty Fasteners" 
    ];*/
    
    /*this.productids = [ "3", "4", "5", "6", "7", "8", "9", "10" ];*/
    //alert(aList);
   // this.categories = aList;
    //this.productids = aIDs;
}

/**
 * Request Categories for the given control. 
 * @scope protected
 * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
 */
ProductCategories.prototype.getDropdown = function (oAutoSuggestControl /*:AutoSuggestControl*/,
                                                          bTypeAhead /*:boolean*/, aList, aIDs, aCatIDs) {
                                                          
   
    var aSuggestions = [];
    var aProductIDs = [];
    var aCategoryIDs = [];
    var sTextboxValue = oAutoSuggestControl.textbox.value;

	this.categories = aList;
	this.productids = aIDs;
	this.categoryids = aCatIDs; 

    //if (sTextboxValue.length > 0){
    
        //search for matching states
        for (var i=0; i < this.categories.length; i++) { 
           // if (this.categories[i].indexOf(sTextboxValue) == 0) {
                aSuggestions.push(this.categories[i]);
           //} 
        }
        
        for (var j=0; j < this.productids.length; j++) { 
           // if (this.categories[i].indexOf(sTextboxValue) == 0) {
                aProductIDs.push(this.productids[j]);
           //} 
        }
        
        for (var j=0; j < this.categoryids.length; j++) { 
           // if (this.categories[i].indexOf(sTextboxValue) == 0) {
                aCategoryIDs.push(this.categoryids[j]);
           //} 
        }
    //}

    //provide product categories to the control
    oAutoSuggestControl.autosuggest(aSuggestions, bTypeAhead, aProductIDs, aCategoryIDs);
};