function VerificationFormulaire(a){this.oForm=a;this.aChamps=null;this.aChampsRequis=null;this.aChampsRemplis=null;this.classFacultatif="facultatif";this.init()}VerificationFormulaire.prototype.checkForm=function(){if(this.isFieldsEmpty()){this.emptyOldErrors();var a;for(a=0;a<this.aChampsRequis.length;a++){if(!inArray(this.aChampsRemplis,this.aChampsRequis[a])){this.placeError(this.aChampsRequis[a],"Veuillez remplir ce champ")}}return false}return true};VerificationFormulaire.prototype.placeError=function(b,c){var a=document.createElement("em");a.className="error";a.appendChild(document.createTextNode(c));insertAfter(a,b);b.className+=" missing"};VerificationFormulaire.prototype.isFieldsEmpty=function(){this.aChampsRemplis=[];var a;for(a=0;a<this.oForm.elements.length;a++){if((this.oForm.elements[a].type=="text"||this.oForm.elements[a].type=="textarea")&&this.oForm.elements[a].value.length!=0){this.aChampsRemplis.push(this.oForm.elements[a])}}if(this.aChampsRemplis.length!=this.aChampsRequis.length){return true}else{return false}};VerificationFormulaire.prototype.isEmailValid=function(){};VerificationFormulaire.prototype.emptyOldErrors=function(){var d=new RegExp("missing","g"),a=this.oForm.getElementsByTagName("em"),b,e;for(b=0;b<a.length;b++){if(a[b].previousSibling.className.match(d)){e=a[b].previousSibling.className.replace(d,"");a[b].previousSibling.className=e}a[b].parentNode.removeChild(a[b]);b--}};VerificationFormulaire.prototype.resetFields=function(){var b,a;for(a=0;a<this.oForm.elements.length;a++){b=this.oForm.elements[a];if(b.type=="submit"){continue}if(!b.defaultValue){continue}b.onfocus=function(){if(this.value==this.defaultValue){this.value=""}};b.onblur=function(){if(this.value==""){this.value=this.defaultValue}}}};VerificationFormulaire.prototype.countFieldsRequis=function(){this.aChamps=[];this.aChampsRequis=[];var b,a;for(a=0;a<this.oForm.elements.length;a++){b=this.oForm.elements[a];if(b.type=="submit"){continue}this.aChamps.push(b);if(b.className==this.classFacultatif){continue}this.aChampsRequis.push(b)}};VerificationFormulaire.prototype.init=function(){if(!findObj||!document.getElementsByTagName||!document.createElement||!document.createTextNode){return false}var a=this;this.resetFields();this.oForm.onsubmit=function(){a.countFieldsRequis();return a.checkForm()}};addEvent(window,"DOMContentLoaded",function(){if(findObj("contactForm")){new VerificationFormulaire(findObj("contactForm"))}});
