﻿// JavaScript Document

function verif_numeric(variable)
{
var exp = new RegExp("^[0-9.]+$","g");
return exp.test(variable);
} 

function checkMobilePhoneNumber(num){ 
			var regex = new RegExp(/^06[0-9]{8}/gi); 
			return regex.test(num); 
}

function checkPhoneNumber(num){ 
			var regex = new RegExp(/^[0-9]{8}/gi); 
			return regex.test(num); 
}

function checkCP(num){ 
			var regex = new RegExp(/^[0-9]{5}/gi); 
			return regex.test(num); 
}

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

function validsimulateur() 
	{	
			
			if((document.simulateur.produit1.checked==false) && (document.simulateur.produit2.checked==false) && (document.simulateur.produit3.checked==false) && (document.simulateur.produit4.checked==false) && (document.simulateur.produit5.checked==false) && (document.simulateur.produit6.checked==false) && (document.simulateur.produit7.checked==false) && (document.simulateur.produit8.checked==false) && (document.simulateur.produit9.checked==false) && (document.simulateur.produit10.checked==false) && (document.simulateur.produit11.checked==false) && (document.simulateur.produit12.checked==false) && (document.simulateur.produit13.checked==false)) {
			alert('Veuillez choisir au moins 1 produit');
			return false;
			stop();
			}
			
			if((document.simulateur.duree[0].checked==false) && (document.simulateur.duree[1].checked==false) && (document.simulateur.duree[2].checked==false) && (document.simulateur.duree[3].checked==false)) {
			alert('Veuillez sélectionner une durée de location');
			return false;
			stop();
			}
			
		  document.getElementById('simulateur').submit();
	}


function validContact() 
	{	

			if (document.contact.sujet.value == 'no') {
			alert('Choisissez un sujet');
			document.contact.sujet.style.backgroundColor = "#E4D9E9";
			document.contact.sujet.focus();
			return false;
			stop();
			}
			
			if (document.contact.nom.value == '') {
			alert('Indiquez votre Nom');
			document.contact.nom.style.backgroundColor = "#E4D9E9";
			document.contact.nom.focus();
			return false;
			stop();
			}
			
			if (document.contact.prenom.value == '') {
			alert('Indiquez votre Prénom');
			document.contact.prenom.style.backgroundColor = "#E4D9E9";
			document.contact.prenom.focus();
			return false;
			stop();
			}
			
			if (document.contact.tel.value == '') {
			alert('Indiquez votre Numéro de téléphone');
			document.contact.tel.style.backgroundColor = "#E4D9E9";
			document.contact.tel.focus();
			return false;
			stop();
			}
			
			if(document.contact.email.value.indexOf('@') == -1) {
		    alert("Ce n'est pas une adresse electronique !");
			document.contact.email.style.backgroundColor = "#E4D9E9";
		    document.contact.email.focus();
		    return false;
		    stop();
			}
						
			if (document.contact.message.value == '') {
			alert('Indiquez votre Message');
			document.contact.message.style.backgroundColor = "#E4D9E9";
			document.contact.message.focus();
			return false;
			stop();
			}
			
		  document.getElementById('contact').submit();
	}
	
	function validContactpro() 
	{	

			if (document.contactpro.sujet.value == 'no') {
			alert('Choisissez un sujet');
			document.contactpro.sujet.style.backgroundColor = "#E4D9E9";
			document.contactpro.sujet.focus();
			return false;
			stop();
			}
			
			if (document.contactpro.nom.value == '') {
			alert('Indiquez votre Nom');
			document.contactpro.nom.style.backgroundColor = "#E4D9E9";
			document.contactpro.nom.focus();
			return false;
			stop();
			}
			
			if (document.contactpro.prenom.value == '') {
			alert('Indiquez votre Prénom');
			document.contactpro.prenom.style.backgroundColor = "#E4D9E9";
			document.contactpro.prenom.focus();
			return false;
			stop();
			}
			
			if (document.contactpro.tel.value == '') {
			alert('Indiquez votre Numéro de téléphone');
			document.contactpro.tel.style.backgroundColor = "#E4D9E9";
			document.contactpro.tel.focus();
			return false;
			stop();
			}
			
			if(document.contactpro.email.value.indexOf('@') == -1) {
		    alert("Ce n'est pas une adresse electronique !");
			document.contactpro.email.style.backgroundColor = "#E4D9E9";
		    document.contactpro.email.focus();
		    return false;
		    stop();
			}
						
			if (document.contactpro.message.value == '') {
			alert('Indiquez votre Message');
			document.contactpro.message.style.backgroundColor = "#E4D9E9";
			document.contactpro.message.focus();
			return false;
			stop();
			}
			
		  document.getElementById('contact').submit();
	}
