function modifOrganismeProfesseurEtape1(obj,pk_organisme) {
	if(obj.checked) {
		location.href='inscription.php?pageRequested=professeurEtape1&ajouter_organisme='+pk_organisme;
	} else {
		location.href='inscription.php?pageRequested=professeurEtape1&supprimer_organisme='+pk_organisme;
	}
}

function copier_adresse_formFamilleEtape2() {
	document.formFamilleEtape2.complement_adresse_payeur.value=document.formFamilleEtape2.complement_adresse_etudiant.value;
	document.formFamilleEtape2.num_voie_payeur.value=document.formFamilleEtape2.num_voie_etudiant.value;
	document.formFamilleEtape2.complement_num_voie_payeur.value=document.formFamilleEtape2.complement_num_voie_etudiant.value;
	document.formFamilleEtape2.nature_voie_payeur.value=document.formFamilleEtape2.nature_voie_etudiant.value;
	document.formFamilleEtape2.nom_voie_payeur.value=document.formFamilleEtape2.nom_voie_etudiant.value;
	document.formFamilleEtape2.code_postal_payeur.value=document.formFamilleEtape2.code_postal_etudiant.value;
	document.formFamilleEtape2.ville_payeur.value=document.formFamilleEtape2.ville_etudiant.value;
}

function afficher_cursus_matiere(obj) {
	if(obj.checked) {
		document.getElementById('afficher_'+obj.value).style.display='block';
	} else {
		document.getElementById('afficher_'+obj.value).style.display='none';
	}
}

function limite(zone,max) {
	if(zone.value.length>=max){zone.value=zone.value.substring(0,max);}
}


function validationFormFamilleEtape1() {
	one_pk_type_pack_selected = false;
	i=0;
	while( document.getElementById('pk_type_pack'+i) != null ) {
		if(document.getElementById('pk_type_pack'+i).value != -1) {
			one_pk_type_pack_selected = true;
		}
		i++;
	}
	if( ! one_pk_type_pack_selected && document.formFamilleEtape1.code_type_pack_special.value=="" ) {
		alert("Veuillez sélectionner au moins un pack");
		return 0;
	} else if ( document.formFamilleEtape1.code_type_pack_special.value!="" && one_pk_type_pack_selected ) {
		alert("Ne sélectionnez pas de pack si vous avez un code pack spécial");
		return 0;
	}
	if ( document.formFamilleEtape1.frequence_cours.value=="" ) {
		alert("Veuillez entrer une fréquence pour vos cours");
		return 0;
	}
	if ( ! isDateValid(document.formFamilleEtape1.date_debut_cours.value) ) {
		alert("Veuillez entrer une date de début pour vos cours valide");
		return 0;
	}
	document.formFamilleEtape1.submit();
}

function validationFormFamilleEtape2() {
	if(document.formFamilleEtape2.etudiant_logged.value == "0") {	
		if (document.formFamilleEtape2.login_etudiant.value == "") {
			alert("Veuillez saisir le login de l'étudiant.");
			return 0;
		}
		if (document.formFamilleEtape2.mdp_etudiant.value == "") {
			alert("Veuillez saisir le mot de passe de l'étudiant.");
			return 0;
		}
		if (document.formFamilleEtape2.etudiant_existing[1].checked == true) {
			if (document.formFamilleEtape2.nom_etudiant.value == "") {
				alert("Veuillez saisir le nom de l'étudiant.");
				return 0;
			}
			if (document.formFamilleEtape2.prenom_etudiant.value == "") {
				alert("Veuillez saisir le prénom de l'étudiant.");
				return 0;
			}
			pk_cursus_etudiant_checked = false;
			pk_cursus_etudiant_index = 0;
			for(i=0;i<document.getElementsByName('pk_cursus_etudiant').length;i++) {
				if(document.getElementsByName('pk_cursus_etudiant')[i].checked) {
					pk_cursus_etudiant_checked = true;
					pk_cursus_etudiant_index = i;
				}
			}
			if( ! pk_cursus_etudiant_checked ) {
				alert("Veuillez sélectionner un cursus.");
				return 0;
			}
			if (document.getElementsByName('pk_cursus_etudiant')[pk_cursus_etudiant_index].value == 1 && document.formFamilleEtape2.libelle_cursus_etudiant.value == "") {
				alert("Veuillez précisez votre cursus.");
				return 0;
			}
			if (document.formFamilleEtape2.etablissement_etudiant.value == "") {
				alert("Veuillez entrer votre établissement.");
				return 0;
			}
			if ( ! isDateValid(document.formFamilleEtape2.date_naissance_etudiant.value) ) {
				alert("Date de naissance de l'étudiant incorrect.");
				return 0;
			}
			if ( ! isEmailValid(document.formFamilleEtape2.email_etudiant.value) ) {
				alert("Email de l'étudiant incorrect.");
				return 0;
			}
			/* if (document.formFamilleEtape2.complement_adresse_etudiant.value == "") {
				alert("Veuillez saisir l'adresse de l'étudiant.");
				return 0;
			} */
			/* if (document.formFamilleEtape2.adresse_etudiant.value == "") {
				alert("Veuillez saisir l'adresse de l'étudiant.");
				return 0;
			} */
			if (document.formFamilleEtape2.num_voie_etudiant.value == "") {
				alert("Veuillez saisir l'adresse de l'étudiant.");
				return 0;
			}
			if (document.formFamilleEtape2.nature_voie_etudiant.value == "-1") {
				alert("Veuillez saisir l'adresse de l'étudiant.");
				return 0;
			}
			if (document.formFamilleEtape2.nom_voie_etudiant.value == "") {
				alert("Veuillez saisir l'adresse de l'étudiant.");
				return 0;
			}
			if ( ! isCPValid(document.formFamilleEtape2.code_postal_etudiant.value) ) {
				alert("Code postal de l'étudiant incorrect.");
				return 0;
			}
			if (document.formFamilleEtape2.ville_etudiant.value == "") {
				alert("Veuillez saisir la ville de l'étudiant.");
				return 0;
			}
			if (! isTelMobileValid(document.formFamilleEtape2.tel_mobile_etudiant.value)) {
				alert("Numéro de téléphone mobile de l'étudiant incorrect.");
				return 0;
			}
			if (document.formFamilleEtape2.tel_fixe_etudiant.value != "" &&! isTelFixeValid(document.formFamilleEtape2.tel_fixe_etudiant.value)) {
				alert("Numéro de téléphone fixe de l'étudiant incorrect.");
				return 0;
			}
			pk_origine_client_checked = false;	
			for(i=0;i<document.getElementsByName('pk_origine_client[]').length;i++) {
				if(document.getElementsByName('pk_origine_client[]')[i].checked) {
					pk_origine_client_checked = true;			
				}
			}
			if ( ! pk_origine_client_checked ) {
				alert("Veuillez cocher au moins une case en réponse à la question : 'Comment nous avez-vous connu ?'.");
				return 0;
			}
		}
	}
	if(document.formFamilleEtape2.payeur_logged.value == "0") {
		if (document.formFamilleEtape2.login_payeur.value == "") {
			alert("Veuillez saisir le login du payeur.");
			return 0;
		}
		if (document.formFamilleEtape2.mdp_payeur.value == "") {
			alert("Veuillez saisir le mot de passe du payeur.");
			return 0;
		}
		if (document.formFamilleEtape2.payeur_existing[1].checked == true) {
			if (document.formFamilleEtape2.nom_payeur.value == "") {
				alert("Veuillez saisir le nom du payeur.");
				return 0;
			}
			if (document.formFamilleEtape2.prenom_payeur.value == "") {
				alert("Veuillez saisir le prénom du payeur.");
				return 0;
			}
			if ( ! isDateValid(document.formFamilleEtape2.date_naissance_payeur.value) ) {
				alert("Date de naissance du payeur incorrect.");
				return 0;
			}
			if ( ! isEmailValid(document.formFamilleEtape2.email_payeur.value) ) {
				alert("Email du payeur incorrect.");
				return 0;
			}
			if (document.formFamilleEtape2.num_voie_payeur.value == "") {
				alert("Veuillez saisir l'adresse du payeur.");
				return 0;
			}
			if (document.formFamilleEtape2.nature_voie_payeur.value == "-1") {
				alert("Veuillez saisir l'adresse du payeur.");
				return 0;
			}
			if (document.formFamilleEtape2.nom_voie_payeur.value == "") {
				alert("Veuillez saisir l'adresse du payeur.");
				return 0;
			}
			if ( ! isCPValid(document.formFamilleEtape2.code_postal_payeur.value) ) {
				alert("Code postal du payeur incorrect.");
				return 0;
			}
			if (document.formFamilleEtape2.ville_payeur.value == "") {
				alert("Veuillez saisir la ville du payeur.");
				return 0;
			}
			if (! isTelMobileValid(document.formFamilleEtape2.tel_mobile_payeur.value)) {
				alert("Numéro de téléphone mobile du payeur incorrect.");
				return 0;
			}
			if (document.formFamilleEtape2.tel_fixe_payeur.value != "" &&! isTelFixeValid(document.formFamilleEtape2.tel_fixe_payeur.value)) {
				alert("Numéro de téléphone fixe du payeur incorrect.");
				return 0;
			}
		}
	}
	document.formFamilleEtape2.submit();
}

