function CAutoComplete(obj,ajaxDatei,arDaten,rows,visibleWhenEmpty,stringSection,BoxClass,RowClass,activeRowClass,TextClass,NoTextClass)
{	
	this.Input = false;
	this.InputValue = false;
	this.arResponse = new Array;
	this.activeRow = -1;
	this.AutoCompleteBox = false;
	this.AutoCompleteRows = new Array;		
	this.AutoCompleteRowsNoText = new Array;
	this.AutoCompleteRowsText = new Array;
	this.ajaxDatei = false;
	this.arDaten = false;
	this.rows = false;
	this.rowsFilled = 0;
	this.BoxClass = false;
	this.RowClass = false;		
	this.activeRowClass = false;
	this.TextClass = false;
	this.NoTextClass = false;		
	this.ajax = false;
	this.makeVisible = false;
	this.visibleWhenEmpty = false;		
	this.stringSection = false;
	
	//--- Configuration
	this.noAutoWidth = false;
	
	this.__construct = function(obj,ajaxDatei,arDaten,rows,visibleWhenEmpty,stringSection)
	{
		this.Input = new CElement(obj);
		if(!this.Input)
		{
			return false;
		}
		this.Input = new CElement(obj);		
		if(!this.Input.obj)
		{
			return false;
		}
		this.Input.addEvent("keyup",this.keypressAutoComplete.scope(this));
//			this.Input.addEvent("focus",this.RemarkAutoComplete.scope(this));
		this.Input.addEvent("blur",this.hiddenAutoComplete.scope(this));		
		this.Input.obj.setAttribute("autocomplete", "off");				
		if(!ajaxDatei && !arDaten)
		{
			return false;
		}						
		this.ajaxDatei			= (ajaxDatei) 			? ajaxDatei 			: false;
		this.rows				= (rows) 				? rows 					: 10;		
		this.arDaten			= (arDaten)				? arDaten 				: false;
		this.visibleWhenEmpty	= (visibleWhenEmpty) 	? visibleWhenEmpty 		: false;
		this.stringSection		= (stringSection) 		? stringSection 		: false;
		this.setCss();
		this.createAutoCompleteBox();		
	}

	//--- Css Classen für Autocomplete Box und Zeilen laden
	this.setCss = function(BoxClass,RowClass,activeRowClass,TextClass,NoTextClass)
	{		
		this.BoxClass			= (BoxClass) 			? BoxClass 				: "autocomplete_box";
		this.RowClass			= (RowClass) 			? RowClass 				: "autocomplete_row";
		this.activeRowClass		= (activeRowClass) 		? activeRowClass 		: "autocomplete_activerow";
		this.TextClass			= (TextClass) 			? TextClass 			: "autocomplete_text";
		this.NoTextClass		= (NoTextClass) 		? NoTextClass 			: "autocomplete_notext";
	}
		
	//--- einige Configurations Sachen setzen
	this.setConfig = function(noAutoWidth)
	{
		this.noAutoWidth = (noAutoWidth) ? true : false;
	}
		
	this.createAutoCompleteBox = function()
	{
		
		if(!this.AutoCompleteBox)
		{
			this.AutoCompleteBox = new CElement(false,"table");
			this.AutoCompleteBox.appendNode(document.body);
			this.AutoCompleteBox.setStyle("position","absolute");
			this.AutoCompleteBox.obj.setAttribute("cellpadding", "2");		
			this.AutoCompleteBox.obj.setAttribute("cellspacing", "0");
			this.AutoCompleteBox.setClass(this.BoxClass);
			this.hiddenAutoComplete();			
			for(i = 0 ; i < this.rows; i++)
			{										
				this.AutoCompleteRows[i] = this.AutoCompleteBox.obj.insertRow(i);
				this.AutoCompleteRows[i] = new CElement(this.AutoCompleteRows[i]);
				this.AutoCompleteRows[i].addEvent("mousemove",this.activeAutoCompleteRow.scope(this,i));
				this.AutoCompleteRows[i].addEvent("mousedown",this.AutoComplete.scope(this,i));
				this.AutoCompleteRows[i].setStyle("clear","both");
				this.AutoCompleteRows[i].setStyle("cursor","pointer");
				this.AutoCompleteRows[i].setClass(this.RowClass);
				this.AutoCompleteRowsText[i] = this.AutoCompleteRows[i].obj.insertCell(0);
				this.AutoCompleteRowsText[i] = new CElement(this.AutoCompleteRowsText[i]);
				this.AutoCompleteRowsText[i].appendTextNode("");				
				this.AutoCompleteRowsText[i].setStyle("paddingRight","5");
				this.AutoCompleteRowsText[i].setStyle("whiteSpace","nowrap");
				this.AutoCompleteRowsText[i].setClass(this.TextClass);
				this.AutoCompleteRowsNoText[i] = this.AutoCompleteRows[i].obj.insertCell(1);
				this.AutoCompleteRowsNoText[i] = new CElement(this.AutoCompleteRowsNoText[i]);
				this.AutoCompleteRowsNoText[i].appendTextNode("");
				this.AutoCompleteRowsNoText[i].setStyle("whiteSpace","nowrap");
				this.AutoCompleteRowsNoText[i].setClass(this.NoTextClass);
			}			
			if(!this.arDaten)
			{				
				this.ajax = new hssJX();					
			}
		}			
	}	
			
	this.keypressAutoComplete = function(e)
	{
		if(parseFloat(e.keyCode) == 37)  //--- Arrow Key LINKS
		{							
			return true;
		}
		if(parseFloat(e.keyCode) == 38)  //--- Arrow Key OBEN
		{
			var arArray = new Array;
			arArray[0] = false;
			arArray[1] = this.activeRow-1;
			arArray[2] = true;
			this.activeAutoCompleteRow(false,arArray);
			return true;
		}
		if(parseFloat(e.keyCode) == 39)  //--- Arrow Key RECHTS
		{
			return true;
		}
		if(parseFloat(e.keyCode) == 40)  //--- Arrow Key UNTEN
		{
			var arArray = new Array;
			arArray[0] = false;
			arArray[1] = this.activeRow+1;
			arArray[2] = true;
			this.activeAutoCompleteRow(false,arArray);
			return true;			
		}
					
		this.RemarkAutoComplete();
		ar = new Object;				
		ar['limit'] = this.rows;
		ar['string'] = this.InputValue;
		if(this.visibleWhenEmpty || trim(ar['string']))
		{							
			//--- Wenn Array vorhanden, soll Ajax aufgebaut werden
			if(this.ajax)
			{		
				ar['string'] += "%";				
				if(this.stringSection)
				{
					ar['string'] = "%"+ar['string'];	
				}
				ar['string'] = escape(ar['string']);
				ar['cube'] = this.ajaxDatei;
				this.ajax.Exec("../start/jx_ajax.php", false, ar, "GET", this._AjaxResponse.scope(this));					
			}else{			
			//--- Wenn JS Array vorhanden
				this.arResponse = new Array;
				this.InputValue = this.InputValue.replace('/','\/');
				if(this.stringSection)
				{				
					var reg = eval("/"+this.InputValue+"/i");
				}else{
					var reg = eval("/^"+this.InputValue+"/i");
				}
				for(var wert in this.arDaten)
				{						
					if(!reg || (reg && reg.test(wert)))
					{						
						this.arResponse.push(wert);
						this.arResponse.push(this.arDaten[wert]);
					}
				}					
				this._fillAutoComplete();
			}
		}else{
			this.makeVisible = false;
			this.hiddenAutoComplete();
		}
	}

	//--- JSON mit Daten in die autoCompleter Box schreiben
	this._AjaxResponse = function()
	{		
		if (this.ajax.IsReady() ) 
		{			
			var arResponse = this.ajax.GetResponseText();			
			arResponse = arResponse.split("|");
			this._fillAutoComplete(arResponse);
		}
	}

	//--- Array Daten in die autoCompleter Box schreiben
	this._fillAutoComplete = function(arResponse)
	{					
		if(arResponse)
		{
			this.arResponse = arResponse;
		}
		if(this.arResponse.length == 0 || arResponse[0].length == 0)
		{						
			this.hiddenAutoComplete();
			return false;
		}
		var text = false;
		for(i = 0 ; i < this.rows; i++)
		{					
			if(this.arResponse[i*2])			
			{					
				text = trim(this.arResponse[i*2]);
				if(this.InputValue)
				{
					if(this.stringSection)
					{		
							text = markWord(text,this.InputValue,"color: red;");
					}else{
							text = "<span style='color: red;'>" + text.substr(0,this.InputValue.length) + "</span>" + text.substr(this.InputValue.length,text.length - this.InputValue.length);
					}
				}				
				
				this.AutoCompleteRowsText[i].obj.innerHTML = text;
				if(this.arResponse[i*2+1].length > 1)
				{						
					this.AutoCompleteRowsNoText[i].obj.innerHTML = trim(this.arResponse[i*2+1]);
				}
				this.AutoCompleteRows[i].setStyle("display","");
				this.rowsFilled = i;
			}else{						
				this.AutoCompleteRowsText[i].obj.innerHTML = "";
				this.AutoCompleteRowsNoText[i].obj.innerHTML = "";
				this.AutoCompleteRows[i].setStyle("display","none");
			}
		}
		this.rowsFilled++;		
		this.makeVisible = true;
		this.visibleAutoComplete();
		//--- Breite anpassen				
		//--- ###### Breite kann nicht angepasst werden, da innerHTML zu langsam ist. Es wird immer noch der alte WIDTH angezeigt
		if(!this.noAutoWidth)		
		{			
			this.AutoCompleteBox.setStyle("width","auto");		
			if(this.AutoCompleteBox.prop["width"] <= this.Input.prop['width'])
			{
				this.AutoCompleteBox.setStyle("width",this.Input.prop['width']);
				this.AutoCompleteRowsText[0].setStyle("width",this.AutoCompleteBox.prop['width'] - this.AutoCompleteRowsNoText[0].obj.offsetWidth - 5);
			}
		}
		this.AutoCompleteBox.moveIframe("move");
	}

	//--- Inhalt des Inputs mit dem der Auswahlbox befüllen
	this.AutoComplete = function(e,arArray)
	{			
		this.valueToInput(trim(this.arResponse[arArray[1] * 2]));
		this.hiddenAutoComplete();
	}

	this.valueToInput = function(value)
	{		
		value = value.replace(/&amp;/g,"&");		
		this.Input.obj.value = value;	
	}
	
	//--- Inhalt des Inputs merken
	this.RemarkAutoComplete = function()
	{
		this.InputValue = this.Input.obj.value;
	}
	
	//--- AutoCompleter sichtbar machen
	this.visibleAutoComplete = function()
	{			
		if(this.makeVisible)
		{				
			this.AutoCompleteBox.setStyle("display","block");
			this.AutoCompleteBox.setStyle("top",this.Input.prop["abs_bottom"]);
			this.AutoCompleteBox.setStyle("left",this.Input.prop["abs_left"]);
			this.AutoCompleteBox.moveIframe();						
		}
	}

	//--- AutoCompleter verschwinden lassen
	this.hiddenAutoComplete = function()
	{
		if(this.AutoCompleteRows[this.activeRow])
		{
			this.AutoCompleteRows[this.activeRow].setClass(this.RowClass);
		}
		this.AutoCompleteBox.setStyle("display","none");
		this.AutoCompleteBox.moveIframe();
	}
	
	//--- Zeile als aktiv markieren und/oder weiterhüpfen durch Pfeiltasten realisieren
	this.activeAutoCompleteRow = function(e,arArray)
	{
		if(this.AutoCompleteRows[this.activeRow])
		{
			this.AutoCompleteRows[this.activeRow].setClass(this.RowClass);
		}						
		this.activeRow = arArray[1];

		//--- Wenn in der Liste wieder auf das Input Feld zurück gesprungen wurde
		if(this.activeRow == -1 || this.activeRow == this.rowsFilled)
		{
			this.valueToInput(this.InputValue);
			this.AutoCompleteRows[0].setClass(this.RowClass);
			this.AutoCompleteRows[this.rowsFilled-1].setClass(this.RowClass);
			this.activeRow = -1;
			return;
		}else{
			if(this.activeRow < 0)
			{
				this.activeRow = this.rowsFilled - 1;
			}else if(this.activeRow > this.rowsFilled - 1)
			{
				this.activeRow = 0;
			}
		}
		
		this.AutoCompleteRows[this.activeRow].setClass(this.activeRowClass);
		if(arArray[2])
		{
			//this.valueToInput(remarkWord(trim(this.AutoCompleteRowsText[this.activeRow].obj.innerHTML)));			
			this.valueToInput(trim(this.arResponse[this.activeRow * 2]));
		}
		
	}
	
	this.__construct(obj,ajaxDatei,arDaten,rows,visibleWhenEmpty,stringSection);
}