function BasicSuggestions(rUrl) {
	this.urlI=rUrl;
    this.typeAhead=null;
    this.suggestcontrol=null;
    this.sTextboxValue=null;
};

BasicSuggestions.prototype.setSuggestions = function (req)
{
	
	var xml = req.responseXML;
	this.aSuggestions1Input = [];
	if(xml.getElementsByTagName('results').length>0){
		var results = xml.getElementsByTagName('results')[0].childNodes;
		for (var i=0;i<results.length;i++)
		{
			if (results[i].hasChildNodes()){
				this.aSuggestions1Input.push( results[i].childNodes[0].nodeValue);
			}
		}


	    var aSuggestions = [];
	    if (this.sTextboxValue.length > 0){
	    	
	        var sTextboxValueLC = this.sTextboxValue.toLowerCase();
	        for (var i=0; i < this.aSuggestions1Input.length; i++) {
	            var sLC = this.aSuggestions1Input[i].toLowerCase();
	            if (sLC.indexOf(sTextboxValueLC) == 0) {
	                aSuggestions.push(this.sTextboxValue + this.aSuggestions1Input[i].substring(this.sTextboxValue.length));
	            }
	        }
	    }
		
		this.suggestcontrol.autosuggest(aSuggestions, false);
	}
}

BasicSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/, bTypeAhead /*:boolean*/) {

	
    this.sTextboxValue = oAutoSuggestControl.textbox.value;
    this.suggestcontrol=oAutoSuggestControl;
    this.typeAhead=bTypeAhead;
	var pointer = this;
	// create ajax request
	var url = this.urlI+encodeURIComponent(this.sTextboxValue);
	var onSuccessFunc = function (req) { pointer.setSuggestions(req) };
	var onErrorFunc = function (status) { alert("AJAX error: "+status); };
	var myAjax = new _bsn.Ajax;
	myAjax.makeRequest( url, "get", onSuccessFunc, onErrorFunc );
};
