/*
 * Form Validation: jQuery form validation plug-in v1.1.2
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 *
 * Copyright (c) 2006 Jörn Zaefferer
 *
 * $Id: jquery.validate.js 4125 2007-12-12 21:26:21Z joern.zaefferer $
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('8.P(8.3c,{4i:7(b){l c=18 8.C(b,6[0]);l c=8.1h(6[0],\'C\');k(c){h c}c=18 8.C(b,6[0]);8.1h(6[0],\'C\',c);k(c.j.3a){6.21("1q.4c:1S").2G(7(){c.1P=I});6.1S(7(a){k(c.j.1H)a.3C();7 1L(){k(c.j.2f){c.j.2f.O(c,c.1d);h Z}h I}k(c.1P){c.1P=Z;h 1L()}k(c.1x()){h 1L()}23{c.1u();h Z}})}h c},L:7(t){h 6.4j(8.4h(6.4e(),t))}});8.P(8.4b[":"],{4a:"!8.1r(a.x)",48:"!!8.1r(a.x)",43:"!a.2A"});8.S=7(b,c){k(1A.r==1)h 7(){l a=8.2s(1A);a.3I(b);h 8.S.3G(6,a)};k(1A.r>2&&c.1K!=2h){c=8.2s(1A).3t(1)}k(c.1K!=2h){c=[c]}8.1O(c,7(i,n){b=b.2a(18 3i("\\\\{"+i+"\\\\}","g"),n)});h b};8.C=7(a,b){6.j=8.P({},8.C.1Y,a);6.1d=b;6.1D=8(6.j.24);6.39=6.1D.r&&6.1D||8(b);6.1v=8(6.j.33).4s(6.j.24);6.11={};6.1b={};6.1a();6.2X()};8.P(8.C,{1Y:{13:{},Q:"2V",1Z:"4f",1u:I,33:8([]),24:8([]),3a:I,2R:[],1X:7(a){k(!6.X(a)&&(a.p U 6.11||!6.q(a))){6.K(a)}},1R:7(a){k(a.p U 6.11||a==6.2K){6.K(a)}},20:7(a){k(a.p U 6.11)6.K(a)}},47:7(a){8.P(8.C.1Y,a)},13:{q:"45 41 3Z q.",1Q:"v u a M 1Q 3T.",2y:"v u a M 3S.",1z:"v u a M 1z.",2v:"v u a M 1z (3O).",2t:"2k 2q 2p 1J gü3E 3B 1J.",1E:"v u a M 1E.",2j:"2k 2q 2p 3w 3v 1J.",1G:"v u 3s 1G",2w:"v u a M 3q 3o.",2d:"v u 2T 3m x 3k.",2b:"v u a x 3j a M 4M.",3g:8.S("v u a x 3d 4J 27 {0} 26."),31:8.S("v u a x 4A 4z 4y {0} 26."),38:8.S("v u a x 37 {0} 34 {1} 26 4x."),32:8.S("v u a x 37 {0} 34 {1}."),36:8.S("v u a x 4r 27 30 2Z 3b {0}."),2Y:8.S("v u a x 4l 27 30 2Z 3b {0}.")},4k:{1x:7(){6.22();J(l i=0;6.R[i];i++){6.1s(6.R[i])}8.P(6.11,6.W);6.1b=8.P({},6.W);6.j.2W&&6.j.2W.O(6);6.19();h 6.M()},K:7(a){a=6.1k(a);6.2K=a;6.2U(a);l b=6.1s(a);k(b){4g 6.1b[a.p]}23{6.1b[a.p]=I}k(!6.2S()){6.V.L(6.1v)}6.19();h b},19:7(b){k(b){8.P(6.W,b);6.H=[];J(p U b){6.H.L({1p:b[p],K:8("[@p=\'"+p+"\']:4d",6.1d)[0]})}6.Y=8.2Q(6.Y,7(a){h!(a.p U b)})}6.j.19?6.j.19.O(6,6.W,6.H):6.2P()},1W:7(){k(8.3c.1W)8(6.1d).1W();6.22();6.1V();6.R.1o(6.j.Q)},2S:7(){l a=0;J(i U 6.1b)a++;h a},1V:7(){6.1T(6.V).1U()},M:7(){h 6.2O()==0},2O:7(){h 6.H.r},1u:7(){k(6.j.1u){2N{8(6.2M()||6.H.r&&6.H[0].K||[]).1n(":49").2L()}2J(e){}}},2M:7(){l a=6.2I;h a&&8.2Q(6.H,7(n){h n.K.p==a.p}).r==1&&a},2X:7(){l a=6;a.1t={};7 2H(){a.2I=6;k(a.j.46&&!a.44){8(6).1o(a.j.Q);a.1C(6).1U()}}6.R=8(6.1d).21("1q, 1y, 40").1w(":1S, :1a").1w("[@3Y]").1w(6.j.2R).1n(7(){!6.p&&a.j.1H&&2B.1l&&1l.2V("%o 3X 3d p 3W",6);k(6.p U a.1t||!a.15(6).r)h Z;a.1t[6.p]=a.15(6);h I});6.R.2L(2H);a.j.1X&&a.R.3V(7(){a.j.1X.O(a,6)});a.j.1R&&a.R.3U(7(){a.j.1R.O(a,6)});k(a.j.20){l b=8([]);a.R.1O(7(){k(a.X(6))b.L(a.1N(6))});b.2G(7(){a.j.20.O(a,6)})}},1k:7(a){h 8(a)[0]},29:7(){h 8(6.j.1Z+"."+6.j.Q,6.39)},1a:7(){6.Y=[];6.H=[];6.W={};6.14=8([]);6.V=8([])},22:7(){6.1a();6.V=6.29().L(6.1v)},2U:7(a){6.1a();6.V=6.1C(6.1k(a))},1s:7(a){a=6.1k(a);8(a).1o(6.j.Q);l b=6.1t[a.p];J(l i=0;b[i];i++){l c=b[i];2N{l d=8.C.1j[c.1e].O(6,8.1r(a.x),a,c.1M);k(d===-1)3Q;k(!d){8(a).1f(6.j.Q);6.2u(c,a);h Z}}2J(e){6.j.1H&&2B.1l&&1l.3N("3M 3L 3K 3J K "+a.2i+", 1s 2T \'"+c.1e+"\' 1e");3H e;}}k(b.r&&6.j.17)6.Y.L(a);h I},2o:7(a,b){l m=6.j.13[a];h m&&(m.1K==3F?m:m[b])},2m:7(a,b){h 6.2o(a.p,b)||a.3D||8.C.13[b]||"<2l>3A: 3z 1p 3y J "+a.p+"</2l>"},2u:7(a,b){l c=6.2m(b,a.1e);k(12 c=="7")c=c.O(6,a.1M,b);6.H.L({1p:c,K:b});6.W[b.p]=c;6.11[b.p]=c},1T:7(a){k(6.j.1g)a.L(a.3x(6.j.1g));h a},2P:7(){J(l i=0;6.H[i];i++){l a=6.H[i];6.1I(a.K,a.1p)}k(6.H.r){6.14.L(6.1v)}J(l i=0;6.Y[i];i++){6.1I(6.Y[i])}6.V=6.V.1w(6.14);6.1V();6.1T(6.14).2n()},1I:7(a,b){l c=6.1C(a);k(c.r){c.1o().1f(6.j.Q);k(6.j.3u||c.2x("2g")){c.2r(b)}}23{c=8("<"+6.j.1Z+"/>").2x({"J":6.1F(a),2g:I}).1f(6.j.Q).2r(b||"");k(6.j.1g){c=c.1U().2n().3P("<"+6.j.1g+">").3r()}k(!6.1D.3R(c).r)6.j.2C?6.j.2C(c,8(a)):c.3p(a)}k(!b&&6.j.17){c.2e("");12 6.j.17=="1i"?c.1f(6.j.17):6.j.17(c)}6.14.L(c)},1C:7(a){h 6.29().1n("[@J=\'"+6.1F(a)+"\']")},1F:7(a){h 6.X(a)?a.p:a.2i||a.p},15:7(c){l d=6.1h(c);k(!d)h[];l e=[];k(12 d=="1i"){l f={};f[d]=I;d=f}8.1O(d,7(a,b){e[e.r]={1e:a,1M:b}});h e},1h:7(a){h 6.j.15?6.j.15[a.p]:6.j.2z?8(a).2c()[6.j.2z]:8(a).2c()},X:7(a){h/3n|3l/i.N(a.2F)},1N:7(a){h 8(a.1x||42).21(\'[@p="\'+a.p+\'"]\')},16:7(a,b){2D(b.2E.35()){1B\'1y\':h 8("3h:3f",b).r;1B\'1q\':k(6.X(b))h 6.1N(b).1n(\':2A\').r}h a.r},3e:7(a,b){h 6.28[12 a]?6.28[12 a](a,b):I},28:{"4K":7(a,b){h a},"1i":7(a,b){h!!8(a,b.1x).r},"7":7(a,b){h a(b)}},q:7(a){h!8.C.1j.q.O(6,8.1r(a.x),a)}},1j:{q:7(a,b,c){k(!6.3e(c,b))h-1;2D(b.2E.35()){1B\'1y\':l d=8("3h:3f",b);h d.r>0&&(b.2F=="1y-4H"||(8.4G.4F&&!(d[0].4E[\'x\'].4D)?d[0].2e:d[0].x).r>0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[\\1c-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|T|~|[\\G-\\E\\A-\\F\\B-\\y])|(%[\\1c-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|[\\4w-\\4v]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|T|~|[\\G-\\E\\A-\\F\\B-\\y])|(%[\\1c-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i.N(a)},1z:7(a,b){h 6.q(b)||!/4u|4t/.N(18 4B(a))},2v:7(a,b){h 6.q(b)||/^\\d{4}[\\/-]\\d{1,2}[\\/-]\\d{1,2}$/.N(a)},2t:7(a,b){h 6.q(b)||/^\\d\\d?\\.\\d\\d?\\.\\d\\d\\d?\\d?$/.N(a)},1E:7(a,b){h 6.q(b)||/^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/.N(a)},2j:7(a,b){h 6.q(b)||/^-?(?:\\d+|\\d{1,3}(?:\\.\\d{3})+)(?:,\\d+)?$/.N(a)},1G:7(a,b){h 6.q(b)||/^\\d+$/.N(a)},2w:7(a,b){k(6.q(b))h I;l c=0,e=0,1m=Z;a=a.2a(/\\D/g,"");J(n=a.r-1;n>=0;n--){l d=a.4q(n);l e=4p(d,10);k(1m){k((e*=2)>9)e-=9}c+=e;1m=!1m}h(c%10)==0},2b:7(a,b,c){c=12 c=="1i"?c:"4o|4I?g|4n";h 6.q(b)||a.4m(18 3i(".("+c+")$","i"))},2d:7(a,b,c){h a==8(c).4L()}},4N:7(a,b,c){8.C.1j[a]=b;8.C.13[a]=c}});',62,298,'||||||this|function|jQuery|||||||||return||settings|if|var||||name|required|length|||enter|Please||value|uFFEF||uF900|uFDF0|validator||uD7FF|uFDCF|u00A0|errorList|true|for|element|push|valid|test|call|extend|errorClass|elements|format|_|in|toHide|errorMap|checkable|successList|false||submitted|typeof|messages|toShow|rules|getLength|success|new|showErrors|reset|invalid|da|currentForm|method|addClass|wrapper|data|string|methods|clean|console|bEven|filter|removeClass|message|input|trim|check|rulesCache|focusInvalid|containers|not|form|select|date|arguments|case|errorsFor|labelContainer|number|idOrName|digits|debug|showLabel|ein|constructor|handle|parameters|checkableGroup|each|cancelSubmit|email|onkeyup|submit|addWrapper|hide|hideErrors|resetForm|onblur|defaults|errorElement|onclick|find|prepareForm|else|errorLabelContainer||characters|than|dependTypes|errors|replace|accept|metadata|equalTo|text|submitHandler|generated|Array|id|numberDE|Bitte|strong|defaultMessage|show|configuredMessage|Sie|geben|html|makeArray|dateDE|formatAndAdd|dateISO|creditcard|attr|url|meta|checked|window|errorPlacement|switch|nodeName|type|click|focused|lastActive|catch|lastElement|focus|findLastActive|try|size|defaultShowErrors|grep|ignore|numberOfInvalids|the|prepareElement|error|invalidHandler|refresh|minValue|equal|or|minLength|rangeValue|errorContainer|and|toLowerCase|maxValue|between|rangeLength|errorContext|onsubmit|to|fn|no|depend|selected|maxLength|option|RegExp|with|again|checkbox|same|radio|card|insertAfter|credit|parent|only|slice|overrideErrors|Nummer|eine|parents|defined|No|Warning|Datum|preventDefault|title|ltiges|String|apply|throw|unshift|checking|when|occured|exception|warn|ISO|wrap|break|append|URL|address|keyup|blur|assigned|has|disabled|is|textarea|field|document|unchecked|blockFocusCleanup|This|focusCleanup|setDefaults|filled|visible|blank|expr|cancel|first|get|label|delete|merge|validate|setArray|prototype|greater|match|gif|png|parseInt|charAt|less|add|NaN|Invalid|uF8FF|uE000|long|least|at|of|Date|default|specified|attributes|msie|browser|multiple|jpe|longer|boolean|val|extension|addMethod'.split('|'),0,{}))

jQuery.validator.addMethod("maxWords", function(value, element, params) { 
    return this.required(element) || value.match(/bw+b/g).length < params; 
}, "Please enter {0} words or less."); 
 
jQuery.validator.addMethod("minWords", function(value, element, params) { 
    return this.required(element) || value.match(/bw+b/g).length >= params; 
}, "Please enter at least {0} words."); 
 
jQuery.validator.addMethod("rangeWords", function(value, element, params) { 
    return this.required(element) || value.match(/bw+b/g).length >= params[0] && $(element).val().match(/bw+b/g).length < params[1]; 
}, "Please enter between {0} and {1} words.");

jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) {
	return this.required(element) || /^[a-z-.,()'\"s]+$/i.test(value);
}, "Letters or punctuation only please");  

jQuery.validator.addMethod("alphanumeric", function(value, element) {
	return this.required(element) || /^w+$/i.test(value);
}, "Letters, numbers, spaces or underscores only please");  

jQuery.validator.addMethod("alphanumonly", function(value, element) {
	return this.required(element) || /^[a-z0-9A-Z]+$/.test(value);
}, "Please use only letters or numbers");  

jQuery.validator.addMethod("lettersonly", function(value, element) {
	return this.required(element) || /^[a-z]+$/i.test(value);
}, "Letters only please"); 

jQuery.validator.addMethod("nowhitespace", function(value, element) {
	return this.required(element) || /^S+$/i.test(value);
}, "No white space please"); 

jQuery.validator.addMethod("ziprange", function(value, element) {
	return this.required(element) || /^90[2-5]\d\{2}-\d{4}$/.test(value);
}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx");

/**
* Return true, if the value is a valid vehicle identification number (VIN).
*
* Works with all kind of text inputs.
*
* @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
* @desc Declares a required input element whose value must be a valid vehicle identification number.
*
* @name jQuery.validator.methods.vinUS
* @type Boolean
* @cat Plugins/Validate/Methods
*/ 
jQuery.validator.addMethod(
	"vinUS",
	function(v){
		if (v.length != 17)
			return false;
		var i, n, d, f, cd, cdv;
		var LL    = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"];
		var VL    = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9];
		var FL    = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2];
		var rs    = 0;
		for(i = 0; i < 17; i++){
		    f = FL[i];
		    d = v.slice(i,i+1);
		    if(i == 8){
		        cdv = d;
		    }
		    if(!isNaN(d)){
		        d *= f;
		    }
		    else{
		        for(n = 0; n < LL.length; n++){
		            if(d.toUpperCase() === LL[n]){
		                d = VL[n];
		                d *= f;
		                if(isNaN(cdv) && n == 8){
		                    cdv = LL[n];
		                }
		                break;
		            }
		        }
		    }
		    rs += d;
		}
		cd = rs % 11;
		if(cd == 10){cd = "X";}
		if(cd == cdv){return true;}
		return false; 
	},
	"The specified vehicle identification number (VIN) is invalid."
);

