function verif(){


	var nom= document.getElementById("nom").value;
	var prenom= document.getElementById("prenom").value;
	var mail= document.getElementById("email").value; 
	var verifier=true;
	
	var erreurNom= "";
	var erreurPrenom= "";
	var erreurMail="";
	
	if (nom==""){
		erreurNom= "Vous devez indiquer votre nom";
		verifier=false;
	}
	
	if (nom.length>30){
		erreurNom= "Limite de 30 caractères dépassée";
		verifier=false;
	}
	
	if (prenom==""){
		erreurPrenom= "Vous devez indiquer votre prenom";
		verifier=false;
	}
	
	if (prenom.length>30){
		erreurPrenom= "Limite de 30 caractères dépassée";
		verifier=false;
	}
	
	if (mail==""){
		erreurMail= "Vous devez indiquer votre adresse électronique ";
		verifier=false;
	}
	else
	if (mail.indexOf('@') == -1){
		erreurMail= "Adresse électronique invalide";
		verifier=false;
	}
	
	document.getElementById('erreurNom').innerHTML= erreurNom;
	document.getElementById('erreurPrenom').innerHTML= erreurPrenom;
	document.getElementById('erreurMail').innerHTML= erreurMail;

	return verifier;

}

function efface(){

document.getElementById('erreurNom').innerHTML= "";
document.getElementById('erreurPrenom').innerHTML= "";
document.getElementById('erreurMail').innerHTML= "";
document.getElementById('listeFormation').innerHTML="";
document.getElementById('niveaux').innerHTML="";

}

function leMotif() {

tab= new Array();
	var n = document.getElementById("motif").length;
	var tab = document.getElementById("motif").options;
	var valeur="";
	
	
		
		for(i=0; i<n; i++) {

		if (tab[i].selected) {
			if(tab[i].value=="formation"){
			
			//alert(tab[i].value);	
			
			document.getElementById('listeFormation').innerHTML="Choisissez votre formation : ";
			
			//Récupération des éléments de la liste
			
			//liste= document.getElementById('listeFormation');
			
			//Création d'un nouvel élément select avec ses attributs
			nouveauSelect= document.createElement('select');
			nouveauSelect.setAttribute('name', 'formation');
			nouveauSelect.setAttribute('id', 'formation');
			nouveauSelect.setAttribute('onchange', 'choixFormation();');

			
			//Création des nouvelles options pour l'élément select 
			
			// Formation accélérée Cubase ou Pro Tools 
			nouvelleOption1= document.createElement('option');
			nouvelleOption1.setAttribute('value', 'formation 1');
			nouvelleOption1.setAttribute('selected', 'selected');
			formation1= document.createTextNode('Formation accélérée Cubase ou Pro Tools');
			nouvelleOption1.appendChild(formation1);
			
			// Formation approfondie Cubase ou Pro Tools
			nouvelleOption2= document.createElement('option');
			nouvelleOption2.setAttribute('value', 'formation 2');
			formation2= document.createTextNode('Formation approfondie Cubase ou Pro Tools');
			nouvelleOption2.appendChild(formation2);
			
			//Formation M.A.O.
			nouvelleOption3= document.createElement('option');
			nouvelleOption3.setAttribute('value', 'formation 3');
			formation3= document.createTextNode('Formation M.A.O.');
			nouvelleOption3.appendChild(formation3);
			
			//Cours "à la carte"
			nouvelleOption4= document.createElement('option');
			nouvelleOption4.setAttribute('value', 'formation 4');
			formation4= document.createTextNode('Cours "à la carte"');
			nouvelleOption4.appendChild(formation4);
			
			//Formation arrangement
			nouvelleOption5= document.createElement('option');
			nouvelleOption5.setAttribute('value', 'formation 5');
			formation5= document.createTextNode('Formation arrangements');
			nouvelleOption5.appendChild(formation5);
			
			//Formation production musicale en studio
			nouvelleOption6= document.createElement('option');
			nouvelleOption6.setAttribute('value', 'formation 6');
			formation6= document.createTextNode('Formation production musicale en studio');
			nouvelleOption6.appendChild(formation6);
			
			// Ajout des options à l'élément select
			nouveauSelect.appendChild(nouvelleOption1);
			nouveauSelect.appendChild(nouvelleOption2);
			nouveauSelect.appendChild(nouvelleOption3);
			nouveauSelect.appendChild(nouvelleOption4);
			nouveauSelect.appendChild(nouvelleOption5);
			nouveauSelect.appendChild(nouvelleOption6);
			
			// Ajout de l'élément select à la liste
			document.getElementById('listeFormation').appendChild(nouveauSelect);
			}
			if(tab[i].value=="renseignement"){
				document.getElementById('listeFormation').innerHTML="";
				document.getElementById('niveaux').innerHTML="";
			}
						
		}
		valeur=tab[i].value;
		}
}


