function $(id)
{
	return document.getElementById(id);
}

function controleFormContact()
{        


	if($("formContactTitre").value == "")
	{
		alert("Veuillez définir votre titre.");
		$("formContactTitre").focus();
		return false;
	}

	if($("formContactPrenom").value == "")
	{
		alert("Veuillez définir votre prénom.");
		$("formContactPrenom").focus();
		return false;
	}

	if($("formContactNom").value == "")
	{
		alert("Veuillez définir votre nom.");
		$("formContactNom").focus();
		return false;
	}

	if($("formContactNPA").value == "")
	{
		alert("Veuillez définir votre NPA.");
		$("formContactNPA").focus();
		return false;
	}

	if($("formContactLocalite").value == "")
	{
		alert("Veuillez définir votre localité.");
		$("formContactLocalite").focus();
		return false;
	}

	if($("formContactTelephone").value == "")
	{
		alert("Veuillez définir votre téléphone.");
		$("formContactTelephone").focus();
		return false;
	}

	
	if ( $("formContactEmail").value != " ")
	{
		function verifMail(a)
		{
		testm = false ;
		for (var j=1 ; j<(a.length) ; j++)
		{
			if (a.charAt(j)=='@')
			{
			if (j<(a.length-4))
			{
				for (var k=j ; k<(a.length-2) ; k++)
				{
					if (a.charAt(k)=='.') testm = true;
				}
				}
			}
			}


                          if (testm == false)
                          {
                          	alert("Veuillez entrer une adresse e-mail correcte.");
                            	$("formContactEmail").focus();
                            	return false;
                          }
                      }

                      verifMail( $("formContactEmail").value)

                   }


                   if (testm == false)
                   {
                   	return false;
                   	}
                   else{  }
				   
				if ( $("formContactEmail").value != $("formContactEmail2").value)
				{
					alert("Vos deux emails ne correspondent pas.");
                			$("formContactEmail2")
                			return false;
				}
				

		if ($("formContactMessage").value == "")
		{
			alert("Veuillez entrer votre remarque.");
			$("formContactMessage").focus();
			return false;
		}    
		
		if ($("formContactSpam").value == "")
		{
			alert("Veuillez entrer la réponse à la question anti-SPAM.");
			$("formContactSpam").focus();
			return false;
		}
		
		if(isNaN($("formContactSpam").value))
		{
		alert("La réponse doit être composée uniquement de chiffres !");
		$("formContactSpam").focus();
		return false;
		}
}