﻿/*
 * jQuery Form Plugin
 * version: 2.08 (04/29/2008)
 * @requires jQuery v1.2.2 or later
 *
 * Examples at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id$
 */
 eval(function(p,a,c,k,e,d){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--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[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}('(6($){$.o.Q=6(7){2(!3.D){R(\'Q: 3U w 45 - 3K 2L 1M\');8 3}2(K 7==\'6\')7={L:7};7=$.23({1i:3.N(\'1g\')||W.2M.2N(),C:3.N(\'29\')||\'28\'},7||{});4 M={};3.F(\'5-2a-2u\',[3,7,M]);2(M.M){R(\'Q: w 1X 1s 5-2a-2u F\');8 3}4 a=3.1B(7.P);2(7.p){7.1h=7.p;G(4 n 2b 7.p)a.u({l:n,m:7.p[n]})}2(7.1H&&7.1H(a,3,7)===H){R(\'Q: w 38 1s 1H 2P\');8 3}3.F(\'5-w-1Z\',[a,3,7,M]);2(M.M){R(\'Q: w 1X 1s 5-w-1Z F\');8 3}4 q=$.1E(a);2(7.C.2R()==\'28\'){7.1i+=(7.1i.2S(\'?\')>=0?\'&\':\'?\')+q;7.p=z}A 7.p=q;4 $5=3,T=[];2(7.1A)T.u(6(){$5.1A()});2(7.1T)T.u(6(){$5.1T()});2(!7.12&&7.Y){4 27=7.L||6(){};T.u(6(p){$(7.Y).2U(p).I(27,2f)})}A 2(7.L)T.u(7.L);7.L=6(p,1F){G(4 i=0,B=T.D;i<B;i++)T[i](p,1F,$5)};4 1x=$(\'E:2V\',3).13();4 1S=H;G(4 j=0;j<1x.D;j++)2(1x[j])1S=O;2(7.2I||1S){2($.1r.2W&&7.2x)$.2X(7.2x,1N);A 1N()}A $.2Y(7);3.F(\'5-w-2Z\',[3,7]);8 3;6 1N(){4 5=$5[0];4 h=$.23({},$.3P,7);4 18=\'33\'+(1V 3N().34());4 $d=$(\'<2I 18="\'+18+\'" l="\'+18+\'" />\');4 d=$d[0];4 2p=$.1r.24&&W.24.3J()<9;2($.1r.2E||2p)d.39=\'3a:H;1u.3b("");\';$d.3c({3d:\'3e\',2H:\'-26\',20:\'-26\'});4 k={V:z,19:z,1F:0,3y:\'n/a\',3g:6(){},2q:6(){},3h:6(){}};4 g=h.3i;2(g&&!$.2w++)$.1a.F("3j");2(g)$.1a.F("3k",[k,h]);4 2g=0;4 1v=0;1n(6(){4 t=$5.N(\'Y\'),a=$5.N(\'1g\');$5.N({Y:18,3l:\'2J/5-p\',3m:\'2J/5-p\',29:\'3n\',1g:h.1i});2(h.1G)1n(6(){1v=O;X()},h.1G);4 1D=[];2l{2(7.1h)G(4 n 2b 7.1h)1D.u($(\'<E C="3o" l="\'+n+\'" m="\'+7.1h[n]+\'" />\').2c(5)[0]);$d.2c(\'1I\');d.2d?d.2d(\'2i\',X):d.3q(\'2j\',X,H);5.w()}3s{$5.N(\'1g\',a);t?$5.N(\'Y\',t):$5.3u(\'Y\');$(1D).2B()}},10);6 X(){2(2g++)8;d.2h?d.2h(\'2i\',X):d.3z(\'2j\',X,H);4 1q=O;2l{2(1v)3A\'1G\';4 p,f;f=d.2n?d.2n.1u:d.2o?d.2o:d.1u;k.V=f.1I?f.1I.3D:z;k.19=f.21?f.21:f;k.2q=6(2t){4 2s={\'3E-C\':h.12};8 2s[2t]};2(h.12==\'3F\'||h.12==\'3G\'){4 1L=f.1K(\'1J\')[0];k.V=1L?1L.m:k.V}A 2(h.12==\'2F\'&&!k.19&&k.V!=z){k.19=2C(k.V)}p=$.3L(k,h.12)}3M(e){1q=H;$.3O(h,k,\'2A\',e)}2(1q){h.L(p,\'L\');2(g)$.1a.F("3Q",[k,h])}2(g)$.1a.F("3R",[k,h]);2(g&&!--$.2w)$.1a.F("3S");2(h.2y)h.2y(k,1q?\'L\':\'2A\');1n(6(){$d.2B();k.19=z},3V)};6 2C(s,f){2(W.2D){f=1V 2D(\'3X.3Y\');f.40=\'H\';f.41(s)}A f=(1V 43()).2K(s,\'1P/2F\');8(f&&f.1W&&f.1W.1m!=\'2O\')?f:z}}};$.o.2Q=6(7){8 3.2r().1Y(\'w.5-1o\',6(){$(3).Q(7);8 H}).I(6(){$(":w,E:16",3).1Y(\'25.5-1o\',6(e){4 $5=3.5;$5.U=3;2(3.C==\'16\'){2(e.2G!=S){$5.11=e.2G;$5.Z=e.2T}A 2(K $.o.1c==\'6\'){4 1c=$(3).1c();$5.11=e.2z-1c.20;$5.Z=e.2v-1c.2H}A{$5.11=e.2z-3.30;$5.Z=e.2v-3.35}}1n(6(){$5.U=$5.11=$5.Z=z},10)})})};$.o.2r=6(){3.2m(\'w.5-1o\');8 3.I(6(){$(":w,E:16",3).2m(\'25.5-1o\')})};$.o.1B=6(P){4 a=[];2(3.D==0)8 a;4 5=3[0];4 1l=P?5.1K(\'*\'):5.3f;2(!1l)8 a;G(4 i=0,B=1l.D;i<B;i++){4 c=1l[i];4 n=c.l;2(!n)1w;2(P&&5.U&&c.C=="16"){2(!c.1e&&5.U==c)a.u({l:n+\'.x\',m:5.11},{l:n+\'.y\',m:5.Z});1w}4 v=$.13(c,O);2(v&&v.1j==1b){G(4 j=0,2e=v.D;j<2e;j++)a.u({l:n,m:v[j]})}A 2(v!==z&&K v!=\'S\')a.u({l:n,m:v})}2(!P&&5.U){4 1z=5.1K("E");G(4 i=0,B=1z.D;i<B;i++){4 E=1z[i];4 n=E.l;2(n&&!E.1e&&E.C=="16"&&5.U==E)a.u({l:n+\'.x\',m:5.11},{l:n+\'.y\',m:5.Z})}}8 a};$.o.3t=6(P){8 $.1E(3.1B(P))};$.o.3w=6(J){4 a=[];3.I(6(){4 n=3.l;2(!n)8;4 v=$.13(3,J);2(v&&v.1j==1b){G(4 i=0,B=v.D;i<B;i++)a.u({l:n,m:v[i]})}A 2(v!==z&&K v!=\'S\')a.u({l:3.l,m:v})});8 $.1E(a)};$.o.13=6(J){G(4 1f=[],i=0,B=3.D;i<B;i++){4 c=3[i];4 v=$.13(c,J);2(v===z||K v==\'S\'||(v.1j==1b&&!v.D))1w;v.1j==1b?$.3B(1f,v):1f.u(v)}8 1f};$.13=6(c,J){4 n=c.l,t=c.C,15=c.1m.1t();2(K J==\'S\')J=O;2(J&&(!n||c.1e||t==\'17\'||t==\'3H\'||(t==\'1O\'||t==\'1R\')&&!c.1U||(t==\'w\'||t==\'16\')&&c.5&&c.5.U!=c||15==\'r\'&&c.1y==-1))8 z;2(15==\'r\'){4 1p=c.1y;2(1p<0)8 z;4 a=[],1Q=c.7;4 14=(t==\'r-14\');4 B=(14?1p+1:1Q.D);G(4 i=(14?1p:0);i<B;i++){4 1d=1Q[i];2(1d.1M){4 v=$.1r.2E&&!(1d.3Z[\'m\'].42)?1d.1P:1d.m;2(14)8 v;a.u(v)}}8 a}8 c.m};$.o.1T=6(){8 3.I(6(){$(\'E,r,1J\',3).22()})};$.o.22=$.o.31=6(){8 3.I(6(){4 t=3.C,15=3.1m.1t();2(t==\'1P\'||t==\'36\'||15==\'1J\')3.m=\'\';A 2(t==\'1O\'||t==\'1R\')3.1U=H;A 2(15==\'r\')3.1y=-1})};$.o.1A=6(){8 3.I(6(){2(K 3.17==\'6\'||(K 3.17==\'3v\'&&!3.17.3x))3.17()})};$.o.3C=6(b){2(b==S)b=O;8 3.I(6(){3.1e=!b})};$.o.r=6(r){2(r==S)r=O;8 3.I(6(){4 t=3.C;2(t==\'1O\'||t==\'1R\')3.1U=r;A 2(3.1m.1t()==\'2k\'){4 $1k=$(3).32(\'r\');2(r&&$1k[0]&&$1k[0].C==\'r-14\'){$1k.3r(\'2k\').r(H)}3.1M=r}})};6 R(){2($.o.Q.37&&W.1C&&W.1C.R)W.1C.R(\'[3T.5] \'+1b.3p.3I.3W(2f,\'\'))}})(44);',62,254,'||if|this|var|form|function|options|return||||el|io||doc||opts|||xhr|name|value||fn|data||select|||push||submit|||null|else|max|type|length|input|trigger|for|false|each|successful|typeof|success|veto|attr|true|semantic|ajaxSubmit|log|undefined|callbacks|clk|responseText|window|cb|target|clk_y||clk_x|dataType|fieldValue|one|tag|image|reset|id|responseXML|event|Array|offset|op|disabled|val|action|extraData|url|constructor|sel|els|tagName|setTimeout|plugin|index|ok|browser|via|toLowerCase|document|timedOut|continue|files|selectedIndex|inputs|resetForm|formToArray|console|extraInputs|param|status|timeout|beforeSubmit|body|textarea|getElementsByTagName|ta|selected|fileUpload|checkbox|text|ops|radio|found|clearForm|checked|new|documentElement|vetoed|bind|validate|left|XMLDocument|clearFields|extend|opera|click|1000px|oldSuccess|GET|method|pre|in|appendTo|attachEvent|jmax|arguments|cbInvoked|detachEvent|onload|load|option|try|unbind|contentWindow|contentDocument|op8|getResponseHeader|ajaxFormUnbind|headers|header|serialize|pageY|active|closeKeepAlive|complete|pageX|error|remove|toXml|ActiveXObject|msie|xml|offsetX|top|iframe|multipart|parseFromString|element|location|toString|parsererror|callback|ajaxForm|toUpperCase|indexOf|offsetY|html|file|safari|get|ajax|notify|offsetLeft|clearInputs|parent|jqFormIO|getTime|offsetTop|password|debug|aborted|src|javascript|write|css|position|absolute|elements|getAllResponseHeaders|setRequestHeader|global|ajaxStart|ajaxSend|encoding|enctype|POST|hidden|prototype|addEventListener|find|finally|formSerialize|removeAttr|object|fieldSerialize|nodeType|statusText|removeEventListener|throw|merge|enable|innerHTML|content|json|script|button|join|version|no|httpData|catch|Date|handleError|ajaxSettings|ajaxSuccess|ajaxComplete|ajaxStop|jquery|skipping|100|call|Microsoft|XMLDOM|attributes|async|loadXML|specified|DOMParser|jQuery|process'.split('|'),0,{}))

//<![CDATA[

/* Version 1.0.0
 * Copyright (c) 2008 True Partners, LLC (wearetrue.com)
 * 
 * requires True Core 1.2
 */

Type.register("Validity.Contact", 
	(function(){
	
		function cfn(p_el){
			if(p_el){ // if not, assume we're prototyping
				this.base(p_el);
				this._processing = false;
				this._result = null;
				$(".js-formEntry", p_el).wrapAll('<form method="post" action="contact.ashx"></form>');
			}
		};
      
      cfn.prototype = {
			handle_click: function(e){
				if($(e.target).hasClass("js-submitButton")){
					try{
						this.submit();
					}
					catch(err){}
					return false;
				}
			},
			handle_keydown: function(e){
				if(e.target.nodeName != "TEXTAREA" && e.keyCode == 13){
					this.submit();
				}
			},
			submit: function(){
				var self = this;
				var options = {
					dataType: "json",
					success: function(p_result){self._onResult(p_result);}
				};
				$("form", this.element).ajaxSubmit(options);
				this._processing = true;
				$(".js-formEntry", this.element).hide();
				$(".js-formProcessing", this.element).show();
				this._timerId = setTimeout(function(){self._finishProcessing();}, 1200);
			},
			_finishProcessing: function(){
				clearTimeout(this._timerId);
				this._processing = false;
				if(this._result){
					this._processResult(this._result);
				}
			},
			_onResult: function(p_result){
				this._result = p_result;
				if(!this._processing){
					this._processResult(this._result);
				}
			},
			_processResult: function(p_result){
				$(".js-formProcessing", this.element).hide();
				if(p_result.success){
					$(".js-formComplete", this.element).show();
				}
				else{
					$(".js-formEntry", this.element).show();
					alert(p_result.messages.join('\n'));
				}
				this._result = null;
			}			
      };
      
		return cfn;
	})(),
	True.Behavior
);

//]]>