// fonction appelée au lancement de la page
function init() {
	
	// place le focus sur le formulaire de connexion
	document.getElementById('txtLogin').focus();
	
	// on associe la fonction verifId à la soumission du formulaire d'identification
	document.getElementById('frmIdentification').onsubmit = verifId;
  
	// Gestion des liens d'ouverture et de fermeture de formulaires
	document.getElementById('lien_inscription').onclick = function() { gestionFormulaire('form_inscription', 1, 'nom'); return false; }
	document.getElementById('lien_contact').onclick = function() { gestionFormulaire('form_contact', 1, 'cnom'); return false; }
	document.getElementById('lien_mdp_perdu').onclick = function() { gestionFormulaire('mdp_perdu', 1, 'mdp_email'); return false; }
	document.getElementById('fermer_inscription').onclick = fermerForm;
	document.getElementById('fermer_contact').onclick = fermerForm;
	document.getElementById('fermer_mdp_perdu').onclick = fermerForm;
	document.getElementById('lien_fermer_inscription').onclick =function() { fermerForm(); return false; }
	document.getElementById('lien_fermer_contact').onclick =function() { fermerForm(); return false; }
	document.getElementById('lien_fermer_mdp').onclick =function() { fermerForm(); return false; }
	
	// Tests du formulaire d'inscription
	document.getElementById('nom').onkeyup = testChaine;
	document.getElementById('prenom').onkeyup = testChaine;
	document.getElementById('email').onkeyup = testEmail;
	document.getElementById('mdp').onkeyup = testMdp;
	document.getElementById('confirmation').onkeyup = testConfirmation;
	
	// Tests du formulaire de contact
	document.getElementById('cnom').onkeyup = testChaine;
	document.getElementById('cprenom').onkeyup = testChaine;
	document.getElementById('cemail').onkeyup = testcEmail;
	document.getElementById('cmsg').onkeyup = testcMsg;
	
	// Tests du formulaire de mot de passe perdu
	document.getElementById('mdp_email').onkeyup = testMdpEmail;
	
	// on associe la fonction de verification de l'inscription sur le submit du formulaire d'inscription 
	document.getElementById('frmInscription').onsubmit = function() { verifInscription(); return false; }
	document.getElementById('frmContact').onsubmit = function() { verifContact(); return false; }
	document.getElementById('frmMdpPerdu').onsubmit = function() { verifMdpPerdu(); return false; }
}

// Affectation de la fonction init au chargement de la page
window.onload = init;