function validationFormFamilleEtape3() {	
	/*if (navigator.appName == "Microsoft Internet Explorer"){
		if(document.getElementById('cgsObject').scrollTop<1377){
			alert("Veuillez parcourir l'intégralité des conditions générales de service.");
			return 0;
		}
		if(document.getElementById('mandatProfObject').scrollTop<1028){
			alert("Veuillez parcourir l'intégralité du mandat de recherche de professeur.");
			return 0;
		}
		if(document.getElementById('mandatUrssafObject').scrollTop<358){
			alert("Veuillez parcourir l'intégralité du mandat de télétransmission Urssaf.");
			return 0;
		}
	} else if (navigator.appName == "Netscape"){		
		if(document.getElementById('cgsObject').scrollTop<1490){
			alert("Veuillez parcourir l'intégralité des conditions générales de service.");
			return 0;
		}
		if(document.getElementById('mandatProfObject').scrollTop<1130){
			alert("Veuillez parcourir l'intégralité du mandat de recherche de professeur.");
			return 0;
		}
		if(document.getElementById('mandatUrssafObject').scrollTop<538){
			alert("Veuillez parcourir l'intégralité du mandat de télétransmission Urssaf.");
			return 0;
		}
	} else {
		if(document.getElementById('cgsObject').scrollTop<1000){
			alert("Veuillez parcourir l'intégralité des conditions générales de service.");
			return 0;
		}
		if(document.getElementById('mandatProfObject').scrollTop<1000){
			alert("Veuillez parcourir l'intégralité du mandat de recherche de professeur.");
			return 0;
		}
		if(document.getElementById('mandatUrssafObject').scrollTop<200){
			alert("Veuillez parcourir l'intégralité du mandat de télétransmission Urssaf.");
			return 0;
		}
	}*/
	if( ! document.formFamilleEtape3.conGen.checked ||  document.getElementById('cgsObject').scrollTop==0) {
		alert("Veuillez prendre connaissance des conditions générales de service, puis cocher la case correspondante.");
		return 0;
	} else if( ! document.formFamilleEtape3.mandatProf.checked || document.getElementById('mandatProfObject').scrollTop==0) {
		alert("Veuillez prendre connaissance du mandat de recherche de professeur, puis cocher la case correspondante.");
		return 0;
	} else if( ! document.formFamilleEtape3.mandatUrssaf.checked || document.getElementById('mandatUrssafObject').scrollTop==0) {
		alert("Veuillez prendre connaissance du mandat de télétransmission Urssaf, puis cocher la case correspondante.");
		return 0;
	}
	document.formFamilleEtape3.submit();
}

function set_unset_acces_intranet(){
	if(document.getElementById && document.getElementById('acces_intranet') != null && document.getElementById('acces_intranet2') != null){
		if(!document.form_acces_intranet.acces_intranet_accept.checked){
			document.getElementById('acces_intranet').style.visibility="hidden";
			document.getElementById('acces_intranet').style.display="none";
			document.getElementById('acces_intranet2').style.visibility="hidden";
			document.getElementById('acces_intranet2').style.display="none";
			document.form_acces_intranet.acces_intranet_check.value="false";
		}
		else{
			document.getElementById('acces_intranet').style.visibility="visible";
			document.getElementById('acces_intranet').style.display="block";
			document.getElementById('acces_intranet2').style.visibility="visible";
			document.getElementById('acces_intranet2').style.display="block";
			document.form_acces_intranet.acces_intranet_check.value="true";
		}
	}
	document.form_acces_intranet.submit();
	//alert("fonction executée");
}

