function couleur(obj) {
     obj.style.backgroundColor = "#ffffff";
}

function check_gauche() {
	var msg = "";

	if (document.form_a.nom_et_prenom_gauche.value == "")	{
		msg += "Veuillez saisir votre nom et votre prénom\n";
		document.form_a.nom_et_prenom_gauche.style.backgroundColor = "#F3C200";
	}
	if (document.form_a.telephone_gauche.value == "")	{
		msg += "Veuillez saisir votre téléphone\n";
		document.form_a.telephone_gauche.style.backgroundColor = "#F3C200";
	}
	else {
		if (document.form_a.telephone_gauche.value.length < 10)	{
			msg += "Votre téléphone doit comporter 10 chiffres\n";
			document.form_a.telephone_gauche.style.backgroundColor = "#F3C200";
		}
	}
	if (document.form_a.email_gauche.value != "")	{
		indexAroba = document.form_a.email_gauche.value.indexOf('@');
		indexPoint = document.form_a.email_gauche.value.indexOf('.');
		if ((indexAroba < 0) || (indexPoint < 0))		{
		document.form_a.email_gauche.style.backgroundColor = "#F3C200";
			msg += "Le email est incorrect\n";
		}
	}
	else	{
		document.form_a.email_gauche.style.backgroundColor = "#F3C200";
		msg += "Veuillez saisir votre email\n";
	}
		
	if (msg == "") {
		alert('Votre demande a bien été enregistrée.\nUn conseiller vous contactera très rapidement.');
		return(true);
		}
	else	{
		alert(msg);
		return(false);
	}
}


function check_centre() {
	var msg = "";

	if (document.theForm.nom_centre.value == "")	{
		msg += "Veuillez saisir votre nom et votre prénom\n";
		document.theForm.nom_centre.style.backgroundColor = "#F3C200";
	}
	if (document.theForm.tel_centre.value == "")	{
		msg += "Veuillez saisir votre téléphone\n";
		document.theForm.tel_centre.style.backgroundColor = "#F3C200";
	}
	else {
		if (document.theForm.tel_centre.value.length < 10) {
			msg += "Votre téléphone doit comporter 10 chiffres\n";
			document.theForm.tel_centre.style.backgroundColor = "#F3C200";
		}
	}
	if (document.theForm.email_centre.value != "")	{
		indexAroba = document.theForm.email_centre.value.indexOf('@');
		indexPoint = document.theForm.email_centre.value.indexOf('.');
		if ((indexAroba < 0) || (indexPoint < 0))		{
		document.theForm.email_centre.style.backgroundColor = "#F3C200";
			msg += "Le email est incorrect\n";
		}
	}
	else	{
		document.theForm.email_centre.style.backgroundColor = "#F3C200";
		msg += "Veuillez saisir votre email\n";
	}
	
	if (document.theForm.age.value == "")	{
		msg += "Veuillez saisir votre âge\n";
		document.theForm.age.style.backgroundColor = "#F3C200";
	}
	
		
	if (msg == "") {
		alert('Votre demande a bien été enregistrée.\nUn conseiller vous contactera très rapidement.');
		return(true);
		}
	else	{
		alert(msg);
		return(false);
	}
}

function check_newsletter() {
	var msg = "";

	if (document.form_c.nom_et_prenom_newsletter.value == "")	{
		msg += "Veuillez saisir votre nom et votre prénom\n";
		document.form_c.nom_et_prenom_newsletter.style.backgroundColor = "#F3C200";
	}
	if (document.form_c.email_newsletter.value != "")	{
		indexAroba = document.form_c.email_newsletter.value.indexOf('@');
		indexPoint = document.form_c.email_newsletter.value.indexOf('.');
		if ((indexAroba < 0) || (indexPoint < 0))		{
		document.form_c.email_newsletter.style.backgroundColor = "#F3C200";
			msg += "Le email est incorrect\n";
		}
	}
	else	{
		document.form_c.email_newsletter.style.backgroundColor = "#F3C200";
		msg += "Veuillez saisir votre email\n";
	}
		
	if (msg == "") {
		alert('Votre inscription a bien été enregistrée !');
		return(true);
		}
	else	{
		alert(msg);
		return(false);
	}
}





function valid_telephone(evt) {
	var keyCode = evt.which ? evt.which : evt.keyCode;
	var interdit = 'azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBNàâäãçéèêëìîïòôöõùûüñ -+&*?!:;.,\t#~"^¨%$£?²¤§%*()[]{}<>|\\/`\'';
	if (interdit.indexOf(String.fromCharCode(keyCode)) >= 0) {
		return false;
	}
}

function valid_mail(evt) {
	var keyCode = evt.which ? evt.which : evt.keyCode;
	
	if(keyCode == 8 || keyCode == 9 || keyCode == 13 || keyCode == 37 || keyCode == 39 || keyCode == 46) return true;
	var moutar = 'azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN@.0123456789-_';
	if (moutar.indexOf(String.fromCharCode(keyCode)) >= 0) {
		return true;
	}
	else {
		return false;
	}
}
