// JavaScript Document

function autoFocus(id,chaine){
	if(document.getElementById(id).value == chaine){
		document.getElementById(id).value = '';
	}
}

function autoBlur(chaine,id){
	if(document.getElementById(id).value == ''){
	 document.getElementById(id).value = chaine;
	}
}

function firstMaj(id){
	nom = document.getElementById(id).value;
	chaine = nom.charAt(0).toUpperCase() + nom.substring(1).toLowerCase();
	document.getElementById(id).value = chaine;
}

function IsNumeric(sText) {
   var ValidChars = "0123456789+";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) { 
		Char = sText.charAt(i); 
			if (ValidChars.indexOf(Char) == -1) {
			 IsNumber = false;
			}
		}
   return IsNumber;
}

function verif(id,phrase,bool){
	if(bool){
				document.getElementById(id+'Verif').innerHTML = '';
				document.getElementById(id).style.backgroundColor = '#DAFFD7';
	}else{
				document.getElementById(id+'Verif').innerHTML = '<span style="color:#FF0000;">'+phrase+'</span>';
				document.getElementById(id).style.backgroundColor = '#FFD5D7';
	}
}

function changeEtapeForm(id){
	document.getElementById('etape_form_change').value = id;
	document.change_etape.submit();
}