<!--

	//Verification du contenu des champs
	//---------------------------------- 

	function check_montant(form){
		var somme; var er; var point; var num; var mail; var exx; var zip;var pays;
		somme = form.DON.value;
		mail = form.MAIL.value;
		zip = form.ZIP.value;
		comment = form.COMMENT.value;
		pays = form.PAYS1.value;
		//remplacement des , par des points
		er = /[,]/gi;
		somme = somme.replace(er,".");
		//test de la valeur num?rique du champ
		num= isNaN(somme);
		// test de la somme en fonction de l'expression suivante 1 chiffre suivit d'un point une fois
		//et d'une s?quence de deux chiffres seulement une fois. Si il n'y a pas de  concordance
		//on d?clare  la variable num a isnan
		er = /^[0-9]{1,}([.,]{1}[0-9]{2})?$/gi;
		exx = somme.replace(er,"ok");
		if(exx != "ok"){
			num = true;
		}
		//R?gles de gestion suppl?mentaires en fonction du contexte
		if(mail.length = 0 || mail.indexOf('@')<0){
alert('Vous devez sp?cifier une adresse ?lectronique pour la confirmation de votre don, merci!');
form.MAIL.focus();
form.MAIL.value = '';
return false;

}
		//Tset de longueur du commentaire
		if(comment.length > 500){
		alert('Le commentaire est trop long!');
		return false;
		}
		//Test de toutes le sconditions avant de passez la somme
		if (somme == "" || somme.charAt(0) == "." || num == true ){
				window.alert("Le montant saisie n'est pas correct veuillez saisir un montant libre...");
				form.DON.value = "";
				form.DON.focus();
				return false;}
			else{
				 form.DON.value = somme;
				 YY_checkform('document.don','DON','#0_1000000','1','Veuillez saisir une somme','PRENOM','#q','0','Saisissez votre prenom','NOM','#q','0','Saisissez votre nom','ADRESSE1','#q','0','Saisissez votre adresse','ZIP','#01000_99999','1','Saisissez votre code postal','LOCALITE','#q','0','Saisissez votre localite;','PAYS1','q','0','Saisissez votre pays ou autre pays');
		}
		var news = form.NEWS;
		var newsChecked=false;
		for(var i_news=0;i_news<news.length;i_news++){
			if (news[i_news].checked){
				newsChecked=true;
			}
		}
		if (!newsChecked){
			window.alert("Veuillez cocher la case autorisant l'envoie informations par email .");
			form.NEWS[0].focus();
			return false;
		}
		//Test de la chaine email avec la pr?s?ance de l'@
		point = mail.split("@");
		if(mail.indexOf("@") < 0 || point.length > 3 || point[0].length < 1 || point[1].indexOf(".") < 0 || point[1].length == (point[1].indexOf(".")+1) || point[0].length == (point[0].indexOf(".")+1) || point[1].indexOf(".") == 0 || mail.indexOf("#") > 0 ){
			window.alert("Adresse E.mail incorrecte");
			form.MAIL.focus();
			return false;
			}
		else{
			return document.MM_returnValue;
		}
	}
	
	function delExp(id){
		var er = /[0-9][0-9]\/[0-9][0-9]\/[1,2][0,9][0-9][0-9]/gi;
		test = document.forms[0].elements[id].value;
		if(!test.replace(er,"")==""){
			alert("La date de naissance n'est pas correct! exemple: 04/06");
			document.forms[0].elements[id].value = "";
		}
	}
	
	function setslash(id){
		document.forms[0].elements[id].value = detail = document.forms[0].elements[id].value.replace("//","/");
		if(document.forms[0].elements[id].value.length == 2 || document.forms[0].elements[id].value.length == 5){
			document.forms[0].elements[id].value = document.forms[0].elements[id].value + "/";
		}	
	}
	
	/* nouvelles fonctions */
	
	function handleComas()
	{
		var amount = document.forms['nfform'].elements['nfform:otherAmount'].value;
		var begin = amount;
		var i = 0;
		
		while (i < amount.length)
		{
			if (amount.charAt(i) == ',')
			{
				var begin = amount.substr(0, i);
				begin += ".";
				if ((i + 1) < amount.length)
					begin += amount.substr(i + 1, amount.length);
			}
			i++;
		}
		document.forms['nfform'].elements['nfform:otherAmount'].value = begin;
	}
	
	function limitTextarea(textarea, maxlength) {
		for (i = 0; i < textarea.value.length; i++) {
			if (textarea.value.charAt(i) == '\n' || textarea.value.charAt(i) == '\t')
				maxlength = maxlength - 1;
		}

		if (textarea.value.length >= maxlength)
			textarea.value = textarea.value.substring(0, maxlength);
	}
	
	function copyAmount(select) {
		if (select.value != "-1") {
			document.getElementById('nfform:otherAmount').value=select.value;
		} else {
			document.getElementById('nfform:otherAmount').value="";
		} 
	}
	
	function checkOtherAmountRadio() {
		for(i=0; i < document.forms[0].elements['nfform:propositionAmount'].length; i++){
			if (document.forms[0].elements['nfform:propositionAmount'][i].value == -1) {
				document.forms[0].elements['nfform:propositionAmount'][i].checked = true;
			} else {
				document.forms[0].elements['nfform:propositionAmount'][i].checked = false;
			}
		}
	}
	
	function validateAmount() {
		var amount = document.forms['nfform'].elements['nfform:otherAmount'].value.replace(',', '.');
		if (isNaN(amount)) {
			alert("Le montant saisi n'est pas correct !");
			document.forms['nfform'].elements['nfform:otherAmount'].focus();
			return false;
		} else {
			if (amount <= 0) {
				alert("Le montant saisi n'est pas correct !");
				document.forms['nfform'].elements['nfform:otherAmount'].focus();
				return false;
			} else {
				document.forms['nfform'].elements['nfform:otherAmount'].value = amount;
				return true;
			}
		}
	}
	
	function validateFillEmailForm(){
		var reg_alphab = /^[A-Za-z]+$/;
		var identifiant = document.getElementById('nfform:identifiant').value;
		var nom = document.getElementById('nfform:nom').value;
		var email = document.getElementById('nfform:email').value;
		//verif identifiant
		if (identifiant == "") {
			alert("Veuillez renseigner votre identifiant");
			return false;
		}
		identifiant = identifiant.toUpperCase();
		document.getElementById('nfform:identifiant').value = identifiant;
		if (identifiant.length != 9) {
			alert("L'identifiant doit \352tre compos\351 de 9 caract\350res");
			return false;
		}
		if (reg_alphab.exec(identifiant.charAt(0))==null) {
			alert("L'identifiant doit \352tre commencer par une lettre");
			return false;
		}
		//verif nom
		if (nom == "") {
			alert("Veuillez renseigner votre nom");
			return false;
		} else {
			nom = nom.toUpperCase();
			document.getElementById('nfform:nom').value = nom;
		}
		//verif email
		if (email == "") {
			alert("Veuillez renseigner votre email");
			return false;
		} 
		if(! isEmail(email)) {
			alert("Veuillez adresse email n'est pas valide");
			return false;		
		}
	}
	
	isEmail = function(emailStr) {
		var checkTLD = 1;
		var knownDomsPat = /^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|fr)$/;
		var emailPat = /^(.+)@(.+)$/;
		var specialChars = "\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
		var validChars = "\[^\\s" + specialChars + "\]";
		var quotedUser = "(\"[^\"]*\")";
		var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
		var atom = validChars + '+';
		var word = "(" + atom + "|" + quotedUser + ")";
		var userPat = new RegExp("^" + word + "(\\." + word + ")*$");
		var domainPat = new RegExp("^" + atom + "(\\." + atom +")*$");
		var matchArray = emailStr.match(emailPat);
		if (matchArray == null) { return false; }
		var user = matchArray[1];
		var domain = matchArray[2];
		for (i=0; i<user.length; i++) {
			if (user.charCodeAt(i) > 127) { return false; }
		}
		for (i=0; i<domain.length; i++) {
			if (domain.charCodeAt(i) > 127) { return false; }
		}
		if (user.match(userPat) == null) { return false; }
		var IPArray=domain.match(ipDomainPat);
		if (IPArray != null) {
			for (var i=1; i<=4; i++) {
				if (IPArray[i] > 255) { return false; }
			}
			return true;
		}
		var atomPat = new RegExp("^" + atom + "$");
		var domArr = domain.split(".");
		var len = domArr.length;
		for (i=0; i<len; i++) {
			if (domArr[i].search(atomPat) == -1) { return false; }
		}
		if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) { return false; }
		if (len < 2) { return false; }
		return true;
	}
//-->