/* FONCTIONS JAVASCRIPT */

// ---------- INITIALISATION & DIVERS ---------- //
// --------------------------------------------- //

// => Fonction permettant d'afficher une pop-up centrée
function ouvrir(l,h,url) {
	hauteur = Math.round((screen.availHeight-h)/2);
	largeur = Math.round((screen.availWidth-l)/2);
	window.open(url, "", "toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,menubar=0,top="+hauteur+",left="+largeur+",width="+l+",height="+h);
}

// ---------- VERIFICATION FORMULAIRES ---------- //
// ---------------------------------------------- //
// => Fonction de vérification des champs du formulaire de contact
function verifFormContact(){	
	// Vérification des champs vides
	if (document.form_contact.nom.value == "") {
 		alert("Veuillez saisir votre NOM.\n");
 		document.form_contact.nom.focus();
		return false;
	}
	
	if (document.form_contact.mail.value == "") {
 		alert("Veuillez saisir votre MAIL.\n");
 		document.form_contact.mail.focus();
		return false;
	}
		
	if (document.form_contact.message.value == "") {
 		alert("Veuillez saisir un MESSAGE.\n");
 		document.form_contact.message.focus();
		return false;
	}
	
	// Vérification du format de l'adresse mail
 	adresse = document.form_contact.mail.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	
	if (document.form_contact.mail.value != "") {
		if ((place > -1)&&(adresse.length > 2)&&(point > 1)) {
			return true;
		} else {
			alert("Veuillez saisir une adresse mail VALIDE.\n");
			document.form_contact.mail.focus();
			return false;
		}
	}
}
