// LiveValidation 1.2 (standalone version) // Copyright (c) 2007 Alec Hill (www.livevalidation.com) // LiveValidation is licensed under the terms of the MIT License var LiveValidation=function(B,A){this.initialize(B,A)}; LiveValidation.TEXTAREA=1; LiveValidation.TEXT=2; LiveValidation.PASSWORD=3; LiveValidation.CHECKBOX=4; LiveValidation.SELECT=5; LiveValidation.massValidate=function(C){var D=true; for(var B=0,A=C.length;B=300){this.removeMessageAndFieldClass()}var A=this; if(this.timeout){clearTimeout(A.timeout)}this.timeout=setTimeout(function(){A.validate()},A.wait)},doOnBlur:function(A){this.focused=false; this.validate(A)},doOnFocus:function(A){this.focused=true; this.removeMessageAndFieldClass()},getElementType:function(){switch(true){case (this.element.nodeName=="TEXTAREA"):return LiveValidation.TEXTAREA; case (this.element.nodeName=="INPUT"&&this.element.type=="text"):return LiveValidation.TEXT; case (this.element.nodeName=="INPUT"&&this.element.type=="password"):return LiveValidation.PASSWORD; case (this.element.nodeName=="INPUT"&&this.element.type=="checkbox"):return LiveValidation.CHECKBOX; case (this.element.nodeName=="SELECT"):return LiveValidation.SELECT; case (this.element.nodeName=="INPUT"):throw new Error("LiveValidation::getElementType - Cannot use LiveValidation on an "+this.element.type+" input!"); default:throw new Error("LiveValidation::getElementType - Element must be an input, select, or textarea!")}},doValidations:function(){this.validationFailed=false; for(var C=0,A=this.validations.length;CNumber(C)){Validate.fail(K)}break}return true},Format:function(C,D){var C=String(C); var D=D||{}; var A=D.failureMessage||"Not valid!"; var B=D.pattern||/./; if(!B.test(C)){Validate.fail(A)}return true},Email:function(B,C){var C=C||{}; var A=C.failureMessage||"please be sure to enter a valid email"; Validate.Format(B,{failureMessage:A,pattern:/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i});return true},Length:function(F,G){var F=String(F); var G=G||{}; var E=((G.minimum)||(G.minimum==0))?G.minimum:null; var H=((G.maximum)||(G.maximum==0))?G.maximum:null; var C=((G.is)||(G.is==0))?G.is:null; var A=G.wrongLengthMessage||"Must be "+C+" characters long!"; var B=G.tooShortMessage||"Must not be less than "+E+" characters long!"; var D=G.tooLongMessage||"Must not be more than "+H+" characters long!"; switch(true){case (C!==null):if(F.length!=Number(C)){Validate.fail(A)}break; case (E!==null&&H!==null):Validate.Length(F,{tooShortMessage:B,minimum:E}); Validate.Length(F,{tooLongMessage:D,maximum:H}); break; case (E!==null):if(F.lengthNumber(H)){Validate.fail(D)}break; default:throw new Error("Validate::Length - Length(s) to validate against must be provided!")}return true},Inclusion:function(F,G){var G=G||{}; var C=G.failureMessage||"Must be included in the list!"; if(G.allowNull&&F==null){return true}if(!G.allowNull&&F==null){Validate.fail(C)}var E=G.within||[]; var D=false; for(var A=0,B=E.length;A