$().ready(function(){var C=$(".page_content .nav a");var A="";var F=$("body").attr("id");var E=F.split("_");var B=E[1];var D=0;$(".section").each(function(){var G=$(this).height();if(G>D){D=G}});$(".page_content .content .col_inner").height(D+150);C.each(function(){if($(this).html()==B||$(this).html()=="overview"||$(this).html()=="contact us"){if($(this).html()=="overview"){B="overview"}if($(this).html()=="contact us"){B="contactus"}$(this).addClass("active");$("#l_"+B).slideDown("medium",function(){if(B=="contactus"){L_contact()}});A=this}});C.click(function(){C.removeClass("active");$(this).addClass("active");var G=$(this).html();G=G.replace(/\//gi,"");G=G.replace(/\s/gi,"");if(A!=C){$(".section").hide();$("#l_"+G).slideDown("medium")}A=this})});function L_contact(){var A=new easyForm({array:Array({field:"f_firstName"},{field:"f_lastName"},{field:"f_email"},{field:"f_companyName"},{field:"f_primaryPhone"})})}function validationBuilder(A){this.validationType=A.validationType;this.partner=A.partner;this.required=A.required;this.field=A.field;this.iMsg=A.iMsg;this.min=A.min;this.minMsg=A.minMsg;this.maxMsg=A.maxMsg;this.pattern=A.pattern;this.patternMsg=A.patternMsg;this.max=A.max;this.numeric=A.numeric;this.numericMsg=A.numericMsg;this.type=A.type;this.wait=A.wait;this.choose=A.choose;if(this.wait==null){this.wait=1000}}function easyForm(A){this.ajax=true;if(A.ajax!=null){this.ajax=A.ajax}this.response=null;this.remotePath=A.remotePath;this.submitAction=A.submitAction;this.href=A.url;this.vA={};this.rd={};this.submitData={};this.key=A.key;this.array=A.array;this.anchor=A.anchor;if(this.array!=null&&this.array.length>0){if(this.href!=null){this.breakUrl()}this.specialFunctions();this.arrayToObject();if(this.key!=null){this.activateSubmit()}}else{this.activateDelete()}}easyForm.prototype.breakUrl=function(){var B=this;var C=this.href.split("#");var D=C[1].split("&");for(i=0;i<D.length;i++){var A=D[i].split("=");B.submitData[A[0]]=A[1]}};easyForm.prototype.breakAnchor=function(){var B=$(this.anchor).attr("href");var C=B.split("?");var D=C[1].split("&");for(i=0;i<D.length;i++){var A=D[i].split("=");this.pair[A[0]]=A[1];if(A[0]==this.pairKey){this.key=A[1]}}};easyForm.prototype.specialFunctions=function(){for(i=0;i<this.array.length;i++){var I=this.array[i];if(I.field.match(/date/gi)){var C=I.field;var L=C.replace(/f_/,"c_");var G=false;if($("#passData_"+this.key+" ."+L).html()!=null){if($("input[name='lastDateDelivery']").val()!=null){selectedDate=$("input[name='lastDateDelivery']").val()}else{selectedDate=$("#passData_"+this.key+" ."+L).html()}if(selectedDate!=""){var A=selectedDate.split("-");var K=new Date.parseIso8601(selectedDate)}else{K=new Date()}$("#"+C+"_pick").datepicker({defaultDate:K,dateFormat:"yy-mm-dd",onSelect:function(M){$("#"+C).val(M)}})}else{if($(".inlinePicker").html()!=null){if($("input[name='lastDateDelivery']").val()!=null){selectedDate=$("input[name='lastDateDelivery']").val()}else{selectedDate=$(".inlinePicker").next().children("input").val()}if(selectedDate!=""){var A=selectedDate.split("-");var K=new Date.parseIso8601(selectedDate)}else{K=new Date()}var E=K;var F=E.add(3,"days");var B=K.add(8,"weeks");var H=new Array();for(bo=0;bo<javaDates.length;bo++){var D=Date.parseIso8601(javaDates[bo])+"";H.push(D)}$("#"+C+"_pick").datepicker({blackoutDates:H,minDate:F,maxDate:B,mandatory:true,defaultDate:K,dateFormat:"yy-mm-dd",onSelect:function(N){var M=Date.parseIso8601(N);isFillDate(M,$("#"+C+"_pick"),$("#"+C+"_pick").next().next().next(),M)}});G=true}else{K=new Date();$("#"+C+"_pick").datepicker({dateFormat:"yy-mm-dd",onSelect:function(M){$("#"+C).val(M)}})}}}if(I.valid=="Other"){var J=I.field;var L=J.replace(/f_/,"c_");if($("#passData_"+this.key+" ."+L).html()=="Other"){$("#"+J+"_other:hidden").fadeIn()}$("#"+J).change(function(){var M=$(this).attr("id");if($(this).val()=="Other"){$("#"+M+"_other:hidden").fadeIn()}else{$("#"+M+"_other:visible").fadeOut()}})}}};easyForm.prototype.arrayToObject=function(){for(i=0;i<this.array.length;i++){var A=this.array[i];if(A.required!="n"){if(A.field.match(/date/gi)){this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"Please select a date"})}else{if(A.field.match(/email/gi)){this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"Please enter your e-mail address"})}else{if(A.field.match(/name/gi)){this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"Please enter a name"})}else{if(A.field.match(/address/gi)){this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"Please enter an address"})}else{if(A.field.match(/city/gi)){this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"Please enter a city"})}else{if(A.field.match(/state/gi)){this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"Please enter a state",max:2,maxMsg:"please enter your 2 letter state code",min:2,minMsg:"please enter your 2 letter state code"})}else{if(A.field.match(/postal/gi)||A.field.match(/zip/gi)){this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"Please enter a zip code",pattern:/^([0-9]{5})([\-]{1}[0-9]{4})?$/,patternMsg:"Please enter in 5 or 5-4 format"})}else{if(A.field.match(/match/i)){this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"Fields do not match"})}else{if(A.field.match(/password/gi)){this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"Your password must be between 6 and 12 characters in length",min:6,minMsg:"Your password must be between 6 and 12 characters in length",max:12,maxMsg:"Your password must be between 6 and 12 characters in length"})}else{if(A.field.match(/cvv/gi)){this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"Please enter the CVV number on your credit card",min:3,minMsg:"The cvv number is either 3 or 4 digits long",numeric:true,numericMsg:"The cvv number only contains digits"})}else{if(A.field.match(/month/gi)||A.field.match(/year/gi)){this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"This field is required",numeric:true,numericMsg:"Please enter as a digit"})}else{this.vA[A.field]=new validationBuilder({field:A.field,iMsg:"This field is required"})}}}}}}}}}}}}else{}}this.setValidation()};easyForm.prototype.setValidation=function(){for(var i in this.vA){eval("var valid_"+this.vA[i].field+"= new LiveValidation('"+this.vA[i].field+"',{validMessage:' ',wait:"+this.vA[i].wait+"});");if(this.vA[i].required!="n"){eval("valid_"+this.vA[i].field+".add(Validate.Presence,{failureMessage:'"+this.vA[i].iMsg+"'});")}if(this.vA[i].max!=null){eval("valid_"+this.vA[i].field+".add(Validate.Length,{maximum:"+this.vA[i].max+",failureMessage:'"+this.vA[i].maxMsg+"'});")}if(this.vA[i].min!=null){eval("valid_"+this.vA[i].field+".add(Validate.Length,{minimum:"+this.vA[i].min+",failureMessage:'"+this.vA[i].minMsg+"'});")}if(this.vA[i].numeric!=null){eval("valid_"+this.vA[i].field+".add(Validate.Numericality,{notAnIntegerMessage:'"+this.vA[i].numericMsg+"'});")}if(this.vA[i].field.match(/phone/gi)){eval("valid_"+this.vA[i].field+".add(Validate.Format,{pattern: /[0-9]{3}-[0-9]{3}-[0-9]{4}/,failureMessage:'Please enter a valid phone # (XXX-XXX-XXXX)'});")}if(this.vA[i].field.match(/email/gi)){eval("valid_"+this.vA[i].field+".add(Validate.Email);")}if(this.vA[i].field.match(/match/i)){var matchField=$("#"+this.vA[i].field).attr("matches");eval("valid_"+this.vA[i].field+".add(Validate.Confirmation,{match:'"+matchField+"',failureMessage:'Passwords do not match'});")}if(this.vA[i].pattern!=null){eval("valid_"+this.vA[i].field+".add(Validate.Format,{pattern:"+this.vA[i].pattern+",failureMessage:'"+this.vA[i].patternMsg+"'});")}}};easyForm.prototype.passData=function(){$("#passData_"+this.key+" span").each(function(){var B=this;if($(this).attr("class")&&$(this).attr("class").match(/c_/)){var C=$(this).attr("class").replace(/c_/,"f_");if($("#"+C)){$("#"+C).val($(this).text());$("select#"+C).each(function(){$(this).children().each(function(){if(parseFloat($(this).attr("value"))==parseFloat($(B).text())){$(this).attr("selected","selected")}else{if($(this).text().toUpperCase()==$(B).text().toUpperCase()){$(this).attr("selected","selected")}}})});$("#"+C+"[class='noedit']").html($(this).text());if(document.getElementById(C).nodeName.toUpperCase()=="UL"){$("#"+C+" input").each(function(){if($(this).val()==$(B).text()){$(this).attr("checked","checked")}else{$(this).attr("checked","")}})}}var A=$(this).attr("class").replace(/c_/,"p_");if($("#"+A)){$("#"+A).text($(this).text())}}})};easyForm.prototype.reverseData=function(){for(i in this.rd){var A=i.replace(/f_/,"c_");if(A!=undefined&&A!=null){$("#passData_"+this.key+" span."+A).html(this.rd[i])}}};easyForm.prototype.reloadData=function(){window.location.href=window.location.href};easyForm.prototype.removeData=function(){if($("#upcomingData_"+this.key).html()!=null){var A=$("#upcomingData_"+this.key).parent();$("#upcomingData_"+this.key).remove();if(!A.is(':has("tr")')){$("#upcomingTable").remove()}}$("#passData_"+this.key).fadeOut("slow",function(){$(this).remove();$.modal.close()})};easyForm.prototype.labelWriter=function(){var A=this;$("input:text").each(function(){A.labelWrite(this)});$(":text").keyup(function(){A.labelWrite(this)});$(":text").blur(function(){A.labelWrite(this)})};easyForm.prototype.labelWrite=function(A){var C=$(A).attr("id");if(C!=undefined){var B=C.replace(/f_/,"p_");$("#"+B).html($(A).val())}};easyForm.prototype.activateDelete=function(){var A=this;$("#modalContainer button").click(function(){var B=$("#modalContainer form").attr("id")+"Id";A.submitData[B]=A.key;var C=A.completeSubmit("delete");return false})};easyForm.prototype.activateSubmit=function(){var B=0;var A=this;$("#modal_ae form").submit(function(){$("#modalContainer .failure").remove();$("#modal_ae form input").each(function(){var E=$(this).attr("type");if(E=="hidden"||E=="text"){var D=$(this).attr("name");var F=$(this).attr("id");var G=$(this).val();A.submitData[D]=G;A.rd[F]=G}else{if(E=="radio"||E=="checkbox"){if($(this).is(":checked")){var D=$(this).attr("name");var F=$(this).attr("id");var G=$(this).val();A.submitData[D]=G;A.rd[F]=G}}}});$("#modal_ae form select").each(function(){var D=$(this).attr("name");var E=$(this).attr("id");var F=$(this).val();A.submitData[D]=F;A.rd[E]=F;$(this).children("option").each(function(){if($(this).attr("value")==F){A.rd[E]=$(this).html()}})});$("#modal_ae form textarea").each(function(){var D=$(this).attr("name");var E=$(this).attr("id");var F=$(this).html();A.submitData[D]=F;A.rd[E]=F});$("#modal_ae .noedit").each(function(){var D=$(this).attr("name");var E=$(this).attr("id");var F=$(this).html();A.submitData[D]=F;A.rd[E]=F});for(i=0;i<A.array.length;i++){if($("#"+A.array[i]).val()==""){B=1}}if($("span[class*='LV_invalid']").html()==null&&B==0){var C=A.completeSubmit("ae")}return false})};easyForm.prototype.completeSubmit=function(s_type){var ef=this;if(ef.ajax==true){ef.submitData.responseType="json";ef.remotePath=$("#modalContainer form").attr("action");$.ajax({type:"POST",cache:false,url:ef.remotePath,data:ef.submitData,dataType:"text",error:function(XMLHttpRequest,textStatus,errorThrown){alert(errorThrown+":"+textStatus)},success:function(data){var nData=data.replace(/\n/gi,"");eval("var eData= "+nData);$("#modalContainer .success").remove();$("#modalContainer .failure").remove();if(nData.length<20){$("#modalContainer h2").after('<div class="success"><b>Update successful.</b><div class="sub_msg">This window will close in 3 seconds</div></div>');$("#shipto_"+this.key).append('<option value="'+eData.id+'" selected >'+ef.submitData.nickName+"</option>");setTimeout("closeModal()",3000);if(ef.submitAction==null){if(s_type!="delete"){ef.reverseData()}else{ef.removeData()}}else{eval("ef."+ef.submitAction+"()")}return true}else{if(eData.error==true){var dE=0;var errors=eData.errorData;for(var i in errors){if(i=="serverSideMessage"){dE++;$("#modalContainer h2").after('<div class="failure">Sorry. We\'ve encountered an error. '+errors.serverSideMessage+"</div>");if(errors.serverSideMessage.match(/Address Not Found/gi)!=null){$("#usps_notfound").show()}}else{$("#f_"+i).next().remove();$("#f_"+i).addClass("LV_invalid_field").after('<span class="LV_validation_message LV_invalid">'+errors[i]+"</span>")}}if(dE==0){$("#modalContainer h2").after('<div class="failure">Sorry. We\'ve encountered an error. Please check your information.</div>')}return false}else{return true}}}})}else{$("#modalContainer form").submit();return true}return false};var LiveValidation=function(B,A){this.initialize(B,A)};LiveValidation.VERSION="1.3 standalone";LiveValidation.TEXTAREA=1;LiveValidation.TEXT=2;LiveValidation.PASSWORD=3;LiveValidation.CHECKBOX=4;LiveValidation.SELECT=5;LiveValidation.FILE=6;LiveValidation.RADIO=7;LiveValidation.massValidate=function(C){var D=true;for(var B=0,A=C.length;B<A;++B){var E=C[B].validate();if(D){D=E}}return D};LiveValidation.prototype={validClass:"LV_valid",invalidClass:"LV_invalid",messageClass:"LV_validation_message",validFieldClass:"LV_valid_field",invalidFieldClass:"LV_invalid_field",initialize:function(D,C){var A=this;if(!D){throw new Error("LiveValidation::initialize - No element reference or element id has been provided!")}this.element=D.nodeName?D:document.getElementById(D);if(!this.element){throw new Error("LiveValidation::initialize - No element with reference or id of '"+D+"' exists!")}this.validations=[];this.elementType=this.getElementType();this.form=this.element.form;var B=C||{};this.validMessage=B.validMessage||"Thankyou!";var E=B.insertAfterWhatNode||this.element;this.insertAfterWhatNode=E.nodeType?E:document.getElementById(E);this.onValid=B.onValid||function(){this.insertMessage(this.createMessageSpan());this.addFieldClass()};this.onInvalid=B.onInvalid||function(){this.insertMessage(this.createMessageSpan());this.addFieldClass()};this.onlyOnBlur=B.onlyOnBlur||false;this.wait=B.wait||0;this.onlyOnSubmit=B.onlyOnSubmit||false;if(this.form){this.formObj=LiveValidationForm.getInstance(this.form);this.formObj.addField(this)}this.oldOnFocus=this.element.onfocus||function(){};this.oldOnBlur=this.element.onblur||function(){};this.oldOnClick=this.element.onclick||function(){};this.oldOnChange=this.element.onchange||function(){};this.oldOnKeyup=this.element.onkeyup||function(){};this.element.onfocus=function(F){A.doOnFocus(F);return A.oldOnFocus.call(this,F)};if(!this.onlyOnSubmit){switch(this.elementType){case LiveValidation.CHECKBOX:this.element.onclick=function(F){A.validate();return A.oldOnClick.call(this,F)};case LiveValidation.SELECT:case LiveValidation.FILE:this.element.onchange=function(F){A.validate();return A.oldOnChange.call(this,F)};break;default:if(!this.onlyOnBlur){this.element.onkeyup=function(F){A.deferValidation();return A.oldOnKeyup.call(this,F)}}this.element.onblur=function(F){A.doOnBlur(F);return A.oldOnBlur.call(this,F)}}}},destroy:function(){if(this.formObj){this.formObj.removeField(this);this.formObj.destroy()}this.element.onfocus=this.oldOnFocus;if(!this.onlyOnSubmit){switch(this.elementType){case LiveValidation.CHECKBOX:this.element.onclick=this.oldOnClick;case LiveValidation.SELECT:case LiveValidation.FILE:this.element.onchange=this.oldOnChange;break;default:if(!this.onlyOnBlur){this.element.onkeyup=this.oldOnKeyup}this.element.onblur=this.oldOnBlur}}this.validations=[];this.removeMessageAndFieldClass()},add:function(A,B){this.validations.push({type:A,params:B||{}});return this},remove:function(B,D){var E=false;for(var C=0,A=this.validations.length;C<A;C++){if(this.validations[C].type==B){if(this.validations[C].params==D){E=true;break}}}if(E){this.validations.splice(C,1)}return this},deferValidation:function(B){if(this.wait>=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.toUpperCase()=="TEXTAREA"):return LiveValidation.TEXTAREA;case (this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="TEXT"):return LiveValidation.TEXT;case (this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="HIDDEN"):return LiveValidation.TEXT;case (this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="PASSWORD"):return LiveValidation.PASSWORD;case (this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="CHECKBOX"):return LiveValidation.CHECKBOX;case (this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="FILE"):return LiveValidation.FILE;case (this.element.nodeName.toUpperCase()=="UL"||this.element.nodeName.toUpperCase()=="DIV"):return LiveValidation.RADIO;case (this.element.nodeName.toUpperCase()=="SELECT"):return LiveValidation.SELECT;case (this.element.nodeName.toUpperCase()=="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;C<A;++C){var B=this.validations[C];switch(B.type){case Validate.Presence:case Validate.Confirmation:case Validate.Acceptance:case Validate.Options:this.displayMessageWhenEmpty=true;this.validationFailed=!this.validateElement(B.type,B.params);break;default:this.validationFailed=!this.validateElement(B.type,B.params);break}if(this.validationFailed){return false}}this.message=this.validMessage;return true},validateElement:function(B,E){var F=(this.elementType==LiveValidation.SELECT)?this.element.options[this.element.selectedIndex].value:this.element.value;if(B==Validate.Acceptance){if(this.elementType!=LiveValidation.CHECKBOX){throw new Error("LiveValidation::validateElement - Element to validate acceptance must be a checkbox!")}F=this.element.checked}if(B==Validate.Options){var A=this.element.getElementsByTagName("input");var D=0;for(i=0;i<A.length;i++){if(A[i].checked){D++}}if(D>0){F=D}}var G=true;try{B(F,E)}catch(C){if(C instanceof Validate.Error){if(F!==""||(F===""&&this.displayMessageWhenEmpty)){this.validationFailed=true;this.message=C.message;G=false}}else{throw C}}finally{return G}},validate:function(){if(!this.element.disabled){var A=this.doValidations();if(A){this.onValid();return true}else{this.onInvalid();return false}}else{return true}},enable:function(){this.element.disabled=false;return this},disable:function(){this.element.disabled=true;this.removeMessageAndFieldClass();return this},createMessageSpan:function(){var A=document.createElement("span");var B=document.createTextNode(this.message);A.appendChild(B);return A},insertMessage:function(B){this.removeMessage();if((this.displayMessageWhenEmpty&&(this.elementType==LiveValidation.CHECKBOX||this.element.value==""))||this.element.value!=""){var A=this.validationFailed?this.invalidClass:this.validClass;B.className+=" "+this.messageClass+" "+A;if(this.insertAfterWhatNode.nextSibling){this.insertAfterWhatNode.parentNode.insertBefore(B,this.insertAfterWhatNode.nextSibling)}else{this.insertAfterWhatNode.parentNode.appendChild(B)}}},addFieldClass:function(){this.removeFieldClass();if(!this.validationFailed){if(this.displayMessageWhenEmpty||this.element.value!=""){if(this.element.className.indexOf(this.validFieldClass)==-1){this.element.className+=" "+this.validFieldClass}}}else{if(this.element.className.indexOf(this.invalidFieldClass)==-1){this.element.className+=" "+this.invalidFieldClass}}},removeMessage:function(){var A;var B=this.insertAfterWhatNode;while(B.nextSibling){if(B.nextSibling.nodeType===1){A=B.nextSibling;break}B=B.nextSibling}if(A&&A.className.indexOf(this.messageClass)!=-1){this.insertAfterWhatNode.parentNode.removeChild(A)}},removeFieldClass:function(){if(this.element.className.indexOf(this.invalidFieldClass)!=-1){this.element.className=this.element.className.split(this.invalidFieldClass).join("")}if(this.element.className.indexOf(this.validFieldClass)!=-1){this.element.className=this.element.className.split(this.validFieldClass).join(" ")}},removeMessageAndFieldClass:function(){this.removeMessage();this.removeFieldClass()}};var LiveValidationForm=function(A){this.initialize(A)};LiveValidationForm.instances={};LiveValidationForm.getInstance=function(A){var B=Math.random()*Math.random();if(!A.id){A.id="formId_"+B.toString().replace(/\./,"")+new Date().valueOf()}if(!LiveValidationForm.instances[A.id]){LiveValidationForm.instances[A.id]=new LiveValidationForm(A)}return LiveValidationForm.instances[A.id]};LiveValidationForm.prototype={initialize:function(B){this.name=B.id;this.element=B;this.fields=[];this.oldOnSubmit=this.element.onsubmit||function(){};var A=this;this.element.onsubmit=function(C){return(LiveValidation.massValidate(A.fields))?A.oldOnSubmit.call(this,C||window.event)!==false:false}},addField:function(A){this.fields.push(A)},removeField:function(C){var D=[];for(var B=0,A=this.fields.length;B<A;B++){if(this.fields[B]!==C){D.push(this.fields[B])}}this.fields=D},destroy:function(A){if(this.fields.length!=0&&!A){return false}this.element.onsubmit=this.oldOnSubmit;LiveValidationForm.instances[this.name]=null;return true}};var Validate={Presence:function(B,C){var C=C||{};var A=C.failureMessage||"Can't be empty!";if(B===""||B===null||B===undefined){Validate.fail(A)}return true},Numericality:function(J,E){var A=J;var J=Number(J);var E=E||{};var F=((E.minimum)||(E.minimum==0))?E.minimum:null;var C=((E.maximum)||(E.maximum==0))?E.maximum:null;var D=((E.is)||(E.is==0))?E.is:null;var G=E.notANumberMessage||"Must be a number!";var H=E.notAnIntegerMessage||"Must be an integer!";var I=E.wrongNumberMessage||"Must be "+D+"!";var B=E.tooLowMessage||"Must not be less than "+F+"!";var K=E.tooHighMessage||"Must not be more than "+C+"!";if(!isFinite(J)){Validate.fail(G)}if(E.onlyInteger&&(/\.0+$|\.$/.test(String(A))||J!=parseInt(J))){Validate.fail(H)}switch(true){case (D!==null):if(J!=Number(D)){Validate.fail(I)}break;case (F!==null&&C!==null):Validate.Numericality(J,{tooLowMessage:B,minimum:F});Validate.Numericality(J,{tooHighMessage:K,maximum:C});break;case (F!==null):if(J<Number(F)){Validate.fail(B)}break;case (C!==null):if(J>Number(C)){Validate.fail(K)}break}return true},Format:function(C,E){var C=String(C);var E=E||{};var A=E.failureMessage||"Not valid!";var B=E.pattern||/./;var D=E.negate||false;if(!D&&!B.test(C)){Validate.fail(A)}if(D&&B.test(C)){Validate.fail(A)}return true},Email:function(B,C){var C=C||{};var A=C.failureMessage||"Must be a valid email address!";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.length<Number(E)){Validate.fail(B)}break;case (H!==null):if(F.length>Number(H)){Validate.fail(D)}break;default:throw new Error("Validate::Length - Length(s) to validate against must be provided!")}return true},Inclusion:function(H,F){var F=F||{};var K=F.failureMessage||"Must be included in the list!";var G=(F.caseSensitive===false)?false:true;if(F.allowNull&&H==null){return true}if(!F.allowNull&&H==null){Validate.fail(K)}var D=F.within||[];if(!G){var A=[];for(var C=0,B=D.length;C<B;++C){var I=D[C];if(typeof I=="string"){I=I.toLowerCase()}A.push(I)}D=A;if(typeof H=="string"){H=H.toLowerCase()}}var J=false;for(var E=0,B=D.length;E<B;++E){if(D[E]==H){J=true}if(F.partialMatch){if(H.indexOf(D[E])!=-1){J=true}}}if((!F.negate&&!J)||(F.negate&&J)){Validate.fail(K)}return true},Exclusion:function(A,B){var B=B||{};B.failureMessage=B.failureMessage||"Must not be included in the list!";B.negate=true;Validate.Inclusion(A,B);return true},Confirmation:function(C,D){if(!D.match){throw new Error("Validate::Confirmation - Error validating confirmation: Id of element to match must be provided!")}var D=D||{};var B=D.failureMessage||"Does not match!";var A=D.match.nodeName?D.match:document.getElementById(D.match);if(!A){throw new Error("Validate::Confirmation - There is no reference with name of, or element with id of '"+D.match+"'!")}if(C!=A.value){Validate.fail(B)}return true},Acceptance:function(B,C){var C=C||{};var A=C.failureMessage||"Must be accepted!";if(!B){Validate.fail(A)}return true},Other:function(C,D){if(!D.match){throw new Error("Validate::Confirmation - Error validating confirmation: Id of element to match must be provided!")}var D=D||{};var B=D.failureMessage||"One of these fields is required!";var A=D.match.nodeName?D.match:document.getElementById(D.match);if(!A){throw new Error("Validate::Confirmation - There is no reference with name of, or element with id of '"+D.match+"'!")}if(C==""&&A.value==""){Validate.fail(B)}return true},Options:function(B,C){var C=C||{};var A=C.failureMessage||"Must be accepted!";if(!B){Validate.fail(A)}return true},Custom:function(D,E){var E=E||{};var B=E.against||function(){return true};var A=E.aargs||{};var C=E.failureMessage||"Not valid!";if(!B(D,A)){Validate.fail(C)}return true},now:function(A,D,C){if(!A){throw new Error("Validate::now - Validation function must be provided!")}var E=true;try{A(D,C||{})}catch(B){if(B instanceof Validate.Error){E=false}else{throw B}}finally{return E}},fail:function(A){throw new Validate.Error(A)},Error:function(A){this.message=A;this.name="ValidationError"}};