	function xstopError() {return true;}
	window.onerror = xstopError;
	
	function validator(theform)
	{
		var vOk;
		vOk = 0;
	
		if (theform.cp.value == "")
		{
			alert("Tapez une valeur pour le champ \"Code postal, ex : 75017\"");
			theform.cp.focus();
			return (false);
		}
		
		if (theform.somme.value == "")
		{
			alert("Tapez une valeur pour le champ \"Somme souhaitée ex : 120000\"");
			theform.somme.focus();
			return (false);
		}
		
		if (isNaN(theform.somme.value))
		{
			alert("Veuillez saisir une somme correct. ex : 120000\"");
			theform.somme.focus();
			return (false);
		}
		
	  var radioSelected = false;
	  for (i = 0;  i < theform.StadeProjet.length;  i++)
	  {
	
	  if (theform.StadeProjet[i].checked)
	        radioSelected = true;
	  }
	  
	  if (radioSelected==false)
	  {
	    alert("Merci de nous preciser l'avancement de votre projet en cochant un des 4 choix ci-dessus !");
	    theform.StadeProjet[1].focus();
	    return (false);
	  }
	
		if (theform.nom.value == "")
		{
			alert("Tapez une valeur pour le champ \"Nom \"");
			theform.nom.focus();
			return (false);
		}
		
		if (theform.prenom.value == "")
		{
			alert("Tapez une valeur pour le champ \"Prenom \"");
			theform.prenom.focus();
			return (false);
		}
		
		if (theform.tel.value == "")
		{
			alert("Tapez une valeur pour le champ \"Téléphone \"");
			theform.tel.focus();
			return (false);
		}
		
	  if (theform.tel.value.length > 0)
	  {
	    if (isNaN(theform.tel.value)|theform.tel.value.length<10)
	    {
	    alert("Numéro de téléphone incorrect\nIl doit être composé de 10 chiffres minimum\nex : 0142410010");
	    theform.tel.focus();
	    return (false);
	    }
	  }
	  
	  	if (theform.somme.value > 300000 || theform.somme.value < 10000)
		{
			if (confirm("Attention, êtes vous sur de la valeur " + theform.somme.value + " € ?"))
			{
				vOk = vOk + 1;
			}
			else
			{
				theform.somme.focus();
				return (false);
			}
		}
		else
		{
			vOk = vOk + 1;
		}
		
		if (vOk < 1)
		{
			return(false);
		}
		
			if (theform.cg.checked == false)
			{
				alert("Vous devez accepter les conditions générales");
				theform.cg.focus();
				return (false);
			}
			
	   	if (theform.email.value == "")
		{
			return (true);
		}
		
		else
		
		{
	  		if (theform.email.value.indexOf('@') == -1)
	  		{
	  		  alert("Merci de preciser un email valide ! sinon ne remplissez pas cette cellule !");
	  		  theform.email.focus();
	  		  return (false);
	  		}
		}
		
		return (true);
	}
