// JavaScript Document/* gVerifFrom */GVerifForm = Class.create();GVerifForm.prototype = {		initialize: function(conteneur,ancre,fermeture_animee) {			this.erreur ="";			this.conteneur = $(conteneur)			this.ancre = ancre;			this.fermeture_animee = fermeture_animee;			this.ligne_intro = '<span class="titre_verif_form">INFORMATIONS MAL SAISIES</span><br/><span class="intro_verif_form">Les informations suivantes sont manquantes ou erron&#233;es :</span>';			this.liste = "";			this.conteneur_verif = new Array;		},		ecrire: function(){			this.conteneur.innerHTML = "<div>" + this.ligne_intro + this.liste + "</div>";		},		supprimer: function(){			this.conteneur.innerHTML = '';		},		affiche: function(){			return (this.conteneur.innerHTML == '') ? false : true		},		add:function(element){			this.conteneur_verif.push(element);		},		traitement:function(element){			var traitement = $A(this.conteneur_verif);			var liste = "";			traitement.each(function(element){				if(element.traitement()!="")				{					switch(element.type)					{						case "select":							liste += "<li>Veuillez "+element.intitule+".</li>";						break;						case "radio":							liste += "<li>Veuillez "+element.intitule+".</li>";						break;						case "condition":							liste += "<li>"+element.intitule+".</li>";						break;						default:							liste += "<li>Le champ "+element.intitule+" est"+element.traitement()+"</li>";						break;					}					element.changeStyle(true)				}			});			// si erreur			if(liste!="")			{				this.liste = "<ul>"+liste+"</ul>";				if(this.affiche())				{					Element.setStyle(this.conteneur,{height:'auto'});					this.ecrire();				}				else				{					//defixer la taille pour que la liste ne prenne pas toute sa place initiale					this.ecrire()					new Effect.BlindDown(this.conteneur);				}				// test "ancre"				if(this.ancre!="")				{					Element.versPosition(this.ancre)				}				return false			}			else			{				if(this.affiche() && this.fermeture_animee)				{					Element.fixeElement(this.conteneur)					this.supprimer()					Effect.BlindUp(this.conteneur);				}				return true			}		}};/* /gVerifFrom *//* VerifFormTxt */VerifFormTxt = Class.create();VerifFormTxt.prototype = {	initialize: function(element,intitule,obligatoire,taille_min,taille_max,carac_autorise,type) {		this.element = $(element);		this.intitule = intitule;		this.valeur = $F(this.element);		this.obligatoire = obligatoire;		this.type=type;		this.taille_min = taille_min;		this.taille_max = (taille_max=='max') ? this.element.maxLength : taille_max;		this.regex = null;		switch (carac_autorise)		{			case "chiffre":				this.carac_autorise = "0123456789";			break;			case "nombre":				this.carac_autorise = "0123456789., -";			break;			case "tel":				this.carac_autorise = "0123456789. -";			break;			case "alpha":				this.carac_autorise = "abcdefghijklmnopqrstuvwxyzéèêëôöîïàâäûüç";			break;			case "alphachiffre":				this.carac_autorise = "abcdefghijklmnopqrstuvwxyzéèêëôöîïàâäûüç0123456789";			break;			case "alphanombre":				this.carac_autorise = "abcdefghijklmnopqrstuvwxyzéèêëôöîïàâäûüç0123456789., -";			break;			case "alpha_2":				this.carac_autorise = "abcdefghijklmnopqrstuvwxyzéèêëôöîïàâäûüç0123456789.,- '()€$£%[]{}&=+@?!/°;:*~_’";			break;			default:				this.carac_autorise = "";			break;		}		this.type = type;	},	changeStyle: function(change){		if(change)		{			Element.addClassName(this.element,"verif_form_erreur")		}		else		{			Element.removeClassName(this.element,"verif_form_erreur")		}	},	traitement: function(){		this.changeStyle(false)		switch (this.type)		{			/* texte */			case "texte" :				return this.verification()			break;			/* email */			case "email" :				this.regex = /^[a-z0-9_.-]+@[a-z0-9_.-]+\.([a-z]{2,4})$/;				return this.verification()			break;			/* date */			case "date" :				this.regex = /^([0123])([0123456789])\/([01])([0123456789])\/([012])([0123456789])([0123456789])([0123456789])$/;				return this.verification()			break;			/* defaut */			default:				return ""			break;		}	},	verification: function(){		var valeur_t = this.valeur.toLowerCase();		if (valeur_t.length==0) {			if(this.obligatoire) return " obligatoire - taille : "+this.taille_min+((this.taille_min!=this.taille_max)?" &#224; "+this.taille_max:"")+" caract&#232;res."		}		else {			if (this.taille_min==this.taille_max&&valeur_t.length!=this.taille_min) return " de taille incorrecte - taille : "+this.taille_max+" caract&#232;res."			if (this.taille_max!=0 && valeur_t.length>this.taille_max) return " trop long - taille maximum : "+this.taille_max+" caract&#232;res."			if (valeur_t.length<this.taille_min) return " trop court - taille minimum : "+this.taille_min+" caract&#232;res."		}		if (this.carac_autorise=="") return "" // si rien ? v?rifier renvoi ok		for (var i=0;i<valeur_t.length;i++) {			if (this.carac_autorise.indexOf(valeur_t.charAt(i))==-1 && valeur_t.charAt(i)!="\n" && escape(valeur_t.charAt(i))!="%0D" ) {				return " mal renseign&#233; - caract&#232;re non autoris&#233; : "+valeur_t.charAt(i)+".";			}		}		if(this.regex != null)		{			if(!this.regex.test(valeur_t)&&valeur_t.length!=0) {return " mal renseign&#233;."}		}		return ""	}};/* VerifFormTxt *//* VerifFormSelect */VerifFormSelect = Class.create();VerifFormSelect.prototype = {	initialize: function(element,intitule,obligatoire,value_defaut) {		this.element = $(element);		this.intitule = intitule;		this.valeur = $F(this.element);		this.obligatoire = obligatoire;		this.value_defaut = value_defaut		this.type="select";	},	changeStyle: function(change){		if(change)		{			Element.addClassName(this.element,"verif_form_erreur")		}		else		{			Element.removeClassName(this.element,"verif_form_erreur")		}	},	traitement: function(){		this.changeStyle(false)		if(Form.Element.getValue(this.element)==this.value_defaut)		{return "erreur"}		return ""	}};/* VerifFormSelect *//* VerifFormRadio */VerifFormRadio = Class.create();VerifFormRadio.prototype = {	initialize: function(element,intitule,obligatoire,choix) {		this.element = $(element);		this.intitule = intitule;		this.obligatoire = obligatoire;		this.type="radio";		this.choix = choix;	},	changeStyle: function(change){		if(change)		{			Element.addClassName(this.element,"verif_form_erreur")		}		else		{			Element.removeClassName(this.element,"verif_form_erreur")		}	},	traitement: function(){		this.changeStyle(false)		var enfants = this.element.childNodes;		var check = false;		var dd = (this.choix == null)? $A(enfants) : $A(this.choix);		dd.each(function(element){			if($(element).type == "radio"){if($(element).checked){check = true}}			if($(element).type == "checkbox"){if($(element).checked){check = true}}		});		if(check){return ""}		return "erreur"	}};/* VerifFormRadio *//* VerifFormCondition */VerifFormCondition = Class.create();VerifFormCondition.prototype = {	initialize: function(intitule,elements) {		this.intitule = intitule;		this.type="condition";		this.elements = elements;	},	changeStyle: function(change){		if(this.elements != null)		{			for(var i = 0 ; i < this.elements.length ; i++)			{				if(change)				{					Element.addClassName(this.elements[i],"verif_form_erreur")				}				else				{					Element.removeClassName(this.elements[i],"verif_form_erreur")				}			}		}	},	traitement: function(){		return "intitule"	}};/* VerifFormCondition *//* Checkbox_all */Checkbox_all = Class.create();Checkbox_all.prototype = {	initialize: function(checkbox,checkbox_all) {		this.checkbox = $A(checkbox);		this.checkbox_all = checkbox_all;		this.checkboxs = $A(checkbox);		this.checkboxs.push(checkbox_all);		for (var i=0 ; i < this.checkbox.length ; i++)		{			$(this.checkbox[i]).onclick = this.evt_check.bindAsEventListener(this);		}		$(this.checkbox_all).onclick = this.evf_check_all.bindAsEventListener(this);	},	evt_check: function(){		var all_check = true;		this.checkbox.each(function(element){			if($(element).checked == false){all_check = false;}		})		if(all_check)			{$(this.checkbox_all).checked = true}		else			{$(this.checkbox_all).checked = false}	},	evf_check_all: function(){		if($(this.checkbox_all).checked)		{			this.checkboxs.each(function(element){				$(element).checked = true			})		}		else		{			this.checkboxs.each(function(element){				$(element).checked = false			})		}	}};/* Checkbox_all */