// couleur de fond du champ de texte en cas d'erreur (champ non rempli ou mal rempli)
var couleurFond1 = "#ffcbe7";
var imageFond1 = 'url(images/bg_champ-err.png)';

function couleur(obj) {
     //obj.style.backgroundColor = "#ffffff";
	 obj.style.backgroundImage = 'url(images/bg_champs.gif)';
}

function checkDemandeInformations() {
	var msg = "";

	if ((document.FormDemandeInfos.entreprise.value == "")&&(document.FormDemandeInfos.partculier.checked == false)){
		msg += "Saisissez le nom de l'entreprise ou cohez la case\n";
		document.FormDemandeInfos.entreprise.style.backgroundImage = imageFond1;
		document.FormDemandeInfos.partculier.style.backgroundImage = imageFond1;
	}
	
	if((document.FormDemandeInfos.civilite[0].checked == false)&&(document.FormDemandeInfos.civilite[1].checked == false)&&(document.FormDemandeInfos.civilite[2].checked == false)){
		msg += "Cochez la civilité\n";
	}
	
	if (document.FormDemandeInfos.nom.value == ""){
		msg += "Saisissez votre nom\n";
		document.FormDemandeInfos.nom.style.backgroundImage = imageFond1;
	}
	
	if (document.FormDemandeInfos.prenom.value == ""){
		msg += "Saisissez votre prenom\n";
		document.FormDemandeInfos.prenom.style.backgroundImage = imageFond1;
	}
	
	if ((document.FormDemandeInfos.telephone.value == "")&&(document.FormDemandeInfos.mobile.value == "")){
		msg += "Saisissez au moins un numéro de téléphone\n";
		document.FormDemandeInfos.telephone.style.backgroundImage = imageFond1;
		document.FormDemandeInfos.mobile.style.backgroundImage = imageFond1;
	}
	
	if (document.FormDemandeInfos.ville.value == ""){
		msg += "Saisissez la ville\n";
		document.FormDemandeInfos.ville.style.backgroundImage = imageFond1;
	}
	
	if (document.FormDemandeInfos.cp.value == ""){
		msg += "Saisissez le code postal\n";
		document.FormDemandeInfos.cp.style.backgroundImage = imageFond1;
	}
	if ((document.FormDemandeInfos.sujetContratMaintenance.checked == false)&&(document.FormDemandeInfos.sujetTarifs.checked == false)&&(document.FormDemandeInfos.sujetInfosWeba.checked == false)&&(document.FormDemandeInfos.sujetDuplicataFact.checked == false)&&(document.FormDemandeInfos.sujetAutre.checked == false)&&(document.FormDemandeInfos.sujetDiagnostic.checked == false)){
		msg += "Cochez au moins un sujet concernant la demande\n";
		document.FormDemandeInfos.sujetContratMaintenance.style.backgroundImage = imageFond1;
		document.FormDemandeInfos.sujetTarifs.style.backgroundImage = imageFond1;
		document.FormDemandeInfos.sujetInfosWeba.style.backgroundImage = imageFond1;
		document.FormDemandeInfos.sujetDuplicataFact.style.backgroundImage = imageFond1;
		document.FormDemandeInfos.sujetAutre.style.backgroundImage = imageFond1;
		document.FormDemandeInfos.sujetDiagnostic.style.backgroundImage = imageFond1;
	}
	
	if (document.FormDemandeInfos.details_demande.value == ""){
		msg += "Précisez votre demande\n";
		document.FormDemandeInfos.details_demande.style.backgroundImage = imageFond1;
	}
	

	// 
	if (msg == ""){	
		document.FormDemandeInfos.submit();
		return(true);		
	}else{
		alert(msg);
		return(false);
	}
}

function checkDemandeIntervention() {
	var msg = "";

	if ((document.FormDemandeInter.entreprise.value == "")&&(document.FormDemandeInter.partculier.checked == false)){
		msg += "Saisissez le nom de l'entreprise ou cohez la case\n";
		document.FormDemandeInter.entreprise.style.backgroundImage = imageFond1;
		document.FormDemandeInter.partculier.style.backgroundImage = imageFond1;
	}
	
	if((document.FormDemandeInter.civilite[0].checked == false)&&(document.FormDemandeInter.civilite[1].checked == false)&&(document.FormDemandeInter.civilite[2].checked == false)){
		msg += "Cochez la civilité\n";
	}
	
	if (document.FormDemandeInter.nom.value == ""){
		msg += "Saisissez votre nom\n";
		document.FormDemandeInter.nom.style.backgroundImage = imageFond1;
	}
	
	if (document.FormDemandeInter.prenom.value == ""){
		msg += "Saisissez votre prenom\n";
		document.FormDemandeInter.prenom.style.backgroundImage = imageFond1;
	}
	
	if ((document.FormDemandeInter.telephone.value == "")&&(document.FormDemandeInter.mobile.value == "")){
		msg += "Saisissez au moins un numéro de téléphone\n";
		document.FormDemandeInter.telephone.style.backgroundImage = imageFond1;
		document.FormDemandeInter.mobile.style.backgroundImage = imageFond1;
	}
	
	if (document.FormDemandeInter.ville.value == ""){
		msg += "Saisissez la ville\n";
		document.FormDemandeInter.ville.style.backgroundImage = imageFond1;
	}
	
	if (document.FormDemandeInter.cp.value == ""){
		msg += "Saisissez le code postal\n";
		document.FormDemandeInter.cp.style.backgroundImage = imageFond1;
	}
	if ((document.FormDemandeInter.sujetDepannage.checked == false)&&(document.FormDemandeInter.sujetInstallation.checked == false)&&(document.FormDemandeInter.sujetAutre.checked == false)&&(document.FormDemandeInter.sujetDiagnostic.checked == false)){
		msg += "Cochez au moins un sujet d'intervention\n";
		document.FormDemandeInter.sujetDepannage.style.backgroundImage = imageFond1;
		document.FormDemandeInter.sujetInstallation.style.backgroundImage = imageFond1;
		document.FormDemandeInter.sujetAutre.style.backgroundImage = imageFond1;
		document.FormDemandeInter.sujetDiagnostic.style.backgroundImage = imageFond1;
	}
	
	if (document.FormDemandeInter.details_demande.value == ""){
		msg += "Précisez votre demande\n";
		document.FormDemandeInter.details_demande.style.backgroundImage = imageFond1;
	}
	
	if((document.FormDemandeInter.planification[0].checked == false)&&(document.FormDemandeInter.planification[1].checked == false)&&(document.FormDemandeInter.planification[2].checked == false)&&(document.FormDemandeInter.planification[3].checked == false)){
		msg += "Cochez le jour de l'intervention\n";
	}
	
	if((document.FormDemandeInter.cadre[0].checked == false)&&(document.FormDemandeInter.cadre[1].checked == false)){
		msg += "Cochez le choix du cadre d'intervention\n";
	}
	
	// 
	if (msg == ""){	
		document.FormDemandeInter.submit();
		return(true);		
	}else{
		alert(msg);
		return(false);
	}
}