function check_intranet(){
	if(document.form_acces_intranet.acces_intranet_accept.checked){
		document.getElementById('acces_intranet').style.visibility="visible";
		document.getElementById('acces_intranet').style.display="block";
		document.getElementById('acces_intranet2').style.visibility="visible";
		document.getElementById('acces_intranet2').style.display="block";
	}
	else{
		document.getElementById('acces_intranet').style.visibility="hidden";
		document.getElementById('acces_intranet').style.display="none";
		document.getElementById('acces_intranet2').style.visibility="hidden";
		document.getElementById('acces_intranet2').style.display="none";
	}
}

function validationFormFamilleEtape4() {
	var modePaiement = document.form1.typePaiement;
	var url = document.location.href.split("?");
	var paiementSelect = false;
	for(i=0;i<modePaiement.length;i++) {
		if(modePaiement[i].checked) {
			paiementSelect = true;
			switch(modePaiement[i].value) {
				case 'cb': document.form1.submit(); break;
				case 'cheque': document.location.href=url[0]+'?pageRequested=familleEtape5&pageFrom=familleEtape4&typePaiement=cheque&dirRequested=inscription'; break;
				case 'cesu' : document.location.href=url[0]+'?pageRequested=familleEtape5&pageFrom=familleEtape4&typePaiement=cesu&dirRequested=inscription'; break;
				case 'prelevement' : document.location.href=url[0]+'?pageRequested=familleEtape5&pageFrom=familleEtape4&etape=0&typePaiement=prelevement&dirRequested=inscription'; break;
				case 'especes' : document.location.href=url[0]+'?pageRequested=familleEtape5&pageFrom=familleEtape4&typePaiement=especes&dirRequested=inscription'; break;
				default: alert('Veuillez saisir un mode de paiement !'); break;
			}
		}
	}
	if(!paiementSelect)
		alert('Veuillez saisir un mode de paiement !');
}

function multiPaie() {
	var modePaiement = document.form1.typePaiement;
	for(i=0;i<modePaiement.length;i++) {
		if(modePaiement[i].checked) {
			if(modePaiement[i].value == "cb")
			{
				document.getElementById("selectNbrPrev").style.display="inline";
			}
			else
				document.getElementById("selectNbrPrev").style.display="none";
		}
	}
}

function validationFormFamilleEtape5() {
	if(isNaN(parseInt(document.formFamilleEtape5.code_banque.value)) || document.formFamilleEtape5.code_banque.value.length != 5) {
		alert("Code banque incorrect. Veuillez entrer 5 chiffres.");
		return 0;
	}
	if(isNaN(parseInt(document.formFamilleEtape5.code_guichet.value)) || document.formFamilleEtape5.code_guichet.value.length != 5) {
		alert("Code guichet incorrect. Veuillez entrer 5 chiffres.");
		return 0;
	}
	if(document.formFamilleEtape5.num_compte.value.length != 11) {
		alert("Numéro de compte incorrect. Veuillez entrer 11 caractères.");
		return 0;
	}
	if(isNaN(parseInt(document.formFamilleEtape5.cle.value)) || document.formFamilleEtape5.cle.value.length != 2) {
		alert("Clé RIB incorrecte. Veuillez entrer 2 chiffres.");
		return 0;
	}
	if(document.formFamilleEtape5.nom_banque.value == "") {
		alert("Veuillez saisir le nom de votre banque.");
		return 0;
	}
	if(document.formFamilleEtape5.adresse_banque.value == "") {
		alert("Veuillez saisir l'adresse de votre banque.");
		return 0;
	}
	if( ! isCPValid(document.formFamilleEtape5.code_postal_banque.value) ) {
		alert("Code postal incorrect. Veuillez entrer 5 chiffres.");
		return 0;
	}
	if(document.formFamilleEtape5.ville_banque.value == "") {
		alert("Veuillez saisir la ville de votre banque.");
		return 0;
	}
	document.formFamilleEtape5.submit();
}

function validationFormProfesseurEtape1() {
	if (document.formProfesseurEtape1.etablissement_professeur.value == "") {
		alert("Veuillez saisir un établissement.");
		return 0;
	}
	if (document.formProfesseurEtape1.pk_cursus_professeur.value == -1) {
		alert("Veuillez choisir votre cursus.");
		return 0;
	}
	if (document.formProfesseurEtape1.commentaires_professeur.value == "") {
		alert("Veuillez remplir les commentaires requis.");
		return 0;
	}
	document.formProfesseurEtape1.submit();
}