function choixFormation() {

tab= new Array();
	var n = document.getElementById("formation").length;
	var tab = document.getElementById("formation").options;
	var valeur="";
	
		for(i=0; i<n; i++) {

			if (tab[i].selected) {
			
				if(tab[i].value=="formation 1"){
				document.getElementById('niveaux').innerHTML="";
				}
				
				
				if(tab[i].value=="formation 2"){
				
				document.getElementById('niveaux').innerHTML="Votre niveau : ";
			
				//Récupération des éléments de la liste
				niveau= document.getElementById('niveaux');
				
				//Création d'un nouvel élément select avec ses attributs
				nouveauSelectNiveau= document.createElement('select');
				nouveauSelectNiveau.setAttribute('name', 'niveau');
				nouveauSelectNiveau.setAttribute('id', 'niveau');

				
				//Création des nouvelles options pour l'élément select 
				
				//Initié
				nouvelleOptionNiveau1= document.createElement('option');
				nouvelleOptionNiveau1.setAttribute('value', 'initié');
				nouvelleOptionNiveau1.setAttribute('selected', 'selected');
				niveau1= document.createTextNode('Initié');
				nouvelleOptionNiveau1.appendChild(niveau1);
				
				// Confirmé
				nouvelleOptionNiveau2= document.createElement('option');
				nouvelleOptionNiveau2.setAttribute('value', 'confirmé');
				niveau2= document.createTextNode('Confirmé');
				nouvelleOptionNiveau2.appendChild(niveau2);
				
				// Ajout des options à l'élément select
				nouveauSelectNiveau.appendChild(nouvelleOptionNiveau1);
				nouveauSelectNiveau.appendChild(nouvelleOptionNiveau2);
				
				// Ajout de l'élément select à la liste
				niveau.appendChild(nouveauSelectNiveau);
					
				}
				
				
				if(tab[i].value=="formation 3"){
				
				document.getElementById('niveaux').innerHTML="Votre niveau : ";
			
				//Récupération des éléments de la liste
				niveau= document.getElementById('niveaux');
				
				//Création d'un nouvel élément select avec ses attributs
				nouveauSelectNiveau= document.createElement('select');
				nouveauSelectNiveau.setAttribute('name', 'niveau');
				nouveauSelectNiveau.setAttribute('id', 'niveau');

				
				//Création des nouvelles options pour l'élément select 
				
				//Débutant
				nouvelleOptionNiveau= document.createElement('option');
				nouvelleOptionNiveau.setAttribute('value', 'débutant');
				nouvelleOptionNiveau.setAttribute('selected', 'selected');
				niveauDebutant= document.createTextNode('Débutant');
				nouvelleOptionNiveau.appendChild(niveauDebutant);
				
				//Initié
				nouvelleOptionNiveau1= document.createElement('option');
				nouvelleOptionNiveau1.setAttribute('value', 'initié');
				niveau1= document.createTextNode('Initié');
				nouvelleOptionNiveau1.appendChild(niveau1);
				
				// Confirmé
				nouvelleOptionNiveau2= document.createElement('option');
				nouvelleOptionNiveau2.setAttribute('value', 'confirmé');
				niveau2= document.createTextNode('Confirmé');
				nouvelleOptionNiveau2.appendChild(niveau2);
				
				// Ajout des options à l'élément select
				nouveauSelectNiveau.appendChild(nouvelleOptionNiveau);
				nouveauSelectNiveau.appendChild(nouvelleOptionNiveau1);
				nouveauSelectNiveau.appendChild(nouvelleOptionNiveau2);
				
				// Ajout de l'élément select à la liste
				niveau.appendChild(nouveauSelectNiveau);
					
				}
				
				
				if(tab[i].value=="formation 4"){
				document.getElementById('niveaux').innerHTML="";
				}
				
				if(tab[i].value=="formation 5"){
				document.getElementById('niveaux').innerHTML="";
				}
				
				
				if(tab[i].value=="formation 6"){
				
				document.getElementById('niveaux').innerHTML="Votre niveau : ";
			
				//Récupération des éléments de la liste
				niveau= document.getElementById('niveaux');
				
				//Création d'un nouvel élément select avec ses attributs
				nouveauSelectNiveau= document.createElement('select');
				nouveauSelectNiveau.setAttribute('name', 'niveau');
				nouveauSelectNiveau.setAttribute('id', 'niveau');

				
				//Création des nouvelles options pour l'élément select 
				
				//Débutant
				nouvelleOptionNiveau= document.createElement('option');
				nouvelleOptionNiveau.setAttribute('value', 'débutant');
				nouvelleOptionNiveau.setAttribute('selected', 'selected');
				niveauDebutant= document.createTextNode('Débutant');
				nouvelleOptionNiveau.appendChild(niveauDebutant);
				
				//Initié
				nouvelleOptionNiveau1= document.createElement('option');
				nouvelleOptionNiveau1.setAttribute('value', 'initié');
				niveau1= document.createTextNode('Initié');
				nouvelleOptionNiveau1.appendChild(niveau1);
				
				// Confirmé
				nouvelleOptionNiveau2= document.createElement('option');
				nouvelleOptionNiveau2.setAttribute('value', 'confirmé');
				niveau2= document.createTextNode('Confirmé');
				nouvelleOptionNiveau2.appendChild(niveau2);
				
				// Ajout des options à l'élément select
				nouveauSelectNiveau.appendChild(nouvelleOptionNiveau);
				nouveauSelectNiveau.appendChild(nouvelleOptionNiveau1);
				nouveauSelectNiveau.appendChild(nouvelleOptionNiveau2);
				
				// Ajout de l'élément select à la liste
				niveau.appendChild(nouveauSelectNiveau);
					
				}
				
				
				//alert(tab[i].value);	
				valeur=tab[i].value;
			}
		}
}
