Initial commit
[2ch-be.git] / dev-test / artist / js / jquery.validate.min.js
blob15a7c8af1750a6aebdaeeff066ae3ed0587be228
1 /**
2  * jQuery Validation Plugin 1.9.0
3  *
4  * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
5  * http://docs.jquery.com/Plugins/Validation
6  *
7  * Copyright (c) 2006 - 2011 Jörn Zaefferer
8  *
9  * Dual licensed under the MIT and GPL licenses:
10  *   http://www.opensource.org/licenses/mit-license.php
11  *   http://www.gnu.org/licenses/gpl.html
12  */
13 (function (c) {
14     c.extend(c.fn, {
15         validate: function (a) {
16             if (this.length) {
17                 var b = c.data(this[0], "validator");
18                 if (b) return b;
19                 this.attr("novalidate", "novalidate");
20                 b = new c.validator(a, this[0]);
21                 c.data(this[0], "validator", b);
22                 if (b.settings.onsubmit) {
23                     a = this.find("input, button");
24                     a.filter(".cancel").click(function () {
25                         b.cancelSubmit = true
26                     });
27                     b.settings.submitHandler && a.filter(":submit").click(function () {
28                         b.submitButton = this
29                     });
30                     this.submit(function (d) {
31                         function e() {
32                             if (b.settings.submitHandler) {
33                                 if (b.submitButton) var f = c("<input type='hidden'/>").attr("name",
34                                     b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);
35                                 b.settings.submitHandler.call(b, b.currentForm);
36                                 b.submitButton && f.remove();
37                                 return false
38                             }
39                             return true
40                         }
41                         b.settings.debug && d.preventDefault();
42                         if (b.cancelSubmit) {
43                             b.cancelSubmit = false;
44                             return e()
45                         }
46                         if (b.form()) {
47                             if (b.pendingRequest) {
48                                 b.formSubmitted = true;
49                                 return false
50                             }
51                             return e()
52                         } else {
53                             b.focusInvalid();
54                             return false
55                         }
56                     })
57                 }
58                 return b
59             } else a && a.debug && window.console && console.warn("nothing selected, can't validate, returning nothing")
60         },
61         valid: function () {
62             if (c(this[0]).is("form")) return this.validate().form();
63             else {
64                 var a = true,
65                     b = c(this[0].form).validate();
66                 this.each(function () {
67                     a &= b.element(this)
68                 });
69                 return a
70             }
71         },
72         removeAttrs: function (a) {
73             var b = {},
74                 d = this;
75             c.each(a.split(/\s/), function (e, f) {
76                 b[f] = d.attr(f);
77                 d.removeAttr(f)
78             });
79             return b
80         },
81         rules: function (a, b) {
82             var d = this[0];
83             if (a) {
84                 var e = c.data(d.form, "validator").settings,
85                     f = e.rules,
86                     g = c.validator.staticRules(d);
87                 switch (a) {
88                 case "add":
89                     c.extend(g, c.validator.normalizeRule(b));
90                     f[d.name] = g;
91                     if (b.messages) e.messages[d.name] = c.extend(e.messages[d.name], b.messages);
92                     break;
93                 case "remove":
94                     if (!b) {
95                         delete f[d.name];
96                         return g
97                     }
98                     var h = {};
99                     c.each(b.split(/\s/), function (j, i) {
100                         h[i] = g[i];
101                         delete g[i]
102                     });
103                     return h
104                 }
105             }
106             d = c.validator.normalizeRules(c.extend({}, c.validator.metadataRules(d), c.validator.classRules(d), c.validator.attributeRules(d), c.validator.staticRules(d)), d);
107             if (d.required) {
108                 e = d.required;
109                 delete d.required;
110                 d = c.extend({
111                     required: e
112                 }, d)
113             }
114             return d
115         }
116     });
117     c.extend(c.expr[":"], {
118         blank: function (a) {
119             return !c.trim("" + a.value)
120         },
121         filled: function (a) {
122             return !!c.trim("" + a.value)
123         },
124         unchecked: function (a) {
125             return !a.checked
126         }
127     });
128     c.validator = function (a,
129         b) {
130         this.settings = c.extend(true, {}, c.validator.defaults, a);
131         this.currentForm = b;
132         this.init()
133     };
134     c.validator.format = function (a, b) {
135         if (arguments.length == 1) return function () {
136             var d = c.makeArray(arguments);
137             d.unshift(a);
138             return c.validator.format.apply(this, d)
139         };
140         if (arguments.length > 2 && b.constructor != Array) b = c.makeArray(arguments).slice(1);
141         if (b.constructor != Array) b = [b];
142         c.each(b, function (d, e) {
143             a = a.replace(RegExp("\\{" + d + "\\}", "g"), e)
144         });
145         return a
146     };
147     c.extend(c.validator, {
148         defaults: {
149             messages: {},
150             groups: {},
151             rules: {},
152             errorClass: "control-label",
153             validClass: "control-label",
154             errorElement: "span",
155             focusInvalid: true,
156             errorContainer: c([]),
157             errorLabelContainer: c([]),
158             onsubmit: true,
159             ignore: ":hidden",
160             ignoreTitle: false,
161             onfocusin: function (a) {
162                 this.lastActive = a;
163                 if (this.settings.focusCleanup && !this.blockFocusCleanup) {
164                     this.settings.unhighlight && this.settings.unhighlight.call(this, a, this.settings.errorClass, this.settings.validClass);
165                     this.addWrapper(this.errorsFor(a)).hide()
166                 }
167             },
168             onfocusout: function (a) {
169                 if (!this.checkable(a) && (a.name in this.submitted || !this.optional(a))) this.element(a)
170             },
171             onkeyup: function (a) {
172                 if (a.name in this.submitted || a == this.lastElement) this.element(a)
173             },
174             onclick: function (a) {
175                 if (a.name in this.submitted) this.element(a);
176                 else a.parentNode.name in this.submitted && this.element(a.parentNode)
177             },
178             highlight: function (a, b, d) {
179                 a.type === "radio" ? this.findByName(a.name).addClass(b).removeClass(d) : c(a).addClass(b).removeClass(d)
180             },
181             unhighlight: function (a, b, d) {
182                 a.type === "radio" ? this.findByName(a.name).removeClass(b).addClass(d) : c(a).removeClass(b).addClass(d)
183             }
184         },
185         setDefaults: function (a) {
186             c.extend(c.validator.defaults,
187                 a)
188         },
189         messages: {
190             required: " ",
191             remote: "Please fix this field.",
192             email: "Please enter a valid email address.",
193             url: "Please enter a valid URL.",
194             date: "Please enter a valid date.",
195             dateISO: "Please enter a valid date (ISO).",
196             number: "Please enter a valid number.",
197             digits: "Please enter only digits.",
198             creditcard: "Please enter a valid credit card number.",
199             equalTo: "Please enter the same value again.",
200             accept: "Please enter a value with a valid extension.",
201             maxlength: c.validator.format("Please enter no more than {0} characters."),
202             minlength: c.validator.format("Please enter at least {0} characters."),
203             rangelength: c.validator.format("Please enter a value between {0} and {1} characters long."),
204             range: c.validator.format("Please enter a value between {0} and {1}."),
205             max: c.validator.format("Please enter a value less than or equal to {0}."),
206             min: c.validator.format("Please enter a value greater than or equal to {0}.")
207         },
208         autoCreateRanges: false,
209         prototype: {
210             init: function () {
211                 function a(e) {
212                     var f = c.data(this[0].form, "validator"),
213                         g = "on" + e.type.replace(/^validate/,
214                             "");
215                     f.settings[g] && f.settings[g].call(f, this[0], e)
216                 }
217                 this.labelContainer = c(this.settings.errorLabelContainer);
218                 this.errorContext = this.labelContainer.length && this.labelContainer || c(this.currentForm);
219                 this.containers = c(this.settings.errorContainer).add(this.settings.errorLabelContainer);
220                 this.submitted = {};
221                 this.valueCache = {};
222                 this.pendingRequest = 0;
223                 this.pending = {};
224                 this.invalid = {};
225                 this.reset();
226                 var b = this.groups = {};
227                 c.each(this.settings.groups, function (e, f) {
228                     c.each(f.split(/\s/), function (g, h) {
229                         b[h] = e
230                     })
231                 });
232                 var d =
233                     this.settings.rules;
234                 c.each(d, function (e, f) {
235                     d[e] = c.validator.normalizeRule(f)
236                 });
237                 c(this.currentForm).validateDelegate("[type='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'] ", "focusin focusout keyup", a).validateDelegate("[type='radio'], [type='checkbox'], select, option", "click",
238                     a);
239                 this.settings.invalidHandler && c(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler)
240             },
241             form: function () {
242                 this.checkForm();
243                 c.extend(this.submitted, this.errorMap);
244                 this.invalid = c.extend({}, this.errorMap);
245                 this.valid() || c(this.currentForm).triggerHandler("invalid-form", [this]);
246                 this.showErrors();
247                 return this.valid()
248             },
249             checkForm: function () {
250                 this.prepareForm();
251                 for (var a = 0, b = this.currentElements = this.elements(); b[a]; a++) this.check(b[a]);
252                 return this.valid()
253             },
254             element: function (a) {
255                 this.lastElement =
256                     a = this.validationTargetFor(this.clean(a));
257                 this.prepareElement(a);
258                 this.currentElements = c(a);
259                 var b = this.check(a);
260                 if (b) delete this.invalid[a.name];
261                 else this.invalid[a.name] = true; if (!this.numberOfInvalids()) this.toHide = this.toHide.add(this.containers);
262                 this.showErrors();
263                 return b
264             },
265             showErrors: function (a) {
266                 if (a) {
267                     c.extend(this.errorMap, a);
268                     this.errorList = [];
269                     for (var b in a) this.errorList.push({
270                         message: a[b],
271                         element: this.findByName(b)[0]
272                     });
273                     this.successList = c.grep(this.successList, function (d) {
274                         return !(d.name in a)
275                     })
276                 }
277                 this.settings.showErrors ?
278                     this.settings.showErrors.call(this, this.errorMap, this.errorList) : this.defaultShowErrors()
279             },
280             resetForm: function () {
281                 c.fn.resetForm && c(this.currentForm).resetForm();
282                 this.submitted = {};
283                 this.lastElement = null;
284                 this.prepareForm();
285                 this.hideErrors();
286                 this.elements().removeClass(this.settings.errorClass)
287             },
288             numberOfInvalids: function () {
289                 return this.objectLength(this.invalid)
290             },
291             objectLength: function (a) {
292                 var b = 0,
293                     d;
294                 for (d in a) b++;
295                 return b
296             },
297             hideErrors: function () {
298                 this.addWrapper(this.toHide).hide()
299             },
300             valid: function () {
301                 return this.size() ==
302                     0
303             },
304             size: function () {
305                 return this.errorList.length
306             },
307             focusInvalid: function () {
308                 if (this.settings.focusInvalid) try {
309                     c(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible").focus().trigger("focusin")
310                 } catch (a) {}
311             },
312             findLastActive: function () {
313                 var a = this.lastActive;
314                 return a && c.grep(this.errorList, function (b) {
315                     return b.element.name == a.name
316                 }).length == 1 && a
317             },
318             elements: function () {
319                 var a = this,
320                     b = {};
321                 return c(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function () {
322                     !this.name &&
323                         a.settings.debug && window.console && console.error("%o has no name assigned", this);
324                     if (this.name in b || !a.objectLength(c(this).rules())) return false;
325                     return b[this.name] = true
326                 })
327             },
328             clean: function (a) {
329                 return c(a)[0]
330             },
331             errors: function () {
332                 return c(this.settings.errorElement + "." + this.settings.errorClass, this.errorContext)
333             },
334             reset: function () {
335                 this.successList = [];
336                 this.errorList = [];
337                 this.errorMap = {};
338                 this.toShow = c([]);
339                 this.toHide = c([]);
340                 this.currentElements = c([])
341             },
342             prepareForm: function () {
343                 this.reset();
344                 this.toHide = this.errors().add(this.containers)
345             },
346             prepareElement: function (a) {
347                 this.reset();
348                 this.toHide = this.errorsFor(a)
349             },
350             check: function (a) {
351                 a = this.validationTargetFor(this.clean(a));
352                 var b = c(a).rules(),
353                     d = false,
354                     e;
355                 for (e in b) {
356                     var f = {
357                         method: e,
358                         parameters: b[e]
359                     };
360                     try {
361                         var g = c.validator.methods[e].call(this, a.value.replace(/\r/g, ""), a, f.parameters);
362                         if (g == "dependency-mismatch") d = true;
363                         else {
364                             d = false;
365                             if (g == "pending") {
366                                 this.toHide = this.toHide.not(this.errorsFor(a));
367                                 return
368                             }
369                             if (!g) {
370                                 this.formatAndAdd(a, f);
371                                 return false
372                             }
373                         }
374                     } catch (h) {
375                         this.settings.debug && window.console && console.log("exception occured when checking element " +
376                             a.id + ", check the '" + f.method + "' method", h);
377                         throw h;
378                     }
379                 }
380                 if (!d) {
381                     this.objectLength(b) && this.successList.push(a);
382                     return true
383                 }
384             },
385             customMetaMessage: function (a, b) {
386                 if (c.metadata) {
387                     var d = this.settings.meta ? c(a).metadata()[this.settings.meta] : c(a).metadata();
388                     return d && d.messages && d.messages[b]
389                 }
390             },
391             customMessage: function (a, b) {
392                 var d = this.settings.messages[a];
393                 return d && (d.constructor == String ? d : d[b])
394             },
395             findDefined: function () {
396                 for (var a = 0; a < arguments.length; a++)
397                     if (arguments[a] !== undefined) return arguments[a]
398             },
399             defaultMessage: function (a,
400                 b) {
401                 return this.findDefined(this.customMessage(a.name, b), this.customMetaMessage(a, b), !this.settings.ignoreTitle && a.title || undefined, c.validator.messages[b], "<strong>Warning: No message defined for " + a.name + "</strong>")
402             },
403             formatAndAdd: function (a, b) {
404                 var d = this.defaultMessage(a, b.method),
405                     e = /\$?\{(\d+)\}/g;
406                 if (typeof d == "function") d = d.call(this, b.parameters, a);
407                 else if (e.test(d)) d = jQuery.format(d.replace(e, "{$1}"), b.parameters);
408                 this.errorList.push({
409                     message: d,
410                     element: a
411                 });
412                 this.errorMap[a.name] = d;
413                 this.submitted[a.name] =
414                     d
415             },
416             addWrapper: function (a) {
417                 if (this.settings.wrapper) a = a.add(a.parent(this.settings.wrapper));
418                 return a
419             },
420             defaultShowErrors: function () {
421                 for (var a = 0; this.errorList[a]; a++) {
422                     var b = this.errorList[a];
423                     this.settings.highlight && this.settings.highlight.call(this, b.element, this.settings.errorClass, this.settings.validClass);
424                     this.showLabel(b.element, b.message)
425                 }
426                 if (this.errorList.length) this.toShow = this.toShow.add(this.containers);
427                 if (this.settings.success)
428                     for (a = 0; this.successList[a]; a++) this.showLabel(this.successList[a]);
429                 if (this.settings.unhighlight) {
430                     a = 0;
431                     for (b = this.validElements(); b[a]; a++) this.settings.unhighlight.call(this, b[a], this.settings.errorClass, this.settings.validClass)
432                 }
433                 this.toHide = this.toHide.not(this.toShow);
434                 this.hideErrors();
435                 this.addWrapper(this.toShow).show()
436             },
437             validElements: function () {
438                 return this.currentElements.not(this.invalidElements())
439             },
440             invalidElements: function () {
441                 return c(this.errorList).map(function () {
442                     return this.element
443                 })
444             },
445             showLabel: function (a, b) {
446                 var d = this.errorsFor(a);
447                 if (d.length) {
448                     d.removeClass(this.settings.validClass).addClass(this.settings.errorClass);
449                     d.attr("generated") && d.html(b)
450                 } else {
451                     d = c("<" + this.settings.errorElement + "/>").attr({
452                         "for": this.idOrName(a),
453                         generated: true
454                     }).addClass(this.settings.errorClass).html(b || "");
455                     if (this.settings.wrapper) d = d.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
456                     this.labelContainer.append(d).length || (this.settings.errorPlacement ? this.settings.errorPlacement(d, c(a)) : d.insertAfter(a))
457                 } if (!b && this.settings.success) {
458                     d.text("");
459                     typeof this.settings.success == "string" ? d.addClass(this.settings.success) : this.settings.success(d)
460                 }
461                 this.toShow =
462                     this.toShow.add(d)
463             },
464             errorsFor: function (a) {
465                 var b = this.idOrName(a);
466                 return this.errors().filter(function () {
467                     return c(this).attr("for") == b
468                 })
469             },
470             idOrName: function (a) {
471                 return this.groups[a.name] || (this.checkable(a) ? a.name : a.id || a.name)
472             },
473             validationTargetFor: function (a) {
474                 if (this.checkable(a)) a = this.findByName(a.name).not(this.settings.ignore)[0];
475                 return a
476             },
477             checkable: function (a) {
478                 return /radio|checkbox/i.test(a.type)
479             },
480             findByName: function (a) {
481                 var b = this.currentForm;
482                 return c(document.getElementsByName(a)).map(function (d,
483                     e) {
484                     return e.form == b && e.name == a && e || null
485                 })
486             },
487             getLength: function (a, b) {
488                 switch (b.nodeName.toLowerCase()) {
489                 case "select":
490                     return c("option:selected", b).length;
491                 case "input":
492                     if (this.checkable(b)) return this.findByName(b.name).filter(":checked").length
493                 }
494                 return a.length
495             },
496             depend: function (a, b) {
497                 return this.dependTypes[typeof a] ? this.dependTypes[typeof a](a, b) : true
498             },
499             dependTypes: {
500                 "boolean": function (a) {
501                     return a
502                 },
503                 string: function (a, b) {
504                     return !!c(a, b.form).length
505                 },
506                 "function": function (a, b) {
507                     return a(b)
508                 }
509             },
510             optional: function (a) {
511                 return !c.validator.methods.required.call(this,
512                     c.trim(a.value), a) && "dependency-mismatch"
513             },
514             startRequest: function (a) {
515                 if (!this.pending[a.name]) {
516                     this.pendingRequest++;
517                     this.pending[a.name] = true
518                 }
519             },
520             stopRequest: function (a, b) {
521                 this.pendingRequest--;
522                 if (this.pendingRequest < 0) this.pendingRequest = 0;
523                 delete this.pending[a.name];
524                 if (b && this.pendingRequest == 0 && this.formSubmitted && this.form()) {
525                     c(this.currentForm).submit();
526                     this.formSubmitted = false
527                 } else if (!b && this.pendingRequest == 0 && this.formSubmitted) {
528                     c(this.currentForm).triggerHandler("invalid-form", [this]);
529                     this.formSubmitted =
530                         false
531                 }
532             },
533             previousValue: function (a) {
534                 return c.data(a, "previousValue") || c.data(a, "previousValue", {
535                     old: null,
536                     valid: true,
537                     message: this.defaultMessage(a, "remote")
538                 })
539             }
540         },
541         classRuleSettings: {
542             required: {
543                 required: true
544             },
545             email: {
546                 email: true
547             },
548             url: {
549                 url: true
550             },
551             date: {
552                 date: true
553             },
554             dateISO: {
555                 dateISO: true
556             },
557             dateDE: {
558                 dateDE: true
559             },
560             number: {
561                 number: true
562             },
563             numberDE: {
564                 numberDE: true
565             },
566             digits: {
567                 digits: true
568             },
569             creditcard: {
570                 creditcard: true
571             }
572         },
573         addClassRules: function (a, b) {
574             a.constructor == String ? this.classRuleSettings[a] = b : c.extend(this.classRuleSettings,
575                 a)
576         },
577         classRules: function (a) {
578             var b = {};
579             (a = c(a).attr("class")) && c.each(a.split(" "), function () {
580                 this in c.validator.classRuleSettings && c.extend(b, c.validator.classRuleSettings[this])
581             });
582             return b
583         },
584         attributeRules: function (a) {
585             var b = {};
586             a = c(a);
587             for (var d in c.validator.methods) {
588                 var e;
589                 if (e = d === "required" && typeof c.fn.prop === "function" ? a.prop(d) : a.attr(d)) b[d] = e;
590                 else if (a[0].getAttribute("type") === d) b[d] = true
591             }
592             b.maxlength && /-1|2147483647|524288/.test(b.maxlength) && delete b.maxlength;
593             return b
594         },
595         metadataRules: function (a) {
596             if (!c.metadata) return {};
597             var b = c.data(a.form, "validator").settings.meta;
598             return b ? c(a).metadata()[b] : c(a).metadata()
599         },
600         staticRules: function (a) {
601             var b = {},
602                 d = c.data(a.form, "validator");
603             if (d.settings.rules) b = c.validator.normalizeRule(d.settings.rules[a.name]) || {};
604             return b
605         },
606         normalizeRules: function (a, b) {
607             c.each(a, function (d, e) {
608                 if (e === false) delete a[d];
609                 else if (e.param || e.depends) {
610                     var f = true;
611                     switch (typeof e.depends) {
612                     case "string":
613                         f = !!c(e.depends, b.form).length;
614                         break;
615                     case "function":
616                         f = e.depends.call(b, b)
617                     }
618                     if (f) a[d] = e.param !== undefined ?
619                         e.param : true;
620                     else delete a[d]
621                 }
622             });
623             c.each(a, function (d, e) {
624                 a[d] = c.isFunction(e) ? e(b) : e
625             });
626             c.each(["minlength", "maxlength", "min", "max"], function () {
627                 if (a[this]) a[this] = Number(a[this])
628             });
629             c.each(["rangelength", "range"], function () {
630                 if (a[this]) a[this] = [Number(a[this][0]), Number(a[this][1])]
631             });
632             if (c.validator.autoCreateRanges) {
633                 if (a.min && a.max) {
634                     a.range = [a.min, a.max];
635                     delete a.min;
636                     delete a.max
637                 }
638                 if (a.minlength && a.maxlength) {
639                     a.rangelength = [a.minlength, a.maxlength];
640                     delete a.minlength;
641                     delete a.maxlength
642                 }
643             }
644             a.messages && delete a.messages;
645             return a
646         },
647         normalizeRule: function (a) {
648             if (typeof a == "string") {
649                 var b = {};
650                 c.each(a.split(/\s/), function () {
651                     b[this] = true
652                 });
653                 a = b
654             }
655             return a
656         },
657         addMethod: function (a, b, d) {
658             c.validator.methods[a] = b;
659             c.validator.messages[a] = d != undefined ? d : c.validator.messages[a];
660             b.length < 3 && c.validator.addClassRules(a, c.validator.normalizeRule(a))
661         },
662         methods: {
663             required: function (a, b, d) {
664                 if (!this.depend(d, b)) return "dependency-mismatch";
665                 switch (b.nodeName.toLowerCase()) {
666                 case "select":
667                     return (a = c(b).val()) && a.length > 0;
668                 case "input":
669                     if (this.checkable(b)) return this.getLength(a,
670                         b) > 0;
671                 default:
672                     return c.trim(a).length > 0
673                 }
674             },
675             remote: function (a, b, d) {
676                 if (this.optional(b)) return "dependency-mismatch";
677                 var e = this.previousValue(b);
678                 this.settings.messages[b.name] || (this.settings.messages[b.name] = {});
679                 e.originalMessage = this.settings.messages[b.name].remote;
680                 this.settings.messages[b.name].remote = e.message;
681                 d = typeof d == "string" && {
682                     url: d
683                 } || d;
684                 if (this.pending[b.name]) return "pending";
685                 if (e.old === a) return e.valid;
686                 e.old = a;
687                 var f = this;
688                 this.startRequest(b);
689                 var g = {};
690                 g[b.name] = a;
691                 c.ajax(c.extend(true, {
692                     url: d,
693                     mode: "abort",
694                     port: "validate" + b.name,
695                     dataType: "json",
696                     data: g,
697                     success: function (h) {
698                         f.settings.messages[b.name].remote = e.originalMessage;
699                         var j = h === true;
700                         if (j) {
701                             var i = f.formSubmitted;
702                             f.prepareElement(b);
703                             f.formSubmitted = i;
704                             f.successList.push(b);
705                             f.showErrors()
706                         } else {
707                             i = {};
708                             h = h || f.defaultMessage(b, "remote");
709                             i[b.name] = e.message = c.isFunction(h) ? h(a) : h;
710                             f.showErrors(i)
711                         }
712                         e.valid = j;
713                         f.stopRequest(b, j)
714                     }
715                 }, d));
716                 return "pending"
717             },
718             minlength: function (a, b, d) {
719                 return this.optional(b) || this.getLength(c.trim(a), b) >= d
720             },
721             maxlength: function (a,
722                 b, d) {
723                 return this.optional(b) || this.getLength(c.trim(a), b) <= d
724             },
725             rangelength: function (a, b, d) {
726                 a = this.getLength(c.trim(a), b);
727                 return this.optional(b) || a >= d[0] && a <= d[1]
728             },
729             min: function (a, b, d) {
730                 return this.optional(b) || a >= d
731             },
732             max: function (a, b, d) {
733                 return this.optional(b) || a <= d
734             },
735             range: function (a, b, d) {
736                 return this.optional(b) || a >= d[0] && a <= d[1]
737             },
738             email: function (a, b) {
739                 return this.optional(b) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(a)
740             },
741             url: function (a, b) {
742                 return this.optional(b) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)
743             },
744             date: function (a, b) {
745                 return this.optional(b) || !/Invalid|NaN/.test(new Date(a))
746             },
747             dateISO: function (a, b) {
748                 return this.optional(b) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)
749             },
750             number: function (a, b) {
751                 return this.optional(b) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)
752             },
753             digits: function (a, b) {
754                 return this.optional(b) || /^\d+$/.test(a)
755             },
756             creditcard: function (a, b) {
757                 if (this.optional(b)) return "dependency-mismatch";
758                 if (/[^0-9 -]+/.test(a)) return false;
759                 var d = 0,
760                     e = 0,
761                     f = false;
762                 a = a.replace(/\D/g, "");
763                 for (var g = a.length - 1; g >=
764                     0; g--) {
765                     e = a.charAt(g);
766                     e = parseInt(e, 10);
767                     if (f)
768                         if ((e *= 2) > 9) e -= 9;
769                     d += e;
770                     f = !f
771                 }
772                 return d % 10 == 0
773             },
774             accept: function (a, b, d) {
775                 d = typeof d == "string" ? d.replace(/,/g, "|") : "png|jpe?g|gif";
776                 return this.optional(b) || a.match(RegExp(".(" + d + ")$", "i"))
777             },
778             equalTo: function (a, b, d) {
779                 d = c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo", function () {
780                     c(b).valid()
781                 });
782                 return a == d.val()
783             }
784         }
785     });
786     c.format = c.validator.format
787 })(jQuery);
788 (function (c) {
789     var a = {};
790     if (c.ajaxPrefilter) c.ajaxPrefilter(function (d, e, f) {
791         e = d.port;
792         if (d.mode == "abort") {
793             a[e] && a[e].abort();
794             a[e] = f
795         }
796     });
797     else {
798         var b = c.ajax;
799         c.ajax = function (d) {
800             var e = ("port" in d ? d : c.ajaxSettings).port;
801             if (("mode" in d ? d : c.ajaxSettings).mode == "abort") {
802                 a[e] && a[e].abort();
803                 return a[e] = b.apply(this, arguments)
804             }
805             return b.apply(this, arguments)
806         }
807     }
808 })(jQuery);
809 (function (c) {
810     !jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener && c.each({
811         focus: "focusin",
812         blur: "focusout"
813     }, function (a, b) {
814         function d(e) {
815             e = c.event.fix(e);
816             e.type = b;
817             return c.event.handle.call(this, e)
818         }
819         c.event.special[b] = {
820             setup: function () {
821                 this.addEventListener(a, d, true)
822             },
823             teardown: function () {
824                 this.removeEventListener(a, d, true)
825             },
826             handler: function (e) {
827                 arguments[0] = c.event.fix(e);
828                 arguments[0].type = b;
829                 return c.event.handle.apply(this, arguments)
830             }
831         }
832     });
833     c.extend(c.fn, {
834         validateDelegate: function (a,
835             b, d) {
836             return this.bind(b, function (e) {
837                 var f = c(e.target);
838                 if (f.is(a)) return d.apply(f, arguments)
839             })
840         }
841     })
842 })(jQuery);