function validationFormProfesseurEtape2() {
	if (document.formProfesseurEtape2.login_professeur.value == "") {
		alert("Veuillez saisir un login.");
		return 0;
	}
	if (document.formProfesseurEtape2.mdp_professeur.value == "") {
		alert("Veuillez saisir un mot de passe.");
		return 0;
	}
	if (document.formProfesseurEtape2.nom_professeur.value == "") {
		alert("Veuillez saisir le nom du professeur.");
		return 0;
	}
	if (document.formProfesseurEtape2.prenom_professeur.value == "") {
		alert("Veuillez saisir le prénom du professeur.");
		return 0;
	}
	if ( ! isDateValid(document.formProfesseurEtape2.date_naissance_professeur.value) ) {
		alert("Date de naissance du professeur incorrect.");
		return 0;
	}
	if (document.formProfesseurEtape2.nationalite_professeur.value == "") {
		alert("Veuillez saisir la nationalité du professeur.");
		return 0;
	}
	if ( ! isEmailValid(document.formProfesseurEtape2.email_professeur.value) ) {
		alert("Email du professeur incorrect.");
		return 0;
	}
	if (document.formProfesseurEtape2.num_voie_professeur.value == "") {
		alert("Veuillez saisir l'adresse du professeur.");
		return 0;
	}	
	if (document.formProfesseurEtape2.nature_voie_professeur.value == "-1") {
		alert("Veuillez saisir l'adresse du professeur.");
		return 0;
	}	
	if (document.formProfesseurEtape2.nom_voie_professeur.value == "") {
		alert("Veuillez saisir l'adresse du professeur.");
		return 0;
	}	
	if ( !document.formProfesseurEtape2.check_num_ss.checked &&  ! isCPValid(document.formProfesseurEtape2.code_postal_professeur.value) ) {
		alert("Code postal du professeur incorrect.");
		return 0;
	}
	if (document.formProfesseurEtape2.ville_professeur.value == "") {
		alert("Veuillez saisir la ville du professeur.");
		return 0;
	}
	if ( !document.formProfesseurEtape2.check_num_ss.checked && !isTelMobileValid(document.formProfesseurEtape2.tel_mobile_professeur.value) ) {
		alert("Numéro de téléphone mobile du professeur incorrect.");
		return 0;
	}	
	/* if ( !document.formProfesseurEtape2.check_num_ss.checked && !document.formProfesseurEtape2.tel_fixe_professeur.value!="" && ! isTelFixeValid(document.formProfesseurEtape2.tel_fixe_professeur.value)) {
		alert("Numéro de téléphone fixe du professeur incorrect.");
		return 0;
	} */
	if ( !document.formProfesseurEtape2.check_num_ss.checked && isNaN(document.formProfesseurEtape2.num_ss_professeur.value) ) {
		alert("Numéro de sécurité sociale incorrect.");
		return 0;
	}
	if(isNaN(parseInt(document.formProfesseurEtape2.code_banque.value)) || document.formProfesseurEtape2.code_banque.value.length != 5) {
		alert("Code banque incorrect. Veuillez entrer 5 chiffres.");
		return 0;
	}
	if(isNaN(parseInt(document.formProfesseurEtape2.code_guichet.value)) || document.formProfesseurEtape2.code_guichet.value.length != 5) {
		alert("Code guichet incorrect. Veuillez entrer 5 chiffres.");
		return 0;
	}
	if(document.formProfesseurEtape2.num_compte.value.length != 11) {
		alert("Numéro de compte incorrect. Veuillez entrer 11 caractères.");
		return 0;
	}
	if(isNaN(parseInt(document.formProfesseurEtape2.cle.value)) || document.formProfesseurEtape2.cle.value.length != 2) {
		alert("Clé RIB incorrecte. Veuillez entrer 2 chiffres.");
		return 0;
	}
	if(document.formProfesseurEtape2.dispo_lundi[2].checked) {
		if(document.formProfesseurEtape2.libelle_plageh_lundi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formProfesseurEtape2.dispo_mardi[2].checked) {
		if(document.formProfesseurEtape2.libelle_plageh_mardi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formProfesseurEtape2.dispo_mercredi[2].checked) {
		if(document.formProfesseurEtape2.libelle_plageh_mercredi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formProfesseurEtape2.dispo_jeudi[2].checked) {
		if(document.formProfesseurEtape2.libelle_plageh_jeudi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formProfesseurEtape2.dispo_vendredi[2].checked) {
		if(document.formProfesseurEtape2.libelle_plageh_vendredi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formProfesseurEtape2.dispo_samedi[2].checked) {
		if(document.formProfesseurEtape2.libelle_plageh_samedi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formProfesseurEtape2.dispo_dimanche[2].checked) {
		if(document.formProfesseurEtape2.libelle_plageh_dimanche.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	document.formProfesseurEtape2.submit();
}

function validationFormProfesseurEtape3() {
	/*if (navigator.appName == "Microsoft Internet Explorer"){
		if(document.getElementById('cgsObject').scrollTop<1860){
			alert("Veuillez parcourir l'intégralité des conditions générales de service.");
			return 0;
		}
		if(document.getElementById('mandatEleveObject').scrollTop<1487){
			alert("Veuillez parcourir l'intégralité du mandat de recherche d'un élève.");
			return 0;
		}
	} else if (navigator.appName == "Netscape"){
		if(document.getElementById('cgsObject').scrollTop<1936){
			alert("Veuillez parcourir l'intégralité des conditions générales de service.");
			return 0;
		}
		if(document.getElementById('mandatEleveObject').scrollTop<1595){
			alert("Veuillez parcourir l'intégralité du mandat de recherche d'un élève.");
			return 0;
		}
	} else {
		if(document.getElementById('cgsObject').scrollTop<1500){
			alert("Veuillez parcourir l'intégralité des conditions générales de service.");
			return 0;
		}
		if(document.getElementById('mandatEleveObject').scrollTop<1000){
			alert("Veuillez parcourir l'intégralité du mandat de recherche d'un élève.");
			return 0;
		}		
	}*/
	if( ! document.formProfesseurEtape3.mandatEleve.checked) {
		alert("Veuillez prendre connaissance du document, puis cocher la case correspondante.");
		return 0;
	}
	document.formProfesseurEtape3.submit();
}

function validationFormModifCompteEtudiant() {	
	pk_cursus_etudiant_checked = false;
	pk_cursus_etudiant_index = 0;
	for(i=0;i<document.getElementsByName('pk_cursus_etudiant').length;i++) {
		if(document.getElementsByName('pk_cursus_etudiant')[i].checked) {
			pk_cursus_etudiant_checked = true;
			pk_cursus_etudiant_index = i;
		}
	}
	if( ! pk_cursus_etudiant_checked ) {
		alert("Veuillez sélectionner un cursus.");
		return 0;
	}
	if (document.getElementsByName('pk_cursus_etudiant')[pk_cursus_etudiant_index].value == 1 && document.formModifCompteEtudiant.libelle_cursus_etudiant.value == "") {
		alert("Veuillez précisez votre cursus.");
		return 0;
	}
	if (document.formModifCompteEtudiant.etablissement_etudiant.value == "") {
		alert("Veuillez entrer votre établissement.");
		return 0;
	}
	if ( ! isEmailValid(document.formModifCompteEtudiant.email_etudiant.value) ) {
		alert("Email de l'étudiant incorrect.");
		return 0;
	}
	/* if (document.formModifCompteEtudiant.complement_adresse_etudiant.value == "") {
		alert("Veuillez saisir l'adresse de l'étudiant.");
		return 0;
	} */
	if (document.formModifCompteEtudiant.num_voie_etudiant.value == "") {
		alert("Veuillez saisir l'adresse de l'étudiant.");
		return 0;
	}
	if (document.formModifCompteEtudiant.nature_voie_etudiant.value == "-1") {
		alert("Veuillez saisir l'adresse de l'étudiant.");
		return 0;
	}
	if (document.formModifCompteEtudiant.nom_voie_etudiant.value == "") {
		alert("Veuillez saisir l'adresse de l'étudiant.");
		return 0;
	}
	if ( ! isCPValid(document.formModifCompteEtudiant.code_postal_etudiant.value) ) {
		alert("Code postal de l'étudiant incorrect.");
		return 0;
	}
	if (document.formModifCompteEtudiant.ville_etudiant.value == "") {
		alert("Veuillez saisir la ville de l'étudiant.");
		return 0;
	}
	if (! isTelMobileValid(document.formModifCompteEtudiant.tel_mobile_etudiant.value)) {
		alert("Numéro de téléphone mobile de l'étudiant incorrect.");
		return 0;
	}
	if (document.formModifCompteEtudiant.tel_fixe_etudiant.value != "" && ! isTelFixeValid(document.formModifCompteEtudiant.tel_fixe_etudiant.value)) {
		alert("Numéro de téléphone fixe de l'étudiant incorrect.");
		return 0;
	}
	document.formModifCompteEtudiant.submit();
}

function validationFormModifComptePayeur() {	
	if ( ! isEmailValid(document.formModifComptePayeur.email_payeur.value) ) {
		alert("Email du payeur incorrect.");
		return 0;
	}
	/* if (document.formModifComptePayeur.complement_adresse_payeur.value == "") {
		alert("Veuillez saisir l'adresse du payeur.");
		return 0;
	} */
	if (document.formModifComptePayeur.num_voie_payeur.value == "") {
		alert("Veuillez saisir l'adresse du payeur.");
		return 0;
	}
	if (document.formModifComptePayeur.nature_voie_payeur.value == "-1") {
		alert("Veuillez saisir l'adresse du payeur.");
		return 0;
	}
	if (document.formModifComptePayeur.nom_voie_payeur.value == "") {
		alert("Veuillez saisir l'adresse du payeur.");
		return 0;
	}
	if ( ! isCPValid(document.formModifComptePayeur.code_postal_payeur.value) ) {
		alert("Code postal du payeur incorrect.");
		return 0;
	}
	if (document.formModifComptePayeur.ville_payeur.value == "") {
		alert("Veuillez saisir la ville du payeur.");
		return 0;
	}
	if (! isTelMobileValid(document.formModifComptePayeur.tel_mobile_payeur.value)) {
		alert("Numéro de téléphone mobile du payeur incorrect.");
		return 0;
	}
	if (document.formModifComptePayeur.tel_fixe_payeur.value != "" && ! isTelFixeValid(document.formModifComptePayeur.tel_fixe_payeur.value)) {
		alert("Numéro de téléphone fixe du payeur incorrect.");
		return 0;
	}
	document.formModifComptePayeur.submit();
}

function validationFormModifCompteProfesseur() {	
	if (document.formModifCompteProfesseur.etablissement_professeur.value == "") {
		alert("Veuillez saisir un établissement.");
		return 0;
	}
	if (document.formModifCompteProfesseur.pk_cursus_professeur.value == -1) {
		alert("Veuillez choisir votre cursus.");
		return 0;
	}
	if ( ! isEmailValid(document.formModifCompteProfesseur.email_professeur.value) ) {
		alert("Email du professeur incorrect.");
		return 0;
	}
	if (document.formModifCompteProfesseur.num_voie_professeur.value == "") {
		alert("Veuillez saisir l'adresse du professeur.");
		return 0;
	}
	if (document.formModifCompteProfesseur.nature_voie_professeur.value == "-1") {
		alert("Veuillez saisir l'adresse du professeur.");
		return 0;
	}
	if (document.formModifCompteProfesseur.nom_voie_professeur.value == "") {
		alert("Veuillez saisir l'adresse du professeur.");
		return 0;
	}
	if ( ! isCPValid(document.formModifCompteProfesseur.code_postal_professeur.value) ) {
		alert("Code postal du professeur incorrect.");
		return 0;
	}
	if (document.formModifCompteProfesseur.ville_professeur.value == "") {
		alert("Veuillez saisir la ville du professeur.");
		return 0;
	}
	if (! isTelMobileValid(document.formModifCompteProfesseur.tel_mobile_professeur.value)) {
		alert("Numéro de téléphone mobile du professeur incorrect.");
		return 0;
	}
	if (document.formModifCompteProfesseur.tel_fixe_professeur.value != "" && ! isTelFixeValid(document.formModifCompteProfesseur.tel_fixe_professeur.value)) {
		alert("Numéro de téléphone fixe du professeur incorrect.");
		return 0;
	}
	if(isNaN(parseInt(document.formModifCompteProfesseur.code_banque.value)) || document.formModifCompteProfesseur.code_banque.value.length != 5) {
		alert("Code banque incorrect. Veuillez entrer 5 chiffres.");
		return 0;
	}
	if(isNaN(parseInt(document.formModifCompteProfesseur.code_guichet.value)) || document.formModifCompteProfesseur.code_guichet.value.length != 5) {
		alert("Code guichet incorrect. Veuillez entrer 5 chiffres.");
		return 0;
	}
	if(document.formModifCompteProfesseur.num_compte.value.length != 11) {
		alert("Numéro de compte incorrect. Veuillez entrer 11 caractères.");
		return 0;
	}
	if(isNaN(parseInt(document.formModifCompteProfesseur.cle.value)) || document.formModifCompteProfesseur.cle.value.length != 2) {
		alert("Clé RIB incorrecte. Veuillez entrer 2 chiffres.");
		return 0;
	}
	if(document.formModifCompteProfesseur.dispo_lundi[2].checked) {
		if(document.formModifCompteProfesseur.libelle_plageh_lundi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formModifCompteProfesseur.dispo_mardi[2].checked) {
		if(document.formModifCompteProfesseur.libelle_plageh_mardi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formModifCompteProfesseur.dispo_mercredi[2].checked) {
		if(document.formModifCompteProfesseur.libelle_plageh_mercredi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formModifCompteProfesseur.dispo_jeudi[2].checked) {
		if(document.formModifCompteProfesseur.libelle_plageh_jeudi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formModifCompteProfesseur.dispo_vendredi[2].checked) {
		if(document.formModifCompteProfesseur.libelle_plageh_vendredi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formModifCompteProfesseur.dispo_samedi[2].checked) {
		if(document.formModifCompteProfesseur.libelle_plageh_samedi.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	if(document.formModifCompteProfesseur.dispo_dimanche[2].checked) {
		if(document.formModifCompteProfesseur.libelle_plageh_dimanche.value == "-1") {
			alert("Vous devez indiquer une heure de début !");
			return 0;
		}
	}
	document.formModifCompteProfesseur.submit();
}

function validationFormParrainage() {	
	if (document.formParrainage.nom_filleul.value == "") {
		alert("Veuillez saisir le nom du filleul.");
		return 0;
	}
	if (document.formParrainage.prenom_filleul.value == "") {
		alert("Veuillez saisir le prénom du filleul.");
		return 0;
	}
	if (!isTelMobileValid(document.formParrainage.tel_mobile_filleul.value)) {
		alert("Numéro de portable du filleul incorrect.");
		return 0;
	}
	if (!isEmailValid(document.formParrainage.email_filleul.value)) {
		alert("Email du filleul incorrect.");
		return 0;
	}
	document.formParrainage.submit();
}

function isEmailValid(email) {
	apos=email.indexOf("@");
	dotpos=email.lastIndexOf(".");
	if (apos<1||dotpos-apos<2) return false;
	else return true;
}

function isCPValid(cp) {
	if (cp.length != 5 || isNaN(cp)) return false
	else return true;
}

function isTelFixeValid(tel_fixe) {
	var regex = new RegExp(/^(01|02|03|04|05|08|09)[0-9]{8}/gi);
	if (regex.test(tel_fixe)) return true;
	else return false;
}

function isTelMobileValid(tel_mobile) {
	var regex = new RegExp(/^(06|07)[0-9]{8}/gi);
	if (regex.test(tel_mobile)) return true;
	else return false;
}

function isDateValid(chaineDate) {
   if (chaineDate == "") return false;
   var ladate = (chaineDate).split("/");
   if ((ladate.length != 3) || isNaN(parseInt(ladate[0])) || isNaN(parseInt(ladate[1])) || isNaN(parseInt(ladate[2]))) return false;
   var unedate = new Date(eval(ladate[2]),eval(ladate[1])-1,eval(ladate[0]));
   var annee = unedate.getYear();
   if ((Math.abs(annee)+"").length < 4) annee = annee + 1900;   
   return ((unedate.getDate() == eval(ladate[0])) && (unedate.getMonth() == eval(ladate[1])-1) && (annee == eval(ladate[2])))
}

function validationFormEnvoyerMessage() {
	if (document.getElementById('type_destinataire').value!="ADMIN" && document.getElementById('pk_destinataire').value=="-1") {
		alert("Veuillez choisir un destinataire.");
		return 0;
	}
	if (document.formEnvoyerMessage.objet.value=="") {
		alert("Entrez un objet au message.");
		return 0;
	}
	if (document.formEnvoyerMessage.message.value=="") {
		alert("Message vide.");
		return 0;
	}
	document.formEnvoyerMessage.submit();	
}

var s=['dimanche','lundi','mardi','mercredi','jeudi','vendredi','samedi'];
var moi=['janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre'];

var aff, aff1, aff2, an, mois, jour, boucle, mo, d1, it, sem;
var today=new Date();
var a=today.getUTCFullYear();
var today2=Date.UTC(a,today.getUTCMonth(),today.getUTCDate());// date du jour en temps universel

function calendrier(){

if(a>=1970 && a<=2030){
   document.getElementById("af3").firstChild.data=a
}
else{
   alert("année invalide");document.getElementById("choix").value="";return false;
};

document.getElementById("af1").style.marginLeft=(screen.availWidth - 612) /2;
document.getElementById("af2").style.marginLeft=(screen.availWidth - 612) /2;
while(document.getElementById("af1").lastChild){
document.getElementById("af1").removeChild(document.getElementById("af1").lastChild)
};
while(document.getElementById("af2").lastChild){
document.getElementById("af2").removeChild(document.getElementById("af2").lastChild)
};

for(k=0;k!=12;k++){// chaque mois
   sem=0;
   mois=document.createElement("div");mois.className="mois";
   mo=document.createElement("h1");mo.appendChild(document.createTextNode(moi[k]));
   mois.appendChild(mo);

   d1=Date.UTC(a,k,1);

   for(i=0;i!=31;i++){// chaque jour
      it=document.createElement("div");it.style.backgroundColor="gray";it.style.width="100px";
      boucle=new Date(d1+1000*3600*24*i);
      if(Date.parse(boucle)==today2){it.style.backgroundColor="#ffff00"};

      it.prop=s[boucle.getUTCDay()]+" "+boucle.getUTCDate()+" "+moi[k]+" "+a;
      it.bckg=it.style.backgroundColor;

      if(boucle.getUTCMonth()==k){
         jour=document.createTextNode(s[boucle.getUTCDay()].substring(0,3)+' '+boucle.getUTCDate());
         it.onmouseover=function(){this.style.backgroundColor="#ffffff";this.title=this.prop};
         it.onmouseout=function(){this.style.backgroundColor=this.bckg};
      }
      else {
         it.style.color="gray";jour=document.createTextNode(".")
      };

      it.appendChild(jour);
      if(it.firstChild.data.substring(0,3)=="dim"){sem++;it.style.borderBottom="2px solid #ffff00"};
      mois.appendChild(it);

   };
   if(sem==4){
      plus=document.createElement("div");
      plus.style.cssText="font-size:0px;background-color:gray;height:2px;width:100px";
      mois.appendChild(plus);
   };
   if(k<6){document.getElementById("af1").appendChild(mois)}else{document.getElementById("af2").appendChild(mois)}
}

}

function checkConnexion() {
	if(document.connexion.type.value == "0") {
		alert("Veuillez sélectionner un type d'utilisateur !");
		return false;
	}
	if(document.connexion.login.value == "" || document.connexion.login.value == "Identifiant") {
		alert("Veuillez saisir votre login !");
		return false;
	}
	if(document.connexion.login.mdp == "" || document.connexion.login.mdp == "Mot de passe") {
		alert("Veuillez saisir votre mot de passe !");
		return false;
	}
	document.connexion.submit();
}

function verif(node) {
	if(node.value.length > 1)
		document.getElementById("img_" + node.id).src = "images/general/OkSmall.png";
	else
		document.getElementById("img_" + node.id).src = "images/general/NoSmall.png";
}

function verifChampRempli() {
	try {
		verifChampRempliFam();
	} catch(prof) {
		verifChampRempliProf();
	}
}

function verifChampRempliFam() {
	if(document.getElementById("frequence_cours") != null)
	{		if(document.getElementById("img_frequence_cours") != null) {
			if(document.getElementById("frequence_cours").value.length > 1)
				document.getElementById("img_frequence_cours").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_frequence_cours").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_date_debut_cours") != null) {
			if(document.getElementById("date_debut_cours").value.length > 1)
				document.getElementById("img_date_debut_cours").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_date_debut_cours").src = "images/general/NoSmall.png";		}
	}
	else if(document.getElementById("login_etudiant") != null)
	{		if(document.getElementById("img_login_etudiant") != null) {
			if(document.getElementById("login_etudiant").value.length > 1)
				document.getElementById("img_login_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_login_etudiant").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_email_etudiant") != null) {
			if(document.getElementById("email_etudiant") != null && document.getElementById("email_etudiant").value.length > 1)
				document.getElementById("img_email_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_email_etudiant").src = "images/general/NoSmall.png";		}
				if(document.getElementById("img_email_etudiant2") != null) {
			if(document.getElementById("email_etudiant2").value.length > 1)
				document.getElementById("img_email_etudiant2").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_email_etudiant2").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_mdp_etudiant") != null) {
			if(document.getElementById("mdp_etudiant") != null && document.getElementById("mdp_etudiant").value.length > 1)
				document.getElementById("img_mdp_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_mdp_etudiant").src = "images/general/NoSmall.png";		}
				if(document.getElementById("img_mdp_etudiant2") != null) {
			if(document.getElementById("mdp_etudiant2") != null && document.getElementById("mdp_etudiant2").value.length > 1)
				document.getElementById("img_mdp_etudiant2").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_mdp_etudiant2").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_nom_etudiant") != null) {
			if(document.getElementById("nom_etudiant") != null && document.getElementById("nom_etudiant").value.length > 1)
				document.getElementById("img_nom_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_nom_etudiant").src = "images/general/NoSmall.png";		}
				if(document.getElementById("img_prenom_etudiant") != null) {
			if(document.getElementById("prenom_etudiant") != null && document.getElementById("prenom_etudiant").value.length > 1)
				document.getElementById("img_prenom_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_prenom_etudiant").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_etablissement_etudiant") != null) {
			if(document.getElementById("etablissement_etudiant") != null && document.getElementById("etablissement_etudiant").value.length > 1)
				document.getElementById("img_etablissement_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_etablissement_etudiant").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_date_naissance_etudiant") != null) {
			if(document.getElementById("date_naissance_etudiant") != null && document.getElementById("date_naissance_etudiant").value.length > 1)
				document.getElementById("img_date_naissance_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_date_naissance_etudiant").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_num_voie_etudiant") != null) {
			if(document.getElementById("num_voie_etudiant") != null && document.getElementById("num_voie_etudiant").value.length > 1)
				document.getElementById("img_num_voie_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_num_voie_etudiant").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_nom_voie_etudiant") != null) {
			if(document.getElementById("nom_voie_etudiant") != null && document.getElementById("nom_voie_etudiant").value.length > 1)
				document.getElementById("img_nom_voie_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_nom_voie_etudiant").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_code_postal_etudiant") != null) {
			if(document.getElementById("code_postal_etudiant") != null && document.getElementById("code_postal_etudiant").value.length > 1)
				document.getElementById("img_code_postal_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_code_postal_etudiant").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_ville_etudiant") != null) {
			if(document.getElementById("ville_etudiant") != null && document.getElementById("ville_etudiant").value.length > 1)
				document.getElementById("img_ville_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_ville_etudiant").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_tel_mobile_etudiant") != null) {
			if(document.getElementById("tel_mobile_etudiant") != null && document.getElementById("tel_mobile_etudiant").value.length > 1)
				document.getElementById("img_tel_mobile_etudiant").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_tel_mobile_etudiant").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_login_payeur") != null) {
			if(document.getElementById("login_payeur") != null && document.getElementById("login_payeur").value.length > 1)
				document.getElementById("img_login_payeur").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_login_payeur").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_email_payeur") != null) {
			if(document.getElementById("email_payeur") != null && document.getElementById("email_payeur").value.length > 1)
				document.getElementById("img_email_payeur").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_email_payeur").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_email_payeur2") != null) {
			if(document.getElementById("email_payeur2") != null && document.getElementById("email_payeur2").value.length > 1)
				document.getElementById("img_email_payeur2").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_email_payeur2").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_mdp_payeur") != null) {
			if(document.getElementById("mdp_payeur") != null && document.getElementById("mdp_payeur").value.length > 1)
				document.getElementById("img_mdp_payeur").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_mdp_payeur").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_mdp_payeur2") != null) {
			if(document.getElementById("mdp_payeur2") != null && document.getElementById("mdp_payeur2").value.length > 1)
				document.getElementById("img_mdp_payeur2").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_mdp_payeur2").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_nom_payeur") != null) {
			if(document.getElementById("nom_payeur") != null && document.getElementById("nom_payeur").value.length > 1)
				document.getElementById("img_nom_payeur").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_nom_payeur").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_prenom_payeur") != null) {
			if(document.getElementById("prenom_payeur") != null && document.getElementById("prenom_payeur").value.length > 1)
				document.getElementById("img_prenom_payeur").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_prenom_payeur").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_date_naissance_payeur") != null) {
			if(document.getElementById("date_naissance_payeur") != null && document.getElementById("date_naissance_payeur").value.length > 1)
				document.getElementById("img_date_naissance_payeur").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_date_naissance_payeur").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_num_voie_payeur") != null) {
			if(document.getElementById("num_voie_payeur") != null && document.getElementById("num_voie_payeur").value.length > 1)
				document.getElementById("img_num_voie_payeur").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_num_voie_payeur").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_nom_voie_payeur") != null) {
			if(document.getElementById("nom_voie_payeur") != null && document.getElementById("nom_voie_payeur").value.length > 1)
				document.getElementById("img_nom_voie_payeur").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_nom_voie_payeur").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_code_postal_payeur") != null) {
			if(document.getElementById("code_postal_payeur") != null && document.getElementById("code_postal_payeur").value.length > 1)
				document.getElementById("img_code_postal_payeur").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_code_postal_payeur").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_ville_payeur") != null) {
			if(document.getElementById("ville_payeur") != null && document.getElementById("ville_payeur").value.length > 1)
				document.getElementById("img_ville_payeur").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_ville_payeur").src = "images/general/NoSmall.png";
		}				if(document.getElementById("img_tel_mobile_payeur") != null) {
			if(document.getElementById("tel_mobile_payeur") != null && document.getElementById("tel_mobile_payeur").value.length > 1)
				document.getElementById("img_tel_mobile_payeur").src = "images/general/OkSmall.png";
			else
				document.getElementById("img_tel_mobile_payeur").src = "images/general/NoSmall.png";		}
	}
}

function verifChampRempliProf() {
	if(document.getElementById("etablissement_professeur") != null)
	{
		if(document.getElementById("etablissement_professeur").value.length > 1)
			document.getElementById("img_etablissement_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_etablissement_professeur").src = "images/general/NoSmall.png";
	}
	else if(document.getElementById("login_professeur") != null)
	{
		if(document.getElementById("login_professeur").value.length > 1)
			document.getElementById("img_login_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_login_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("mdp_professeur").value.length > 1)
			document.getElementById("img_mdp_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_mdp_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("mdp_professeur2").value.length > 1)
			document.getElementById("img_mdp_professeur2").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_mdp_professeur2").src = "images/general/NoSmall.png";
			
		if(document.getElementById("nom_professeur").value.length > 1)
			document.getElementById("img_nom_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_nom_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("prenom_professeur").value.length > 1)
			document.getElementById("img_prenom_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_prenom_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("date_naissance_professeur").value.length > 1)
			document.getElementById("img_date_naissance_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_date_naissance_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("nationalite_professeur").value.length > 1)
			document.getElementById("img_nationalite_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_nationalite_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("num_voie_professeur").value.length > 1)
			document.getElementById("img_num_voie_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_num_voie_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("nom_voie_professeur").value.length > 1)
			document.getElementById("img_nom_voie_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_nom_voie_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("code_postal_professeur").value.length > 1)
			document.getElementById("img_code_postal_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_code_postal_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("ville_professeur").value.length > 1)
			document.getElementById("img_ville_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_ville_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("tel_mobile_professeur").value.length > 1)
			document.getElementById("img_tel_mobile_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_tel_mobile_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("email_professeur").value.length > 1)
			document.getElementById("img_email_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_email_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("num_ss_professeur").value.length > 1)
			document.getElementById("img_num_ss_professeur").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_num_ss_professeur").src = "images/general/NoSmall.png";
			
		if(document.getElementById("code_banque").value.length > 1)
			document.getElementById("img_code_banque").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_code_banque").src = "images/general/NoSmall.png";
			
		if(document.getElementById("code_guichet").value.length > 1)
			document.getElementById("img_code_guichet").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_code_guichet").src = "images/general/NoSmall.png";
			
		if(document.getElementById("num_compte").value.length > 1)
			document.getElementById("img_num_compte").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_num_compte").src = "images/general/NoSmall.png";
			
		if(document.getElementById("cle").value.length > 1)
			document.getElementById("img_cle").src = "images/general/OkSmall.png";
		else
			document.getElementById("img_cle").src = "images/general/NoSmall.png";
	}
}

function empty(champ) {
	champ.value = "";
}

function fill(champ) {
	if(champ.name == "login" && champ.value.length == 0)
		champ.value = "Identifiant";
	else if(champ.name == "mdp" && champ.value.length == 0)
		champ.value = "Mot de passe";
}

var requete = null;

function creerRequete() {
	try {
		requete = new XMLHttpRequest();
	} catch(essaimicrosoft) {
		try {
			requete = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(autremicrosoft) {
			try {
				requete = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(echec) {
				requete = null;
			}
		}
	}
	if(requete == null)
		alert("Impossible de créer l'objet requête !");
}

function valideForm() {
	creerRequete();
	var url = "include/common/demandeRappelInsert.php";
	requete.onreadystatechange = valideDdeRappel;
	requete.open("POST",url,true);
	requete.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	var param = "valider=" + document.getElementById('valider').value + "&";
	param += "nom=" + document.getElementById('nom').value + "&";
	param += "prenom=" + document.getElementById('prenom').value + "&";
	param += "telephone=" + document.getElementById('telephone').value + "&";
	param += "moment=" + document.getElementById('moment').value + "&";
	param += "type=" + document.getElementById('type').value + "&";
	param += "type_autre=" + document.getElementById('type_autre').value + "&";
	param += "commentaires=" + document.getElementById('commentaires').value;
	requete.send(param);
}

function valideDdeRappel() {
	if(requete.readyState == 4) {
		var result = requete.responseText;
		if(result) {
			document.getElementById("demandeRappel").style.display = "none";
			document.getElementById("demandeRappel2").style.display = "block";
		}
		else
			alert("L'opération a échoué.");
	}
}

function getNewPass() {
	if(document.forgot_pass.type_user.value == 0) {
		alert("Veuillez selectionner un type d'utilisateur.");
		document.forgot_pass.type_user.focus();
	}
	else {
		creerRequete();
		var url = "include/common/forgot_pass_ajax.php";
		requete.onreadystatechange = valideNewPass;
		requete.open("POST",url,true);
		requete.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		var param = "type=" + document.getElementById('type_user').value + "&";
		param += "login=" + document.getElementById('login').value + "&";
		param += "tel=" + document.getElementById('tel').value + "&";
		requete.send(param);
	}
}

function valideNewPass() {
	if(requete.readyState == 4) {
		var result = requete.responseText;
		if(result == 1) {
			document.getElementById("forgot_pass").style.display = "none";
			document.getElementById("forgot_pass2").style.display = "block";
		}
		else
			alert("L'opération a échoué.");
	}
}
