Autocompleter.DWR = Class.create();
Object.extend(Object.extend(Autocompleter.DWR.prototype, Autocompleter.Base.prototype), {
  initialize: function(element, update, callFunc, options) {
    this.baseInitialize(element, update, options);
    this.options.defaultParams = this.options.parameters || null;
    this.callFunc = callFunc;
  },
  callbackBuilder: function(context)
  {
  	return function(fromServer) 
    {
        if(fromServer.length==0)
        {
            //alert("Error in name or id!\nThe value you put for name or id is not in the database.");
            //app.showMessage();
        }
        else
        {
            context.updateChoices(context.selector(fromServer));
        }
    };
  },
  getUpdatedChoices: function() {
    this.callFunc(this.callbackBuilder(this),this.getToken());
  },
  selector: function(array)
  { var ret = [];
  	for(var i=0; i<array.length; i++)
  	{ var elem = array[i];
  	  ret.push("<li>" + elem + "</li>");
  	}
  	return "<ul>" + ret.join('') + "</ul>";
  }
});