!function(t){var e=function(t){this.messages={defaultMessage:"This value seems to be invalid.",type:{email:"This value should be a valid email.",url:"This value should be a valid url.",urlstrict:"This value should be a valid url.",number:"This value should be a valid number.",digits:"This value should be digits.",dateIso:"This value should be a valid date (YYYY-MM-DD).",alphanum:"This value should be alphanumeric."},notnull:"This value should not be null.",notblank:"This value should not be blank.",required:"This value is required.",regexp:"This value seems to be invalid.",min:"This value should be greater than %s.",max:"This value should be lower than %s.",range:"This value should be between %s and %s.",minlength:"This value is too short. It should have %s characters or more.",maxlength:"This value is too long. It should have %s characters or less.",rangelength:"This value length is invalid. It should be between %s and %s characters long.",mincheck:"You must select at least %s choices.",maxcheck:"You must select %s choices or less.",rangecheck:"You must select between %s and %s choices.",equalto:"This value should be the same."},this.init(t)};e.prototype={constructor:e,validators:{notnull:function(t){return 0=e},maxlength:function(t,e){return t.length<=e},rangelength:function(t,e){return this.minlength(t,e[0])&&this.maxlength(t,e[1])},min:function(t,e){return Number(t)>=e},max:function(t,e){return Number(t)<=e},range:function(t,e){return t>=e[0]&&t<=e[1]},equalto:function(e,s){return e===t(s).val()},remote:function(e,s,i){var n={},r={};n[i.$element.attr("name")]=e,"undefined"!=typeof i.options.remoteDatatype&&(r={dataType:i.options.remoteDatatype});var a=function(t){i.updateConstraint("remote","isValid",t),i.manageValidationResult()};return t.ajax(t.extend({},{url:s,data:n,async:i.async,method:i.options.remoteMethod||"GET",success:function(t){a("1"===t||"true"==t||"object"==typeof t&&"undefined"!=typeof t.success||/success/i.test(t))},error:function(){a(!1)}},r)),i.async&&a(null),null},mincheck:function(t,e){return this.minlength(t,e)},maxcheck:function(t,e){return this.maxlength(t,e)},rangecheck:function(t,e){return this.rangelength(t,e)}},init:function(t){var e=t.validators;t=t.messages;for(var s in e)this.addValidator(s,e[s]);for(s in t)this.addMessage(s,t[s])},formatMesssage:function(t,e){if("object"==typeof e){for(var s in e)t=this.formatMesssage(t,e[s]);return t}return t.replace(/%s/i,e)},addValidator:function(t,e){this.validators[t]=e},addMessage:function(t,e,s){if("undefined"!=typeof s&&!0===s)this.messages.type[t]=e;else if("type"===t)for(var i in e)this.messages.type[i]=e[i];else this.messages[t]=e}};var s=function(t,s,i){this.options=s,this.Validator=new e(s),this.init(t,i||"ParsleyField")};s.prototype={constructor:s,init:function(e,s){this.type=s,this.isValid=!0,this.element=e,this.validatedOnce=!1,this.$element=t(e),this.val=this.$element.val(),this.isRequired=!1,this.constraints=[],"undefined"==typeof this.isRadioOrCheckbox&&(this.isRadioOrCheckbox=!1,this.hash=this.generateHash(),this.errorClassHandler=this.options.errors.classHandler(e)||this.$element),this.ulErrorManagement(),this.bindHtml5Constraints(),this.addConstraints(),this.constraints.length&&this.bindValidationEvents()},bindHtml5Constraints:function(){(this.$element.hasClass("required")||this.$element.attr("required"))&&(this.options.required=!0),"undefined"!=typeof this.$element.attr("type")&&RegExp(this.$element.attr("type"),"i").test("email url number range")&&(this.options.type=this.$element.attr("type"),RegExp(this.options.type,"i").test("number range")&&(this.options.type="number","undefined"!=typeof this.$element.attr("min")&&this.$element.attr("min").length&&(this.options.min=this.$element.attr("min")),"undefined"!=typeof this.$element.attr("max")&&this.$element.attr("max").length&&(this.options.max=this.$element.attr("max"))))},addConstraints:function(){for(var t in this.options)t=t.toLowerCase(),"function"==typeof this.Validator.validators[t]&&(this.constraints.push({name:t,requirements:this.options[t],isValid:null}),"required"===t&&(this.isRequired=!0),this.addCustomConstraintMessage(t))},addCustomConstraintMessage:function(t){var e=t+("type"===t?this.options[t].charAt(0).toUpperCase()+this.options[t].substr(1):"")+"Message";"undefined"!=typeof this.options[e]&&this.Validator.addMessage("type"===t?this.options[t]:t,this.options[e],"type"===t)},bindValidationEvents:function(){this.$element.addClass("parsley-validated");var e=this.options.trigger+(/key/i.test(this.options.trigger)?"":" keyup");this.options.remote&&(e+=/change/i.test(e)?"":" change"),e&&this.$element.on((e+" ").split(" ").join("."+this.type+" "),!1,t.proxy(this.eventValidation,this))},generateHash:function(){return"parsley-"+(Math.random()+"").substring(2)},getHash:function(){return this.hash},getVal:function(){return this.$element.val()},eventValidation:function(t){var e=this.getVal();return"keyup"===t.type&&!/keyup/i.test(this.options.trigger)&&!this.validatedOnce||e.length",errorElem:"
  • "},listeners:{onFieldValidate:function(){return!1},onFormSubmit:function(){},onFieldError:function(){},onFieldSuccess:function(){}}},t(window).on("load",function(){t('[data-validate="parsley"]').each(function(){t(this).parsley()})})}(window.jQuery||window.Zepto);