//--- Text in Inputfeld schreiben und rausnehmen sobald aktiv
function cInputText(obj,text,css)
{

	this.obj 		= false;
	this.text 		= false;
	this.CSS 		= false;
	this.normalCSS 	= false;
	this.empty = true;
	
	this.__construct = function(obj,text,css)
	{			
		if(obj.length == 0 || text.length == 0)
		{
			return false;
		}
		this.obj 	= obj;
		this.text 	= text;
		this.css 	= css;
		addEvent(window,"load",this.init.scope(this));
	}

	//--- Initialisieren
	this.init = function()
	{		
		this.obj = new CElement(this.obj,false,false);
		this.obj = this.obj.obj;
		if(!this.obj)
		{
			return false;
		}
		this.normalCSS = this.obj.className;
		this.css = (this.css) ? this.normalCSS + " " + this.css : this.normalCSS;
		addEvent(this.obj,"blur",this.inaktiv.scope(this));
		addEvent(this.obj,"focus",this.active.scope(this));
		this.inaktiv();
	}
	
	//--- Wenn Input den Focus hat normales css aktivieren und Text (falls infos text) elminieren
	this.active = function()
	{		
		value = trim(this.obj.value);
		this.obj.className = this.normalCSS;
		if(value == this.text)
		{			
			this.obj.value = "";
		}
	}
	
	//--- Wenn Input nicht aktiv ist gucken ob was drin steht und ob es nicht der default text ist
	this.inaktiv = function()
	{
		value = trim(this.obj.value);
		if(value && value.length > 0 && value != this.text)
		{			
			this.empty = false;
			this.obj.className = this.normalCSS;
		}else{
			this.empty = true;
			this.obj.className = this.css;
			this.obj.value = this.text;
		}
	}

	//--- Prüft ob der Default Value drin steht oder ob sich der Wert geändert hat
	//------ macht bei bedarf das Feld leer
	this.checkValue = function(clear,getValue)
	{
		if(this.empty && clear)
		{
			this.obj.value = "";
		}
		
		//--- Soll der Value des Feldes zurück gegeben werden?
		if(getValue)
		{
			return this.obj.value;
		}else{
			return !this.empty;
		}
	}
	
	//--- gibt den Default Text zurück der in dem Feld steht
	this.getText = function()
	{
		return this.text;
	}
	
	this.__construct(obj,text,css);
}
