function getVilles() {
	if($('#codePostal').val().length == 5) {
		$.post("/documentation/getvilles",{codePostal: $('#codePostal').val()},function success(data) { 
			$('#ville').html(data); 		
		});
	}
}

function verifEmail(email) 
{
	 if (email.match('^[-_\.0-9a-zA-Z]{1,}@[-_\.0-9a-zA-Z]{1,}[\.][0-9a-zA-Z]{2,}$'))
	 {
	 	return true;
	 }
	 else
	 {
	 	return false;
	 }
}

function verifFormDoc() 
{
	var email = new String(document.getElementById("emailContact").value);
	var mess = "";
	var valid = true;
	
    if (verifEmail(email))
    { 
       if($('#nom').val() == "" || $('#prenom').val() == "" || $('#adresse').val() == "" || $('#codePostal').val() == "" || $('#ville').val() == -1 || $('#fonctionDetail').val() == "" || $('#secteur').val() == -1 || $('#moyens').val() == -1) {
       		mess = "Veuillez renseigner les champs marqués par (*)";
       		valid = false;
       }
    } 
    else 
    { 
       mess = "Votre adresse email est incorrecte, veuillez la modifier.";
       valid = false;
	}
	
	if(valid) {
		return true;
	} else {
		alert(mess);
		return false;
	}
}
