// JavaScript Document
if(typeof(SuperClass)=='function'){ClearInput.prototype = new SuperClass; /* héritage des méthodes */}

function ClearInput(classCSS, onLoad){
	if(typeof(SuperClass)!='function'){alert("fichier SuperClass.js manquant!");}
	else{		
		/* héritage */
		this.classMere = SuperClass;  // classe parente
		this.classMere(); // appel du super constructeur
		delete this.classMere; // inutile de garder la classe parente
		
		this.classCSS=classCSS;
		this.nodeTab=new Array();
		if(onLoad!=false){this.initOnLoad();}
	}
}

ClearInput.prototype.initOnLoad = function(){
var localThis=this;
	this.addEvent(window, "load",
		function(){
			localThis.init();
		}				  
	); 
}

ClearInput.prototype.init = function(){
this.nodeTab = this.getElementsByClassName(this.classCSS);
this.initEvent();
}

ClearInput.prototype.initEvent = function(){
var nb = this.nodeTab.length;
var elem;
var localThis=this;
	for(var i=0; i<nb; i++){
		elem=localThis.nodeTab[i];
		elem.firstValue = elem.value;
		this.addEvent(elem, "focus",
			function(event){
				var thisInput=localThis.getThisFromEvent(event);
				if(thisInput.value==thisInput.firstValue){
					thisInput.value='';
				}
			}
		);
		
		this.addEvent(elem, "blur",
			function(event){
				var thisInput=localThis.getThisFromEvent(event);
				if(localThis.trim(thisInput.value)==''){
					thisInput.value=thisInput.firstValue;
				}
			}
		);
		
	}	
}