disableDeparts(document.getElementById('etudiant_annee').value);

function mailINSA(){
	var nom=document.getElementById('etudiant_name').value.trim().split(' ').join('-');
	
	var prenom=document.getElementById('etudiant_firstName').value.trim().split(' ').join('-');

	document.getElementById('etudiant_mail').value=prenom.toLowerCase()+'.'+nom.toLowerCase()+'@insa-lyon.fr';
}

function disableDeparts(annee){

	var options = document.getElementById('etudiant_departement').options;
	for(i=0;i<options.length;i++){
		var value=options[i].value;
		if(annee==1 || annee==2)
		{
			if(value=='PC')
			{
				options[i].disabled=false;
			} else
			{
				options[i].disabled=true;
			}
		}else
		{
			if(value!='PC')
			{
				options[i].disabled=false;
			} else
			{
				options[i].disabled=true;
			}
		}
	}
}

$(document).ready(function() 
{
	$('#etudiant_name').focus();
});

@@ -57,24 +57,618 @@
 .value);%0D%0A%0D%0A
+accentsTidy = function(s)%0D%0A%7B%0D%0A%09var r=s.toLowerCase();%0D%0A//%09r = r.replace(new RegExp(/%5Cs/g),%22%22);%0D%0A%09r = r.replace(new RegExp(/%5B%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%5D/g),%22a%22);%0D%0A%09r = r.replace(new RegExp(/%C3%A6/g),%22ae%22);%0D%0A%09r = r.replace(new RegExp(/%C3%A7/g),%22c%22);%0D%0A%09r = r.replace(new RegExp(/%5B%C3%A8%C3%A9%C3%AA%C3%AB%5D/g),%22e%22);%0D%0A%09r = r.replace(new RegExp(/%5B%C3%AC%C3%AD%C3%AE%C3%AF%5D/g),%22i%22);%0D%0A%09r = r.replace(new RegExp(/%C3%B1/g),%22n%22);                %0D%0A%09r = r.replace(new RegExp(/%5B%C3%B2%C3%B3%C3%B4%C3%B5%C3%B6%5D/g),%22o%22);%0D%0A%09r = r.replace(new RegExp(/%C5%93/g),%22oe%22);%0D%0A%09r = r.replace(new RegExp(/%5B%C3%B9%C3%BA%C3%BB%C3%BC%5D/g),%22u%22);%0D%0A%09r = r.replace(new RegExp(/%5B%C3%BD%C3%BF%5D/g),%22y%22);%0D%0A//%09r = r.replace(new RegExp(/%5CW/g),%22%22);%0D%0A%09return r;%0D%0A%7D;%0D%0A%0D%0A
 function mai
@@ -914,49 +914,47 @@
 lue=
-prenom.toLowerCase()+'.'+nom.toLowerCase(
+accentsTidy(prenom)+'.'+accentsTidy(nom
 )+'@

fix mail insa accents