/*! jquery validation plugin - v1.14.0 - 6/30/2015 * http://jqueryvalidation.org/ * copyright (c) 2015 jörn zaefferer; licensed mit */ !function (a) { "function" == typeof define && define.amd ? define(["jquery"], a) : a(jquery) }(function (a) { a.extend(a.fn, { validate: function (b) { if (!this.length) return void (b && b.debug && window.console && console.warn("nothing selected, can't validate, returning nothing.")); var c = a.data(this[0], "validator"); return c ? c : (this.attr("novalidate", "novalidate"), c = new a.validator(b, this[0]), a.data(this[0], "validator", c), c.settings.onsubmit && (this.on("click.validate", ":submit", function (b) { c.settings.submithandler && (c.submitbutton = b.target), a(this).hasclass("cancel") && (c.cancelsubmit = !0), void 0 !== a(this).attr("formnovalidate") && (c.cancelsubmit = !0) }), this.on("submit.validate", function (b) { function d() { var d, e; return c.settings.submithandler ? (c.submitbutton && (d = a("").attr("name", c.submitbutton.name).val(a(c.submitbutton).val()).appendto(c.currentform)), e = c.settings.submithandler.call(c, c.currentform, b), c.submitbutton && d.remove(), void 0 !== e ? e : !1) : !0 } return c.settings.debug && b.preventdefault(), c.cancelsubmit ? (c.cancelsubmit = !1, d()) : c.form() ? c.pendingrequest ? (c.formsubmitted = !0, !1) : d() : (c.focusinvalid(), !1) })), c) }, valid: function () { var b, c, d; return a(this[0]).is("form") ? b = this.validate().form() : (d = [], b = !0, c = a(this[0].form).validate(), this.each(function () { b = c.element(this) && b, d = d.concat(c.errorlist) }), c.errorlist = d), b }, rules: function (b, c) { var d, e, f, g, h, i, j = this[0]; if (b) switch (d = a.data(j.form, "validator").settings, e = d.rules, f = a.validator.staticrules(j), b) { case "add": a.extend(f, a.validator.normalizerule(c)), delete f.messages, e[j.name] = f, c.messages && (d.messages[j.name] = a.extend(d.messages[j.name], c.messages)); break; case "remove": return c ? (i = {}, a.each(c.split(/\s/), function (b, c) { i[c] = f[c], delete f[c], "required" === c && a(j).removeattr("aria-required") }), i) : (delete e[j.name], f) } return g = a.validator.normalizerules(a.extend({}, a.validator.classrules(j), a.validator.attributerules(j), a.validator.datarules(j), a.validator.staticrules(j)), j), g.required && (h = g.required, delete g.required, g = a.extend({ required: h }, g), a(j).attr("aria-required", "true")), g.remote && (h = g.remote, delete g.remote, g = a.extend(g, { remote: h })), g } }), a.extend(a.expr[":"], { blank: function (b) { return !a.trim("" + a(b).val()) }, filled: function (b) { return !!a.trim("" + a(b).val()) }, unchecked: function (b) { return !a(b).prop("checked") } }), a.validator = function (b, c) { this.settings = a.extend(!0, {}, a.validator.defaults, b), this.currentform = c, this.init() }, a.validator.format = function (b, c) { return 1 === arguments.length ? function () { var c = a.makearray(arguments); return c.unshift(b), a.validator.format.apply(this, c) } : (arguments.length > 2 && c.constructor !== array && (c = a.makearray(arguments).slice(1)), c.constructor !== array && (c = [c]), a.each(c, function (a, c) { b = b.replace(new regexp("\\{" + a + "\\}", "g"), function () { return c }) }), b) }, a.extend(a.validator, { defaults: { messages: {}, groups: {}, rules: {}, errorclass: "error", validclass: "valid", errorelement: "label", focuscleanup: !1, focusinvalid: !0, errorcontainer: a([]), errorlabelcontainer: a([]), onsubmit: !0, ignore: ":hidden", ignoretitle: !1, onfocusin: function (a) { this.lastactive = a, this.settings.focuscleanup && (this.settings.unhighlight && this.settings.unhighlight.call(this, a, this.settings.errorclass, this.settings.validclass), this.hidethese(this.errorsfor(a))) }, onfocusout: function (a) { this.checkable(a) || !(a.name in this.submitted) && this.optional(a) || this.element(a) }, onkeyup: function (b, c) { var d = [16, 17, 18, 20, 35, 36, 37, 38, 39, 40, 45, 144, 225]; 9 === c.which && "" === this.elementvalue(b) || -1 !== a.inarray(c.keycode, d) || (b.name in this.submitted || b === this.lastelement) && this.element(b) }, onclick: function (a) { a.name in this.submitted ? this.element(a) : a.parentnode.name in this.submitted && this.element(a.parentnode) }, highlight: function (b, c, d) { "radio" === b.type ? this.findbyname(b.name).addclass(c).removeclass(d) : a(b).addclass(c).removeclass(d) }, unhighlight: function (b, c, d) { "radio" === b.type ? this.findbyname(b.name).removeclass(c).addclass(d) : a(b).removeclass(c).addclass(d) } }, setdefaults: function (b) { a.extend(a.validator.defaults, b) }, messages: { required: "this field is required.", remote: "please fix this field.", email: "please enter a valid email address.", url: "please enter a valid url.", date: "please enter a valid date.", dateiso: "please enter a valid date ( iso ).", number: "please enter a valid number.", digits: "please enter only digits.", creditcard: "please enter a valid credit card number.", equalto: "please enter the same value again.", maxlength: a.validator.format("please enter no more than {0} characters."), minlength: a.validator.format("please enter at least {0} characters."), rangelength: a.validator.format("please enter a value between {0} and {1} characters long."), range: a.validator.format("please enter a value between {0} and {1}."), max: a.validator.format("please enter a value less than or equal to {0}."), min: a.validator.format("please enter a value greater than or equal to {0}.") }, autocreateranges: !1, prototype: { init: function () { function b(b) { var c = a.data(this.form, "validator"), d = "on" + b.type.replace(/^validate/, ""), e = c.settings; e[d] && !a(this).is(e.ignore) && e[d].call(c, this, b) } this.labelcontainer = a(this.settings.errorlabelcontainer), this.errorcontext = this.labelcontainer.length && this.labelcontainer || a(this.currentform), this.containers = a(this.settings.errorcontainer).add(this.settings.errorlabelcontainer), this.submitted = {}, this.valuecache = {}, this.pendingrequest = 0, this.pending = {}, this.invalid = {}, this.reset(); var c, d = this.groups = {}; a.each(this.settings.groups, function (b, c) { "string" == typeof c && (c = c.split(/\s/)), a.each(c, function (a, c) { d[c] = b }) }), c = this.settings.rules, a.each(c, function (b, d) { c[b] = a.validator.normalizerule(d) }), a(this.currentform).on("focusin.validate focusout.validate keyup.validate", ":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']", b).on("click.validate", "select, option, [type='radio'], [type='checkbox']", b), this.settings.invalidhandler && a(this.currentform).on("invalid-form.validate", this.settings.invalidhandler), a(this.currentform).find("[required], [data-rule-required], .required").attr("aria-required", "true") }, form: function () { return this.checkform(), a.extend(this.submitted, this.errormap), this.invalid = a.extend({}, this.errormap), this.valid() || a(this.currentform).triggerhandler("invalid-form", [this]), this.showerrors(), this.valid() }, checkform: function () { this.prepareform(); for (var a = 0, b = this.currentelements = this.elements() ; b[a]; a++) this.check(b[a]); return this.valid() }, element: function (b) { var c = this.clean(b), d = this.validationtargetfor(c), e = !0; return this.lastelement = d, void 0 === d ? delete this.invalid[c.name] : (this.prepareelement(d), this.currentelements = a(d), e = this.check(d) !== !1, e ? delete this.invalid[d.name] : this.invalid[d.name] = !0), a(b).attr("aria-invalid", !e), this.numberofinvalids() || (this.tohide = this.tohide.add(this.containers)), this.showerrors(), e }, showerrors: function (b) { if (b) { a.extend(this.errormap, b), this.errorlist = []; for (var c in b) this.errorlist.push({ message: b[c], element: this.findbyname(c)[0] }); this.successlist = a.grep(this.successlist, function (a) { return !(a.name in b) }) } this.settings.showerrors ? this.settings.showerrors.call(this, this.errormap, this.errorlist) : this.defaultshowerrors() }, resetform: function () { a.fn.resetform && a(this.currentform).resetform(), this.submitted = {}, this.lastelement = null, this.prepareform(), this.hideerrors(); var b, c = this.elements().removedata("previousvalue").removeattr("aria-invalid"); if (this.settings.unhighlight) for (b = 0; c[b]; b++) this.settings.unhighlight.call(this, c[b], this.settings.errorclass, ""); else c.removeclass(this.settings.errorclass) }, numberofinvalids: function () { return this.objectlength(this.invalid) }, objectlength: function (a) { var b, c = 0; for (b in a) c++; return c }, hideerrors: function () { this.hidethese(this.tohide) }, hidethese: function (a) { a.not(this.containers).text(""), this.addwrapper(a).hide() }, valid: function () { return 0 === this.size() }, size: function () { return this.errorlist.length }, focusinvalid: function () { if (this.settings.focusinvalid) try { a(this.findlastactive() || this.errorlist.length && this.errorlist[0].element || []).filter(":visible").focus().trigger("focusin") } catch (b) { } }, findlastactive: function () { var b = this.lastactive; return b && 1 === a.grep(this.errorlist, function (a) { return a.element.name === b.name }).length && b }, elements: function () { var b = this, c = {}; return a(this.currentform).find("input, select, textarea").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function () { return !this.name && b.settings.debug && window.console && console.error("%o has no name assigned", this), this.name in c || !b.objectlength(a(this).rules()) ? !1 : (c[this.name] = !0, !0) }) }, clean: function (b) { return a(b)[0] }, errors: function () { var b = this.settings.errorclass.split(" ").join("."); return a(this.settings.errorelement + "." + b, this.errorcontext) }, reset: function () { this.successlist = [], this.errorlist = [], this.errormap = {}, this.toshow = a([]), this.tohide = a([]), this.currentelements = a([]) }, prepareform: function () { this.reset(), this.tohide = this.errors().add(this.containers) }, prepareelement: function (a) { this.reset(), this.tohide = this.errorsfor(a) }, elementvalue: function (b) { var c, d = a(b), e = b.type; return "radio" === e || "checkbox" === e ? this.findbyname(b.name).filter(":checked").val() : "number" === e && "undefined" != typeof b.validity ? b.validity.badinput ? !1 : d.val() : (c = d.val(), "string" == typeof c ? c.replace(/\r/g, "") : c) }, check: function (b) { b = this.validationtargetfor(this.clean(b)); var c, d, e, f = a(b).rules(), g = a.map(f, function (a, b) { return b }).length, h = !1, i = this.elementvalue(b); for (d in f) { e = { method: d, parameters: f[d] }; try { if (c = a.validator.methods[d].call(this, i, b, e.parameters), "dependency-mismatch" === c && 1 === g) { h = !0; continue } if (h = !1, "pending" === c) return void (this.tohide = this.tohide.not(this.errorsfor(b))); if (!c) return this.formatandadd(b, e), !1 } catch (j) { throw this.settings.debug && window.console && console.log("exception occurred when checking element " + b.id + ", check the '" + e.method + "' method.", j), j instanceof typeerror && (j.message += ". exception occurred when checking element " + b.id + ", check the '" + e.method + "' method."), j } } if (!h) return this.objectlength(f) && this.successlist.push(b), !0 }, customdatamessage: function (b, c) { return a(b).data("msg" + c.charat(0).touppercase() + c.substring(1).tolowercase()) || a(b).data("msg") }, custommessage: function (a, b) { var c = this.settings.messages[a]; return c && (c.constructor === string ? c : c[b]) }, finddefined: function () { for (var a = 0; a < arguments.length; a++) if (void 0 !== arguments[a]) return arguments[a]; return void 0 }, defaultmessage: function (b, c) { return this.finddefined(this.custommessage(b.name, c), this.customdatamessage(b, c), !this.settings.ignoretitle && b.title || void 0, a.validator.messages[c], "warning: no message defined for " + b.name + "") }, formatandadd: function (b, c) { var d = this.defaultmessage(b, c.method), e = /\$?\{(\d+)\}/g; "function" == typeof d ? d = d.call(this, c.parameters, b) : e.test(d) && (d = a.validator.format(d.replace(e, "{$1}"), c.parameters)), this.errorlist.push({ message: d, element: b, method: c.method }), this.errormap[b.name] = d, this.submitted[b.name] = d }, addwrapper: function (a) { return this.settings.wrapper && (a = a.add(a.parent(this.settings.wrapper))), a }, defaultshowerrors: function () { var a, b, c; for (a = 0; this.errorlist[a]; a++) c = this.errorlist[a], this.settings.highlight && this.settings.highlight.call(this, c.element, this.settings.errorclass, this.settings.validclass), this.showlabel(c.element, c.message); if (this.errorlist.length && (this.toshow = this.toshow.add(this.containers)), this.settings.success) for (a = 0; this.successlist[a]; a++) this.showlabel(this.successlist[a]); if (this.settings.unhighlight) for (a = 0, b = this.validelements() ; b[a]; a++) this.settings.unhighlight.call(this, b[a], this.settings.errorclass, this.settings.validclass); this.tohide = this.tohide.not(this.toshow), this.hideerrors(), this.addwrapper(this.toshow).show() }, validelements: function () { return this.currentelements.not(this.invalidelements()) }, invalidelements: function () { return a(this.errorlist).map(function () { return this.element }) }, showlabel: function (b, c) { var d, e, f, g = this.errorsfor(b), h = this.idorname(b), i = a(b).attr("aria-describedby"); g.length ? (g.removeclass(this.settings.validclass).addclass(this.settings.errorclass), g.html(c)) : (g = a("<" + this.settings.errorelement + ">").attr("id", h + "-error").addclass(this.settings.errorclass).html(c || ""), d = g, this.settings.wrapper && (d = g.hide().show().wrap("<" + this.settings.wrapper + "/>").parent()), this.labelcontainer.length ? this.labelcontainer.append(d) : this.settings.errorplacement ? this.settings.errorplacement(d, a(b)) : d.insertafter(b), g.is("label") ? g.attr("for", h) : 0 === g.parents("label[for='" + h + "']").length && (f = g.attr("id").replace(/(:|\.|\[|\]|\$)/g, "\\$1"), i ? i.match(new regexp("\\b" + f + "\\b")) || (i += " " + f) : i = f, a(b).attr("aria-describedby", i), e = this.groups[b.name], e && a.each(this.groups, function (b, c) { c === e && a("[name='" + b + "']", this.currentform).attr("aria-describedby", g.attr("id")) }))), !c && this.settings.success && (g.text(""), "string" == typeof this.settings.success ? g.addclass(this.settings.success) : this.settings.success(g, b)), this.toshow = this.toshow.add(g) }, errorsfor: function (b) { var c = this.idorname(b), d = a(b).attr("aria-describedby"), e = "label[for='" + c + "'], label[for='" + c + "'] *"; return d && (e = e + ", #" + d.replace(/\s+/g, ", #")), this.errors().filter(e) }, idorname: function (a) { return this.groups[a.name] || (this.checkable(a) ? a.name : a.id || a.name) }, validationtargetfor: function (b) { return this.checkable(b) && (b = this.findbyname(b.name)), a(b).not(this.settings.ignore)[0] }, checkable: function (a) { return /radio|checkbox/i.test(a.type) }, findbyname: function (b) { return a(this.currentform).find("[name='" + b + "']") }, getlength: function (b, c) { switch (c.nodename.tolowercase()) { case "select": return a("option:selected", c).length; case "input": if (this.checkable(c)) return this.findbyname(c.name).filter(":checked").length } return b.length }, depend: function (a, b) { return this.dependtypes[typeof a] ? this.dependtypes[typeof a](a, b) : !0 }, dependtypes: { "boolean": function (a) { return a }, string: function (b, c) { return !!a(b, c.form).length }, "function": function (a, b) { return a(b) } }, optional: function (b) { var c = this.elementvalue(b); return !a.validator.methods.required.call(this, c, b) && "dependency-mismatch" }, startrequest: function (a) { this.pending[a.name] || (this.pendingrequest++, this.pending[a.name] = !0) }, stoprequest: function (b, c) { this.pendingrequest--, this.pendingrequest < 0 && (this.pendingrequest = 0), delete this.pending[b.name], c && 0 === this.pendingrequest && this.formsubmitted && this.form() ? (a(this.currentform).submit(), this.formsubmitted = !1) : !c && 0 === this.pendingrequest && this.formsubmitted && (a(this.currentform).triggerhandler("invalid-form", [this]), this.formsubmitted = !1) }, previousvalue: function (b) { return a.data(b, "previousvalue") || a.data(b, "previousvalue", { old: null, valid: !0, message: this.defaultmessage(b, "remote") }) }, destroy: function () { this.resetform(), a(this.currentform).off(".validate").removedata("validator") } }, classrulesettings: { required: { required: !0 }, email: { email: !0 }, url: { url: !0 }, date: { date: !0 }, dateiso: { dateiso: !0 }, number: { number: !0 }, digits: { digits: !0 }, creditcard: { creditcard: !0 } }, addclassrules: function (b, c) { b.constructor === string ? this.classrulesettings[b] = c : a.extend(this.classrulesettings, b) }, classrules: function (b) { var c = {}, d = a(b).attr("class"); return d && a.each(d.split(" "), function () { this in a.validator.classrulesettings && a.extend(c, a.validator.classrulesettings[this]) }), c }, normalizeattributerule: function (a, b, c, d) { /min|max/.test(c) && (null === b || /number|range|text/.test(b)) && (d = number(d), isnan(d) && (d = void 0)), d || 0 === d ? a[c] = d : b === c && "range" !== b && (a[c] = !0) }, attributerules: function (b) { var c, d, e = {}, f = a(b), g = b.getattribute("type"); for (c in a.validator.methods) "required" === c ? (d = b.getattribute(c), "" === d && (d = !0), d = !!d) : d = f.attr(c), this.normalizeattributerule(e, g, c, d); return e.maxlength && /-1|2147483647|524288/.test(e.maxlength) && delete e.maxlength, e }, datarules: function (b) { var c, d, e = {}, f = a(b), g = b.getattribute("type"); for (c in a.validator.methods) d = f.data("rule" + c.charat(0).touppercase() + c.substring(1).tolowercase()), this.normalizeattributerule(e, g, c, d); return e }, staticrules: function (b) { var c = {}, d = a.data(b.form, "validator"); return d.settings.rules && (c = a.validator.normalizerule(d.settings.rules[b.name]) || {}), c }, normalizerules: function (b, c) { return a.each(b, function (d, e) { if (e === !1) return void delete b[d]; if (e.param || e.depends) { var f = !0; switch (typeof e.depends) { case "string": f = !!a(e.depends, c.form).length; break; case "function": f = e.depends.call(c, c) } f ? b[d] = void 0 !== e.param ? e.param : !0 : delete b[d] } }), a.each(b, function (d, e) { b[d] = a.isfunction(e) ? e(c) : e }), a.each(["minlength", "maxlength"], function () { b[this] && (b[this] = number(b[this])) }), a.each(["rangelength", "range"], function () { var c; b[this] && (a.isarray(b[this]) ? b[this] = [number(b[this][0]), number(b[this][1])] : "string" == typeof b[this] && (c = b[this].replace(/[\[\]]/g, "").split(/[\s,]+/), b[this] = [number(c[0]), number(c[1])])) }), a.validator.autocreateranges && (null != b.min && null != b.max && (b.range = [b.min, b.max], delete b.min, delete b.max), null != b.minlength && null != b.maxlength && (b.rangelength = [b.minlength, b.maxlength], delete b.minlength, delete b.maxlength)), b }, normalizerule: function (b) { if ("string" == typeof b) { var c = {}; a.each(b.split(/\s/), function () { c[this] = !0 }), b = c } return b }, addmethod: function (b, c, d) { a.validator.methods[b] = c, a.validator.messages[b] = void 0 !== d ? d : a.validator.messages[b], c.length < 3 && a.validator.addclassrules(b, a.validator.normalizerule(b)) }, methods: { required: function (b, c, d) { if (!this.depend(d, c)) return "dependency-mismatch"; if ("select" === c.nodename.tolowercase()) { var e = a(c).val(); return e && e.length > 0 } return this.checkable(c) ? this.getlength(b, c) > 0 : b.length > 0 }, email: function (a, b) { return this.optional(b) || /^[a-za-z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-za-z0-9](?:[a-za-z0-9-]{0,61}[a-za-z0-9])?(?:\.[a-za-z0-9](?:[a-za-z0-9-]{0,61}[a-za-z0-9])?)*$/.test(a) }, url: function (a, b) { return this.optional(b) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\s+(?::\s*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\s*)?$/i.test(a) }, date: function (a, b) { return this.optional(b) || !/invalid|nan/.test(new date(a).tostring()) }, dateiso: function (a, b) { return this.optional(b) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a) }, number: function (a, b) { return this.optional(b) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a) }, digits: function (a, b) { return this.optional(b) || /^\d+$/.test(a) }, creditcard: function (a, b) { if (this.optional(b)) return "dependency-mismatch"; if (/[^0-9 \-]+/.test(a)) return !1; var c, d, e = 0, f = 0, g = !1; if (a = a.replace(/\d/g, ""), a.length < 13 || a.length > 19) return !1; for (c = a.length - 1; c >= 0; c--) d = a.charat(c), f = parseint(d, 10), g && (f *= 2) > 9 && (f -= 9), e += f, g = !g; return e % 10 === 0 }, minlength: function (b, c, d) { var e = a.isarray(b) ? b.length : this.getlength(b, c); return this.optional(c) || e >= d }, maxlength: function (b, c, d) { var e = a.isarray(b) ? b.length : this.getlength(b, c); return this.optional(c) || d >= e }, rangelength: function (b, c, d) { var e = a.isarray(b) ? b.length : this.getlength(b, c); return this.optional(c) || e >= d[0] && e <= d[1] }, min: function (a, b, c) { return this.optional(b) || a >= c }, max: function (a, b, c) { return this.optional(b) || c >= a }, range: function (a, b, c) { return this.optional(b) || a >= c[0] && a <= c[1] }, equalto: function (b, c, d) { var e = a(d); return this.settings.onfocusout && e.off(".validate-equalto").on("blur.validate-equalto", function () { a(c).valid() }), b === e.val() }, remote: function (b, c, d) { if (this.optional(c)) return "dependency-mismatch"; var e, f, g = this.previousvalue(c); return this.settings.messages[c.name] || (this.settings.messages[c.name] = {}), g.originalmessage = this.settings.messages[c.name].remote, this.settings.messages[c.name].remote = g.message, d = "string" == typeof d && { url: d } || d, g.old === b ? g.valid : (g.old = b, e = this, this.startrequest(c), f = {}, f[c.name] = b, a.ajax(a.extend(!0, { mode: "abort", port: "validate" + c.name, datatype: "json", data: f, context: e.currentform, success: function (d) { var f, h, i, j = d === !0 || "true" === d; e.settings.messages[c.name].remote = g.originalmessage, j ? (i = e.formsubmitted, e.prepareelement(c), e.formsubmitted = i, e.successlist.push(c), delete e.invalid[c.name], e.showerrors()) : (f = {}, h = d || e.defaultmessage(c, "remote"), f[c.name] = g.message = a.isfunction(h) ? h(b) : h, e.invalid[c.name] = !0, e.showerrors(f)), g.valid = j, e.stoprequest(c, j) } }, d)), "pending") } } }); var b, c = {}; a.ajaxprefilter ? a.ajaxprefilter(function (a, b, d) { var e = a.port; "abort" === a.mode && (c[e] && c[e].abort(), c[e] = d) }) : (b = a.ajax, a.ajax = function (d) { var e = ("mode" in d ? d : a.ajaxsettings).mode, f = ("port" in d ? d : a.ajaxsettings).port; return "abort" === e ? (c[f] && c[f].abort(), c[f] = b.apply(this, arguments), c[f]) : b.apply(this, arguments) }) }); //验证电话:固话/手机号 jquery.validator.addmethod("istel", function (value, element) { var reg = /^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$|(^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])\d{8}$)/; return this.optional(element) || (reg.test(value)); }, "*"); //验证手机号 jquery.validator.addmethod("isphone", function (value, element) { var reg = /(^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])\d{8}$)/; return this.optional(element) || (reg.test(value)); }, "*"); // 身份证号码验证 jquery.validator.addmethod("isidcardno", function (value, element) { return this.optional(element) || isidcardno(value); }, "*"); function isidcardno(num) { var factorarr = new array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1); var paritybit = new array('1', '0', 'x', '9', '8', '7', '6', '5', '4', '3', '2'); var vararray = new array(); var intvalue; var lngproduct = 0; var intcheckdigit; var intstrlen = num.length; var idnumber = num; // initialize if ((intstrlen != 15) && (intstrlen != 18)) { return false; } // check and set value for (i = 0; i < intstrlen; i++) { vararray[i] = idnumber.charat(i); if ((vararray[i] < '0' || vararray[i] > '9') && (i != 17)) { return false; } else if (i < 17) { vararray[i] = vararray[i] * factorarr[i]; } } if (intstrlen == 18) { //check date var date8 = idnumber.substring(6, 14); if (isdate8(date8) == false) { return false; } // calculate the sum of the products for (i = 0; i < 17; i++) { lngproduct = lngproduct + vararray[i]; } // calculate the check digit intcheckdigit = paritybit[lngproduct % 11]; // check last digit if (vararray[17] != intcheckdigit) { return false; } } else { //length is 15 //check date var date6 = idnumber.substring(6, 12); if (isdate6(date6) == false) { return false; } } return true; } function isdate6(sdate) { if (!/^[0-9]{6}$/.test(sdate)) { return false; } var year, month, day; year = sdate.substring(0, 4); month = sdate.substring(4, 6); if (year < 1700 || year > 2500) return false if (month < 1 || month > 12) return false return true } function isdate8(sdate) { if (!/^[0-9]{8}$/.test(sdate)) { return false; } var year, month, day; year = sdate.substring(0, 4); month = sdate.substring(4, 6); day = sdate.substring(6, 8); var iamonthdays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] if (year < 1700 || year > 2500) return false if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) iamonthdays[1] = 29; if (month < 1 || month > 12) return false if (day < 1 || day > iamonthdays[month - 1]) return false return true }