function rendreNul(element){
if((window.document.getElementById(element).value=="0123456789") || (window.document.getElementById(element).value=="JJ/MM/AAAA")){
window.document.getElementById(element).value="";
}
else
{
window.document.getElementById(element).select();
}
}


function changementbackground(x)
{
window.document.getElementById(x).style.background='#c8eaff';
}

function backgroundpardefault(x)
{
window.document.getElementById(x).style.background='white';
}

function verificationFormulaire(){
var erreur="";
if(window.document.getElementById("nom").value=="")
{erreur=erreur+"Nom mal rempli \n";
window.document.getElementById("labelNom").style.color='red';
}
if(window.document.getElementById("titre").value=="")
{erreur=erreur+"titre mal rempli \n";
window.document.getElementById("labelTitre").style.color='red';
}


if(verificationMail()==false)
{erreur=erreur+"Mail mal rempli \n";
window.document.getElementById("labelMail").style.color='red';}


if(window.document.getElementById("textarea").value=="")
{erreur=erreur+"Champ texte mal rempli \n";
window.document.getElementById("labelTexte").style.color='red';
}


if(erreur!=""){
return false;
}
return true;
}



function verificationMail(){
var mail=window.document.getElementById("mail").value;
var formatMail=new RegExp("^[a-zA-Z0-9\-_]+[a-zA-Z0-9\.\-_]*@[a-zA-Z0-9\-_]+\.[a-zA-Z\.\-_]{1,}[a-zA-Z\-_]+","i");
if(formatMail.test(mail)==false)
{
return false;
}
return true;
}
