// JavaScript Document

var humour_photo = 1;
var MesImages = new Array();
var MesPages = new Array();
function humour() {
	humour_photo++;
	if (humour_photo > 2) {
		humour_photo = 1;
	}
	MesImages[1] = "campus-lyon.png";
	MesImages[2] = "campus-aix.png";
	MesPages[1] = "campus-lyon";
	MesPages[2] = "campus-aix";
	
	var img = document.getElementById('humour');
	img.src = '../images/accueil/' + MesImages[humour_photo];
	var a = document.getElementById('humour_a');
	a.href = 'index.php?main=' + MesPages[humour_photo];
	setTimeout("humour()", 4000);
}

var humou_photo = 1;
var MesImage = new Array();
var MesPage = new Array();
function humou() {
	humou_photo++;
	if (humou_photo > 2) {
		humou_photo = 1;
	}
	MesImage[1] = "master-esthetique-parfumerie.png";
	MesImage[2] = "capacite-soins-corps.png";
	MesImage[3] = "esco-expert-soins-corps";
	MesPage[1] = "meps.php";
	MesPage[2] = "capacite_soins_corps.php";
	MesPage[3] = "master_professionnel_soins_corps.php";
	
	var img = document.getElementById('humou');
	img.src = '../images/accueil/' + MesImage[humou_photo];
	var a = document.getElementById('humou_a');
	a.href = '../formations-esthetique/' + MesPage[humou_photo];
	setTimeout("humou()", 4000);
}

function validerform() {
		var msg = "";
		var ok = 0;
		
		if (document.forms['demande'].nom.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre nom.\n";
		}
		if (document.forms['demande'].form.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi formation en cours.\n";
		}
		if (document.forms['demande'].prenom.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre prenom.\n";
		}
		if (document.forms['demande'].adresse.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre adresse.\n";
		}
		if (document.forms['demande'].cp.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre code postal.\n";
		}
		if (document.forms['demande'].ville.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre ville.\n";
		}
		if (document.forms['demande'].tel.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre telephone.\n";
		}
		if (document.forms['demande'].verif_check_format.value == "") {
			ok = 1;
			msg += "Vous n'avez pas choisi la formation recherchée.\n";
		}
		// var errormsg = ""; 
		// var error_nb = 0;
		// var index = boutonradio_index("format");
		// if (index == -1) {
			// msg += "Vous n'avez pas choisi la formation recherchée.\n";
		// }
								
		if (ok == 1) {
			alert(msg);
			return true;
		}
		else {
			document.forms['demande'].submit();
		}
	}
	
// Retourne l'index du bouton radio sélectionné
function boutonradio_index(nom) 
{ 
	retour = -1; 
	// On récupère tous les éléments portant le nom : nom
	var boutons = document.getElementsByName(nom);
	for(var i=0; i < boutons.length; i++)
	{
		if (boutons[i].checked)
		{
			retour = i;
			break;
		}
	}
	return retour;
}
	
function validerjpo() {
		var msg = "";
		var ok = 0;
		
		if (document.forms['jpo'].nom.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre nom.\n";
		}
		if (document.forms['jpo'].prenom.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre prenom.\n";
		}
		if (document.forms['jpo'].adresse.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre adresse.\n";
		}
		if (document.forms['jpo'].cp.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre code postal.\n";
		}
		if (document.forms['jpo'].ville.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre ville.\n";
		}
		if (document.forms['jpo'].tel.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre telephone.\n";
		}
		if (document.forms['jpo'].email.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre email.\n";
		}
		if(document.forms['jpo'].samedi.value == ""){
			ok = 1;
			msg += "Merci de bien vouloir preciser la date.\n";
		}
		// if(document.forms['jpo'].samedi.checked){
		var errormsg = ""; 
		var error_nb = 0;
		var index = boutonradio_index("dates");
		if (index == -1) {	
			ok = 1;
			msg += "Merci de bien vouloir preciser la date.\n";
		}
		// }
		if(document.forms['jpo'].docs.checked){
			// var errormsg = ""; 
			// var error_nb = 0;
			// var index = boutonradio_index("filiere");
			// if (index == -1) 
			// {	
				// ok = 1;
				// msg += "Merci de bien vouloir preciser la filière.\n";
			// }
			if (document.forms['jpo'].filiere_hidden.value == "") {
				ok = 1;
				msg += "Vous n'avez pas choisi de filière.\n";
			}
		}
		if (document.forms['jpo'].formation.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre formation en cours.\n";
		}
								
		if (ok == 1) {
			alert(msg);
			return true;
		}
		else {
			document.forms['jpo'].submit();
		}
	}
	
function validercontact() {
		var msg = "";
		var ok = 0;
		
		if (document.forms['contact'].nom.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre nom.\n";
		}
		if (document.forms['contact'].prenom.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre prenom.\n";
		}
		if (document.forms['contact'].email.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre email.\n";
		}
		if (document.forms['contact'].message.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre message.\n";
		}
		if (document.forms['contact'].lieu.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre centre de formation.\n";
		}
								
		if (ok == 1) {
			alert(msg);
			return true;
		}
		else {
			document.forms['contact'].submit();
		}
	}
	
function validernews() {
		var msg = "";
		var ok = 0;
		
		if (document.forms['newsletter'].nlnom.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre nom.\n";
		}
		if (document.forms['newsletter'].nlprenom.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre prenom.\n";
		}
		if (document.forms['newsletter'].nlemail.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre email.\n";
		}
								
		if (ok == 1) {
			alert(msg);
			return true;
		}
		else {
			document.forms['newsletter'].submit();
		}
	}
	

