function veriffcompt(lg){

	tmsg = new Array();
	tmsg["nom"] = new Array();
	tmsg["prenom"] = new Array();
	tmsg["tel"] = new Array();
	tmsg["login"] = new Array();
	tmsg["amdp"] = new Array();
	tmsg["nmdp1"] = new Array();
	tmsg["nmdp2"] = new Array();
	tmsg["nom"]["fr"] = "Le nom n'est pas valide";
	tmsg["nom"]["en"] = "The name is not valid";
	tmsg["prenom"]["fr"] = "Le prénom n'est pas valide";
	tmsg["prenom"]["en"] = "The first name is not valid";
	tmsg["tel"]["fr"] = "Le numéro de téléphone n'est pas valide";
	tmsg["tel"]["en"] = "The phone number is not valid";
	tmsg["login"]["fr"]= "Le login n'est pas valide";
	tmsg["login"]["en"] = "The login is not valid";
	tmsg["amdp"]["fr"]= "Veuillez saisir votre ancien mot de passe pour activer le nouveau";
	tmsg["amdp"]["en"] = "Please enter your old password to activate the new";
	tmsg["nmdp1"]["fr"]= "Le nouveau mot de passe n'est pas assez sécurisé";
	tmsg["nmdp1"]["en"] = "The new password is not secure enough";
	tmsg["nmdp2"]["fr"] = "Les nouveaux mots de passe ne correspondent pas";
	tmsg["nmdp2"]["en"] = "The new passwords do not match";
				
	f = document.fcompt;
	msg = "";
	if (!istexte(f.nom.value)){
		msg += tmsg['nom'][lg]+"\r\n";
	}else{
		f.nom.value = f.nom.value.toUpperCase();
	}
	if (!istexte(f.prenom.value)){
		msg += tmsg['prenom'][lg]+"\r\n";
	}else{
		f.prenom.value = norm_prenom(f.prenom.value);
	}
	
	if (!isnumtel(f.tel.value)){
		msg += tmsg['tel'][lg]+"\r\n";
	}else{
		var chr = new RegExp("[-\.\\s]+","g");
		f.tel.value = f.tel.value.replace(chr,'');
	}
	if (!test_email(f.nlogin.value)){
		msg += tmsg['login'][lg]+"\r\n";
	}
	if (f.nmdp1.value != ""){
		if (f.amdp.value == ""){
			msg += tmsg['amdp'][lg]+"\r\n";
		}else{
			if (!nmdp_eg()){
				msg += tmsg['nmdp2'][lg]+"\r\n";
			}else{
				if (!ismdp(f.nmdp1.value)){
					msg += tmsg['nmdp1'][lg]+"\r\n";
				}
			}
		}
	}
	if (msg != ""){
		alert(msg);
		return false;
	}else{
		return true;
	}
}
function istexte(t){
	alpha = "a-zA-ZâêîôûàèìòùáéíóúäëïöüãõñçÂÊÎÔÛÀÈÌÒÙÁÉÍÓÚÄËÏÖÜÃÕÑÇ";
	var  reg = new  RegExp("^(["+alpha+"]+([-\\s']?["+alpha+"]+)+?)$","g");
	return t.match(reg);
}
function isnumtel(t){
	var num = new RegExp("^(\\+?[-0-9\\.\\s]{8,})$","g");
	return t.match(num);
}
function norm_prenom(mot) {
	var m=mot.charAt(0).toUpperCase() + mot.substring(1).toLowerCase();
	return m;
}
function test_email(my_email) {
	var new_string = new String(my_email);
	ident = '[-a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~]';
	domain = '([a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9]+)?)';
	regex = '^('+ident+'+(\\.('+ident+')+)*)+@'+domain+'{1,63}\\.'+domain+'{2,63}$';
	return new_string.match(regex);
}
function nmdp_eg(){
	f = document.fcompt;
	p1 = f.nmdp1;
	p2 = f.nmdp2;
	if ((p1.value != "") && (p2.value != "") && (p1.value != p2.value )){
		p1.style.color = "#FF0000";
		p2.style.color = "#FF0000";
		return false;
	}else{
		p1.style.color = "#000000";
		p2.style.color = "#000000";
		return true;
	}
}
function ismdp(t){
	f = document.fcompt;
	tup = t.toUpperCase();
	tlow = t.toLowerCase();
	if  ( (t.length < 6) || (t == tup) || (t == tlow) || (!t.match(new RegExp("[0-9]","g"))) ){
		return false;
	}
	
	/*if (t.length < 6){ msg_mdp += 1;}
	if (t == tup){ msg_mdp += 1;}
	if (t == tlow){ msg_mdp += 1; }
	if(!t.match(new RegExp("[0-9]","g"))){ msg_mdp += 1; }
	if (msg_mdp != 0){return false}*/
	
	email = f.nlogin.value.toLowerCase();
	reg = new Array(f.nom.value.toLowerCase(),
					f.prenom.value.toLowerCase(),
					f.entreprise.value.toLowerCase(),
					email.substring(0,email.indexOf("@",0)),
					"azerty",
					"pass",
					"1234",
					"pass",
					"secret");
	for (i=0;i<reg.length;i++){
		if ( (tlow.match(new RegExp(reg[i]),"g")) || (reg[i].match(new RegExp(tlow),"g")) ){
			return false;
		}
	}
	return true;
}
function ac_relnote(rid,pid){
	$(".relnote").css({"display":"none"});
	$(".displaynone").css({"display":"none"});
	if (rid != 0){
		ind = document.getElementById("rnfin").selectedIndex;
		nb = document.getElementById("rnfin").length;
		if (ind >1){
			for(i=0;i<nb;i++){
				if (i<ind){
					document.getElementById("rndebut").options[i] = new Option(document.getElementById("rnfin").options[i].value,document.getElementById("rnfin").options[i].value);
					document.getElementById("rndebut").options[i].id = "opt"+i;
					$("#opt"+i).click(function(){
							affichdiff(parseInt(document.getElementById("rndebut").selectedIndex),parseInt(document.getElementById("rnfin").selectedIndex));
					});
				}else{
					document.getElementById("rndebut").options[i] = null;
				}
			}
			document.getElementById("diffrn").style.display = "inline";
		}
		$(".rn"+rid).css({"display":"block"});
		$(".rn"+rid+pid).css({"display":"block"});
		$(".relnote").css({"display":"block"});
	}
}
function affichdiff(d,f){
	for (j=0;j<f;j++){
		disp = ((j<d) || (d==0))? "none" : "block" ;
		ridp = document.getElementById("rnfin").options[j].id;
		rid = ridp.substring(0,ridp.indexOf('p'));
		$(".rn"+rid).css({"display":disp});
		$(".rn"+ridp).css({"display":disp});
	}
}
function soulignlien(d,b){
	cn = d.childNodes;
	lg = cn.length;
	ale = "";
	cn[1].style.textDecoration=(b==1)?"underline":"none";
}
