/**
 * 
 * @class
 * @scope public
 */
function ArtistSuggestions() {
	//this.SugestArray=new Array();

}

/**
 * Request suggestions for the given autosuggest control. 
 * @scope protected
 * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
 */
ArtistSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
                                                          bTypeAhead /*:boolean*/) {
    var aSuggestions = [];
	var aSuggestionsID = [];
    var sTextboxValue = oAutoSuggestControl.textbox.value;

    
    if (sTextboxValue.length >= 3){
    

				var url = "/search.php?queryString="+sTextboxValue;
				if(oAutoSuggestControl.textbox.name=='search_artist'){
				   if(document.getElementById('sArtistID')){
					 url +="&ai="+document.getElementById('sArtistID').value;
					}
				   url +="&artist=1";
				}
				var http;
				if (window.XMLHttpRequest) { // Mozilla, Safari, ...
							http= new XMLHttpRequest();
						} else if (window.ActiveXObject) { // IE
							http = new ActiveXObject("Microsoft.XMLHTTP");
						}
				http.open("GET", url, true);

				//Send the proper header information along with the request
				http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				http.setRequestHeader("Connection", "close");
				http.onreadystatechange = function() {//Call a function when the state changes.
					
					if(http.readyState == 4 && http.status == 200) {
						eval(http.responseText);
					if(result){
						this.SugestArray= result;
						this.SugestArrayID=resultid;
						for (var i=0; i < this.SugestArray.length; i++) { 
								//alert(this.SugestArray[i]);
								aSuggestions.push(this.SugestArray[i]);
								aSuggestionsID.push(this.SugestArrayID[i]);
						  }//for
						 oAutoSuggestControl.autosuggest(aSuggestions, aSuggestionsID,bTypeAhead);
						}
					}
				}
				http.send(null);



       
    
    }

   //provide suggestions to the control

};