/**
  * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
  *
  * @example jQuery.validator.methods.date("01/01/1900")
  * @result true
  *
  * @example jQuery.validator.methods.date("01/13/1990")
  * @result false
  *
  * @example jQuery.validator.methods.date("01.01.1900")
  * @result false
  *
  * @example <input name="pippo" class="{dateITA:true}" />
  * @desc Declares an optional input element whose value must be a valid date.
  *
  * @name jQuery.validator.methods.dateITA
  * @type Boolean
  * @cat Plugins/Validate/Methods
  */
jQuery.validator.addMethod(
	"dateITA",
	function(value, element) {
		var check = false;
		var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/
		if( re.test(value)){
			var adata = value.split('/');
			var gg = parseInt(adata[0],10);
			var mm = parseInt(adata[1],10);
			var aaaa = parseInt(adata[2],10);
			var xdata = new Date(aaaa,mm-1,gg);
			if ( ( xdata.getFullYear() == aaaa ) && ( xdata.getMonth () == mm - 1 ) && ( xdata.getDate() == gg ) )
				check = true;
			else
				check = false;
		} else
			check = false;
		return this.optional(element) || check;
	}, 
	"Please enter a correct date"
);

/**
 * matches US phone number format 
 * 
 * where the area code may not start with 1 and the prefix may not start with 1 
 * allows '-' or ' ' as a separator and allows parens around area code 
 * some people may want to put a '1' in front of their number 
 * 
 * 1(212)-999-2345
 * or
 * 212 999 2344
 * or
 * 212-999-0983
 * 
 * but not
 * 111-123-5434
 * and not
 * 212 123 4567
 */
jQuery.validator.addMethod("phone", function(phone_number, element) {
    phone_number = phone_number.replace(/\s+/g, ""); 
	return this.optional(element) || phone_number.length > 9 &&
		phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
}, "Please specify a valid phone number");