///// couleur modifiable //////
var couleurt = "#CC6600";


//////  fonction    /////////
function input(){
	var inmputs = document.getElementsByTagName("input");
	var textareas = document.getElementsByTagName("textarea");
	
	var nbInpute = inmputs.length;
	//alert (nbInpute);
	for (var i=0; i < nbInpute; i++) {
		//alert (inmputs[i]);
		
		
		////////   type texte     ////////
		
		if (inmputs[i].getAttribute("type") == "text" && inmputs[i].getAttribute("title") != null) {
			//alert(	inmputs[i].getAttribute("title")	);	
			var value = inmputs[i].getAttribute("title");
			if(inmputs[i].parentNode.parentNode.getAttribute("id") != "recherche") {
				if ( inmputs[i].getAttribute("value") == null) {
					inmputs[i].style.color = couleurt ; 
					inmputs[i].style.fontStyle = "italic";
					inmputs[i].setAttribute("value", value);
				}
				inmputs[i].setAttribute("onfocus", "javascript:if(this.value == '"+value+"') { this.value=''; "+modifStyle()+" }");
				inmputs[i].setAttribute("onBlur", "javascript: if(this.value == '') {"+modifStyle()+"; this.value = '"+value+"';  }");
			}
		}
		
		
		//////  type password /////
		
		if (inmputs[i].getAttribute("type") == "password" && inmputs[i].getAttribute("title") != null) {
			//alert(	inmputs[i].getAttribute("title")	);	
			var value = inmputs[i].getAttribute("title");
			if(inmputs[i].parentNode.parentNode.getAttribute("id") != "recherche") {
				if ( inmputs[i].getAttribute("value") == null) {
					inmputs[i].style.color = couleurt ; 
					inmputs[i].style.fontStyle = "italic";
					inmputs[i].setAttribute("type", "text");
					inmputs[i].setAttribute("value", value);
				}
				inmputs[i].setAttribute("onfocus", "javascript:if(this.value == '"+value+"') { this.value=''; "+modifStyle()+"; this.setAttribute(\"type\", \"password\"); }");
				inmputs[i].setAttribute("onBlur", "javascript: if(this.value == '') { this.setAttribute(\"type\", \"text\"); "+modifStyle()+";  this.value = '"+value+"';}");
			}
		}
	}
	
	var nbTextareas = textareas.length;
	//alert (nbInpute);
	for (var i=0; i < nbTextareas; i++) {
		//alert (inmputs[i]);
		//alert(textareas[i].getAttribute("title"));
		if (textareas[i].getAttribute("title") != null) {
			var value = textareas[i].getAttribute("title");
				//alert (textareas[i].value);
				if ( textareas[i].value == '') {
					textareas[i].style.color = couleurt ; 
					textareas[i].style.fontStyle = "italic";
					textareas[i].appendChild(document.createTextNode(value)) ;
				}
				textareas[i].setAttribute("onclick", "javascript:if(this.value == '"+value+"') { this.innerHTML=''; "+modifStyle()+" }");
				textareas[i].setAttribute("onBlur", "javascript: if(this.value == '') {"+modifStyle()+"; this.appendChild(createTextNode('"+value+"')); }");
		}
	}
}

////   changement de style ///////
var modifStyl = true;
function modifStyle() {
	if (modifStyl == false) {
		var texte = "this.style.color = '"+couleurt+"' ; this.style.fontStyle = 'italic'; ";
		modifStyl = true;
	}
	else {
		var texte = "this.style.color = \"\" ; this.style.fontStyle = \"normal\"; ";
		modifStyl = false;
	}
	return texte;
}




