// jQuery Alert Dialogs Plugin
//
// Version 1.1
//
// Cory S.N. LaViska
// A Beautiful Site (http://abeautifulsite.net/)
// 14 May 2009
//
// Visit http://abeautifulsite.net/notebook/87 for more information
//
// Usage:
//		jAlert( message, [title, callback] )
//		jConfirm( message, [title, callback] )
//		jPrompt( message, [value, title, callback] )
// 
// History:
//
//		1.00 - Released (29 December 2008)
//
//		1.01 - Fixed bug where unbinding would destroy all resize events
//
// License:
// 
// This plugin is dual-licensed under the GNU General Public License and the MIT License and
// is copyright 2008 A Beautiful Site, LLC. 
//
var d_alert = location.hostname;

(function($) {
	
	$.alerts = {
		
		// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
		
		verticalOffset: -75,                // vertical offset of the dialog from center screen, in pixels
		horizontalOffset: 0,                // horizontal offset of the dialog from center screen, in pixels/
		repositionOnResize: true,           // re-centers the dialog on window resize
		overlayOpacity: .01,                // transparency level of overlay
		overlayColor: '#FFF',               // base color of overlay
		draggable: true,                    // make the dialogs draggable (requires UI Draggables plugin)
		okButton: '&nbsp;OK&nbsp;',         // text for the OK button
		cancelButton: '&nbsp;Cancel&nbsp;', // text for the Cancel button
		dialogClass: null,                  // if specified, this class will be applied to all dialogs
		
		// Public methods
		
		alert: function(message, title, callback) {
			if( title == null ) title = 'Alert';
			$.alerts._show(title, message, null, 'alert', function(result) {
				if( callback ) callback(result);
			});
		},
		
		confirm: function(message, title, callback) {
			if( title == null ) title = 'Confirm';
			$.alerts._show(title, message, null, 'confirm', function(result) {
				if( callback ) callback(result);
			});
		},
			
		prompt: function(message, value, title, callback) {
			if( title == null ) title = 'Prompt';
			$.alerts._show(title, message, value, 'prompt', function(result) {
				if( callback ) callback(result);
			});
		},
		
		// Private methods
		
		_show: function(title, msg, value, type, callback) {
			
			$.alerts._hide();
			$.alerts._overlay('show');
			
			$("BODY").append(
			  '<div id="popup_container">' +
			    '<h1 id="popup_title"></h1>' +
			    '<div id="popup_content">' +
			      '<div id="popup_message"></div>' +
				'</div>' +
			  '</div>');
			
			if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass);
			
			// IE6 Fix
			var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed'; 
			
			$("#popup_container").css({
				position: pos,
				zIndex: 99999,
				padding: 0,
				margin: 0
			});
			
			$("#popup_title").text(title);
			$("#popup_content").addClass(type);
			$("#popup_message").text(msg);
			$("#popup_message").html( $("#popup_message").text().replace(/\n/g, '<br />') );
			
			$("#popup_container").css({
				minWidth: $("#popup_container").outerWidth(),
				maxWidth: $("#popup_container").outerWidth()
			});
			
			$.alerts._reposition();
			$.alerts._maintainPosition(true);
			
			switch( type ) {
				case 'alert':
					$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /></div>');
					$("#popup_ok").click( function() {
						$.alerts._hide();
						callback(true);
					});
					$("#popup_ok").focus().keypress( function(e) {
						if( e.keyCode == 13 || e.keyCode == 27 ) $("#popup_ok").trigger('click');
					});
				break;
				case 'confirm':
					$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
					$("#popup_ok").click( function() {
						$.alerts._hide();
						if( callback ) callback(true);
					});
					$("#popup_cancel").click( function() {
						$.alerts._hide();
						if( callback ) callback(false);
					});
					$("#popup_ok").focus();
					$("#popup_ok, #popup_cancel").keypress( function(e) {
						if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
						if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
					});
				break;
				case 'prompt':
					$("#popup_message").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
					$("#popup_prompt").width( $("#popup_message").width() );
					$("#popup_ok").click( function() {
						var val = $("#popup_prompt").val();
						$.alerts._hide();
						if( callback ) callback( val );
					});
					$("#popup_cancel").click( function() {
						$.alerts._hide();
						if( callback ) callback( null );
					});
					$("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
						if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
						if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
					});
					if( value ) $("#popup_prompt").val(value);
					$("#popup_prompt").focus().select();
				break;
			}
			
			// Make draggable
			if( $.alerts.draggable ) {
				try {
					$("#popup_container").draggable({ handle: $("#popup_title") });
					$("#popup_title").css({ cursor: 'move' });
				} catch(e) { /* requires jQuery UI draggables */ }
			}
		},
		
		_hide: function() {
			$("#popup_container").remove();
			$.alerts._overlay('hide');
			$.alerts._maintainPosition(false);
		},
		
		_overlay: function(status) {
			switch( status ) {
				case 'show':
					$.alerts._overlay('hide');
					$("BODY").append('<div id="popup_overlay"></div>');
					$("#popup_overlay").css({
						position: 'absolute',
						zIndex: 99998,
						top: '0px',
						left: '0px',
						width: '100%',
						height: $(document).height(),
						background: $.alerts.overlayColor,
						opacity: $.alerts.overlayOpacity
					});
				break;
				case 'hide':
					$("#popup_overlay").remove();
				break;
			}
		},
		
		_reposition: function() {
			var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
			var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
			if( top < 0 ) top = 0;
			if( left < 0 ) left = 0;
			
			// IE6 fix
			if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
			
		function isiPad(){
		return (navigator.platform.indexOf("iPad") != -1);
	}
			var ua = navigator.userAgent.toLowerCase();
			var isAndroid = ua.indexOf("android") > -1;
		
			if(isiPad()){
				$("#popup_container").css({
					top: '20%',
					left: left + 'px'
				});			
			}	
			 else if (navigator.userAgent.indexOf("Firefox")!=-1){
				$("#popup_container").css({
					top: '28%',
					left: left + 'px'
				});		
			}
			else if (isAndroid) {
			   $("#popup_container").css({
					top: '19%',
					left: left + 'px'
				});	
			}

			  else{
				$("#popup_container").css({
				top: top + 'px',
				left: left + 'px'
			});
					  }
				  
			$("#popup_overlay").height( $(document).height() );
		},
		
		_maintainPosition: function(status) {
			if( $.alerts.repositionOnResize ) {
				switch(status) {
					case true:
						$(window).bind('resize', $.alerts._reposition);
					break;
					case false:
						$(window).unbind('resize', $.alerts._reposition);
					break;
				}
			}
		}
		
	}
	
	// Shortuct functions
	jAlert = function(message, title, callback) {
		$.alerts.alert(message, title, callback);
	}
	
	jConfirm = function(message, title, callback) {
		$.alerts.confirm(message, title, callback);
	};
		
	jPrompt = function(message, value, title, callback) {
		$.alerts.prompt(message, value, title, callback);
	};
	
})(jQuery);
/*
 * jQuery validation plug-in 1.6
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 *
 * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z 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}('(7($){$.H($.2O,{1d:7(d){l(!6.F){d&&d.24&&2Y.1H&&1H.52("3v 3o, 4N\'t 1d, 67 3v");8}p c=$.17(6[0],\'v\');l(c){8 c}c=2e $.v(d,6[0]);$.17(6[0],\'v\',c);l(c.q.3u){6.3r("1B, 3j").1n(".4G").3b(7(){c.3a=w});l(c.q.35){6.3r("1B, 3j").1n(":23").3b(7(){c.1V=6})}6.23(7(b){l(c.q.24)b.5N();7 2m(){l(c.q.35){l(c.1V){p a=$("<1B 1A=\'5v\'/>").1p("u",c.1V.u).2M(c.1V.Z).51(c.U)}c.q.35.11(c,c.U);l(c.1V){a.3A()}8 I}8 w}l(c.3a){c.3a=I;8 2m()}l(c.M()){l(c.1a){c.1l=w;8 I}8 2m()}16{c.2h();8 I}})}8 c},J:7(){l($(6[0]).2Z(\'M\')){8 6.1d().M()}16{p b=w;p a=$(6[0].M).1d();6.P(7(){b&=a.L(6)});8 b}},4F:7(c){p d={},$L=6;$.P(c.1O(/\\s/),7(a,b){d[b]=$L.1p(b);$L.6c(b)});8 d},1f:7(h,k){p f=6[0];l(h){p i=$.17(f.M,\'v\').q;p d=i.1f;p c=$.v.2D(f);22(h){1b"1e":$.H(c,$.v.1N(k));d[f.u]=c;l(k.G)i.G[f.u]=$.H(i.G[f.u],k.G);2K;1b"3A":l(!k){S d[f.u];8 c}p e={};$.P(k.1O(/\\s/),7(a,b){e[b]=c[b];S c[b]});8 e}}p g=$.v.42($.H({},$.v.3Y(f),$.v.3W(f),$.v.3U(f),$.v.2D(f)),f);l(g.14){p j=g.14;S g.14;g=$.H({14:j},g)}8 g}});$.H($.5s[":"],{5p:7(a){8!$.1q(""+a.Z)},5i:7(a){8!!$.1q(""+a.Z)},5f:7(a){8!a.4l}});$.v=7(b,a){6.q=$.H({},$.v.33,b);6.U=a;6.3I()};$.v.W=7(c,b){l(T.F==1)8 7(){p a=$.3D(T);a.4V(c);8 $.v.W.1Q(6,a)};l(T.F>2&&b.29!=3x){b=$.3D(T).4R(1)}l(b.29!=3x){b=[b]}$.P(b,7(i,n){c=c.1P(2e 3s("\\\\{"+i+"\\\\}","g"),n)});8 c};$.H($.v,{33:{G:{},2d:{},1f:{},19:"3p",26:"J",2C:"4Q",2h:w,3l:$([]),2A:$([]),3u:w,3i:[],3Q:I,4O:7(a){6.3e=a;l(6.q.4M&&!6.4J){6.q.1L&&6.q.1L.11(6,a,6.q.19,6.q.26);6.1K(a).2y()}},4E:7(a){l(!6.1D(a)&&(a.u V 6.1c||!6.K(a))){6.L(a)}},6b:7(a){l(a.u V 6.1c||a==6.4y){6.L(a)}},69:7(a){l(a.u V 6.1c)6.L(a);16 l(a.4v.u V 6.1c)6.L(a.4v)},38:7(a,c,b){$(a).1Y(c).2w(b)},1L:7(a,c,b){$(a).2w(c).1Y(b)}},65:7(a){$.H($.v.33,a)},G:{14:"61 4q 2Z 14.",1r:"N 2L 6 4q.",1I:"N O a J 1I 60.",1v:"N O a J 5X.",1u:"N O a J 1u.",2q:"N O a J 1u (5R).",1s:"N O a J 1s.",1U:"N O 5P 1U.",2c:"N O a J 5O 5M 1s.",2n:"N O 47 5I Z 5H.",44:"N O a Z 5C a J 5B.",18:$.v.W("N O 3X 5y 2X {0} 2W."),1z:$.v.W("N O 5x 5w {0} 2W."),2j:$.v.W("N O a Z 3V {0} 45 {1} 2W 5q."),2i:$.v.W("N O a Z 3V {0} 45 {1}."),1x:$.v.W("N O a Z 5k 2X 3L 3K 48 {0}."),1F:$.v.W("N O a Z 5d 2X 3L 3K 48 {0}.")},3J:I,5b:{3I:7(){6.2r=$(6.q.2A);6.4i=6.2r.F&&6.2r||$(6.U);6.2s=$(6.q.3l).1e(6.q.2A);6.1c={};6.55={};6.1a=0;6.1i={};6.1g={};6.21();p f=(6.2d={});$.P(6.q.2d,7(d,c){$.P(c.1O(/\\s/),7(a,b){f[b]=d})});p e=6.q.1f;$.P(e,7(b,a){e[b]=$.v.1N(a)});7 1C(a){p b=$.17(6[0].M,"v");b.q["4A"+a.1A]&&b.q["4A"+a.1A].11(b,6[0])}$(6.U).1C("3F 3E 4W",":3C, :4U, :4T, 2b, 4S",1C).1C("3b",":3B, :3z, 2b, 3y",1C);l(6.q.3w)$(6.U).2J("1g-M.1d",6.q.3w)},M:7(){6.3t();$.H(6.1c,6.1w);6.1g=$.H({},6.1w);l(!6.J())$(6.U).2H("1g-M",[6]);6.1m();8 6.J()},3t:7(){6.2G();Q(p i=0,13=(6.27=6.13());13[i];i++){6.28(13[i])}8 6.J()},L:7(a){a=6.2F(a);6.4y=a;6.2E(a);6.27=$(a);p b=6.28(a);l(b){S 6.1g[a.u]}16{6.1g[a.u]=w}l(!6.3q()){6.12=6.12.1e(6.2s)}6.1m();8 b},1m:7(b){l(b){$.H(6.1w,b);6.R=[];Q(p c V b){6.R.2a({1j:b[c],L:6.2f(c)[0]})}6.1k=$.3n(6.1k,7(a){8!(a.u V b)})}6.q.1m?6.q.1m.11(6,6.1w,6.R):6.3m()},2B:7(){l($.2O.2B)$(6.U).2B();6.1c={};6.2G();6.2T();6.13().2w(6.q.19)},3q:7(){8 6.2g(6.1g)},2g:7(a){p b=0;Q(p i V a)b++;8 b},2T:7(){6.2P(6.12).2y()},J:7(){8 6.3N()==0},3N:7(){8 6.R.F},2h:7(){l(6.q.2h){3O{$(6.3h()||6.R.F&&6.R[0].L||[]).1n(":4P").3g()}3f(e){}}},3h:7(){p a=6.3e;8 a&&$.3n(6.R,7(n){8 n.L.u==a.u}).F==1&&a},13:7(){p a=6,2U={};8 $([]).1e(6.U.13).1n(":1B").1R(":23, :21, :4L, [4K]").1R(6.q.3i).1n(7(){!6.u&&a.q.24&&2Y.1H&&1H.3p("%o 4I 3X u 4H",6);l(6.u V 2U||!a.2g($(6).1f()))8 I;2U[6.u]=w;8 w})},2F:7(a){8 $(a)[0]},2z:7(){8 $(6.q.2C+"."+6.q.19,6.4i)},21:7(){6.1k=[];6.R=[];6.1w={};6.1o=$([]);6.12=$([]);6.27=$([])},2G:7(){6.21();6.12=6.2z().1e(6.2s)},2E:7(a){6.21();6.12=6.1K(a)},28:7(d){d=6.2F(d);l(6.1D(d)){d=6.2f(d.u)[0]}p a=$(d).1f();p c=I;Q(Y V a){p b={Y:Y,2l:a[Y]};3O{p f=$.v.1T[Y].11(6,d.Z.1P(/\\r/g,""),d,b.2l);l(f=="1S-1Z"){c=w;4D}c=I;l(f=="1i"){6.12=6.12.1R(6.1K(d));8}l(!f){6.3c(d,b);8 I}}3f(e){6.q.24&&2Y.1H&&1H.4C("6g 6f 6e 6d L "+d.4z+", 28 47 \'"+b.Y+"\' Y",e);6a e;}}l(c)8;l(6.2g(a))6.1k.2a(d);8 w},4x:7(a,b){l(!$.1y)8;p c=6.q.39?$(a).1y()[6.q.39]:$(a).1y();8 c&&c.G&&c.G[b]},4w:7(a,b){p m=6.q.G[a];8 m&&(m.29==4u?m:m[b])},4t:7(){Q(p i=0;i<T.F;i++){l(T[i]!==20)8 T[i]}8 20},2x:7(a,b){8 6.4t(6.4w(a.u,b),6.4x(a,b),!6.q.3Q&&a.68||20,$.v.G[b],"<4s>66: 64 1j 63 Q "+a.u+"</4s>")},3c:7(b,a){p c=6.2x(b,a.Y),36=/\\$?\\{(\\d+)\\}/g;l(1h c=="7"){c=c.11(6,a.2l,b)}16 l(36.15(c)){c=2v.W(c.1P(36,\'{$1}\'),a.2l)}6.R.2a({1j:c,L:b});6.1w[b.u]=c;6.1c[b.u]=c},2P:7(a){l(6.q.2u)a=a.1e(a.4p(6.q.2u));8 a},3m:7(){Q(p i=0;6.R[i];i++){p a=6.R[i];6.q.38&&6.q.38.11(6,a.L,6.q.19,6.q.26);6.34(a.L,a.1j)}l(6.R.F){6.1o=6.1o.1e(6.2s)}l(6.q.1G){Q(p i=0;6.1k[i];i++){6.34(6.1k[i])}}l(6.q.1L){Q(p i=0,13=6.4o();13[i];i++){6.q.1L.11(6,13[i],6.q.19,6.q.26)}}6.12=6.12.1R(6.1o);6.2T();6.2P(6.1o).4n()},4o:7(){8 6.27.1R(6.4m())},4m:7(){8 $(6.R).3d(7(){8 6.L})},34:7(a,c){p b=6.1K(a);l(b.F){b.2w().1Y(6.q.19);b.1p("4k")&&b.4j(c)}16{b=$("<"+6.q.2C+"/>").1p({"Q":6.32(a),4k:w}).1Y(6.q.19).4j(c||"");l(6.q.2u){b=b.2y().4n().5Z("<"+6.q.2u+"/>").4p()}l(!6.2r.5Y(b).F)6.q.4h?6.q.4h(b,$(a)):b.5W(a)}l(!c&&6.q.1G){b.3C("");1h 6.q.1G=="1t"?b.1Y(6.q.1G):6.q.1G(b)}6.1o=6.1o.1e(b)},1K:7(a){p b=6.32(a);8 6.2z().1n(7(){8 $(6).1p(\'Q\')==b})},32:7(a){8 6.2d[a.u]||(6.1D(a)?a.u:a.4z||a.u)},1D:7(a){8/3B|3z/i.15(a.1A)},2f:7(d){p c=6.U;8 $(5V.5U(d)).3d(7(a,b){8 b.M==c&&b.u==d&&b||4g})},1M:7(a,b){22(b.4f.3k()){1b\'2b\':8 $("3y:3o",b).F;1b\'1B\':l(6.1D(b))8 6.2f(b.u).1n(\':4l\').F}8 a.F},4e:7(b,a){8 6.2I[1h b]?6.2I[1h b](b,a):w},2I:{"5Q":7(b,a){8 b},"1t":7(b,a){8!!$(b,a.M).F},"7":7(b,a){8 b(a)}},K:7(a){8!$.v.1T.14.11(6,$.1q(a.Z),a)&&"1S-1Z"},4d:7(a){l(!6.1i[a.u]){6.1a++;6.1i[a.u]=w}},4c:7(a,b){6.1a--;l(6.1a<0)6.1a=0;S 6.1i[a.u];l(b&&6.1a==0&&6.1l&&6.M()){$(6.U).23();6.1l=I}16 l(!b&&6.1a==0&&6.1l){$(6.U).2H("1g-M",[6]);6.1l=I}},2o:7(a){8 $.17(a,"2o")||$.17(a,"2o",{31:4g,J:w,1j:6.2x(a,"1r")})}},1J:{14:{14:w},1I:{1I:w},1v:{1v:w},1u:{1u:w},2q:{2q:w},4b:{4b:w},1s:{1s:w},4a:{4a:w},1U:{1U:w},2c:{2c:w}},49:7(a,b){a.29==4u?6.1J[a]=b:$.H(6.1J,a)},3W:7(b){p a={};p c=$(b).1p(\'5L\');c&&$.P(c.1O(\' \'),7(){l(6 V $.v.1J){$.H(a,$.v.1J[6])}});8 a},3U:7(c){p a={};p d=$(c);Q(Y V $.v.1T){p b=d.1p(Y);l(b){a[Y]=b}}l(a.18&&/-1|5K|5J/.15(a.18)){S a.18}8 a},3Y:7(a){l(!$.1y)8{};p b=$.17(a.M,\'v\').q.39;8 b?$(a).1y()[b]:$(a).1y()},2D:7(b){p a={};p c=$.17(b.M,\'v\');l(c.q.1f){a=$.v.1N(c.q.1f[b.u])||{}}8 a},42:7(d,e){$.P(d,7(c,b){l(b===I){S d[c];8}l(b.30||b.2t){p a=w;22(1h b.2t){1b"1t":a=!!$(b.2t,e.M).F;2K;1b"7":a=b.2t.11(e,e);2K}l(a){d[c]=b.30!==20?b.30:w}16{S d[c]}}});$.P(d,7(a,b){d[a]=$.46(b)?b(e):b});$.P([\'1z\',\'18\',\'1F\',\'1x\'],7(){l(d[6]){d[6]=2Q(d[6])}});$.P([\'2j\',\'2i\'],7(){l(d[6]){d[6]=[2Q(d[6][0]),2Q(d[6][1])]}});l($.v.3J){l(d.1F&&d.1x){d.2i=[d.1F,d.1x];S d.1F;S d.1x}l(d.1z&&d.18){d.2j=[d.1z,d.18];S d.1z;S d.18}}l(d.G){S d.G}8 d},1N:7(a){l(1h a=="1t"){p b={};$.P(a.1O(/\\s/),7(){b[6]=w});a=b}8 a},5G:7(c,a,b){$.v.1T[c]=a;$.v.G[c]=b!=20?b:$.v.G[c];l(a.F<3){$.v.49(c,$.v.1N(c))}},1T:{14:7(c,d,a){l(!6.4e(a,d))8"1S-1Z";22(d.4f.3k()){1b\'2b\':p b=$(d).2M();8 b&&b.F>0;1b\'1B\':l(6.1D(d))8 6.1M(c,d)>0;5F:8 $.1q(c).F>0}},1r:7(f,h,j){l(6.K(h))8"1S-1Z";p g=6.2o(h);l(!6.q.G[h.u])6.q.G[h.u]={};g.43=6.q.G[h.u].1r;6.q.G[h.u].1r=g.1j;j=1h j=="1t"&&{1v:j}||j;l(g.31!==f){g.31=f;p k=6;6.4d(h);p i={};i[h.u]=f;$.2R($.H(w,{1v:j,41:"2S",40:"1d"+h.u,5A:"5z",17:i,1G:7(d){k.q.G[h.u].1r=g.43;p b=d===w;l(b){p e=k.1l;k.2E(h);k.1l=e;k.1k.2a(h);k.1m()}16{p a={};p c=(g.1j=d||k.2x(h,"1r"));a[h.u]=$.46(c)?c(f):c;k.1m(a)}g.J=b;k.4c(h,b)}},j));8"1i"}16 l(6.1i[h.u]){8"1i"}8 g.J},1z:7(b,c,a){8 6.K(c)||6.1M($.1q(b),c)>=a},18:7(b,c,a){8 6.K(c)||6.1M($.1q(b),c)<=a},2j:7(b,d,a){p c=6.1M($.1q(b),d);8 6.K(d)||(c>=a[0]&&c<=a[1])},1F:7(b,c,a){8 6.K(c)||b>=a},1x:7(b,c,a){8 6.K(c)||b<=a},2i:7(b,c,a){8 6.K(c)||(b>=a[0]&&b<=a[1])},1I:7(a,b){8 6.K(b)||/^((([a-z]|\\d|[!#\\$%&\'\\*\\+\\-\\/=\\?\\^X`{\\|}~]|[\\y-\\x\\E-\\C\\A-\\B])+(\\.([a-z]|\\d|[!#\\$%&\'\\*\\+\\-\\/=\\?\\^X`{\\|}~]|[\\y-\\x\\E-\\C\\A-\\B])+)*)|((\\3T)((((\\2k|\\1X)*(\\2V\\3S))?(\\2k|\\1X)+)?(([\\3R-\\5u\\3P\\3M\\5t-\\5r\\3Z]|\\5D|[\\5E-\\5o]|[\\5n-\\5m]|[\\y-\\x\\E-\\C\\A-\\B])|(\\\\([\\3R-\\1X\\3P\\3M\\2V-\\3Z]|[\\y-\\x\\E-\\C\\A-\\B]))))*(((\\2k|\\1X)*(\\2V\\3S))?(\\2k|\\1X)+)?(\\3T)))@((([a-z]|\\d|[\\y-\\x\\E-\\C\\A-\\B])|(([a-z]|\\d|[\\y-\\x\\E-\\C\\A-\\B])([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])*([a-z]|\\d|[\\y-\\x\\E-\\C\\A-\\B])))\\.)+(([a-z]|[\\y-\\x\\E-\\C\\A-\\B])|(([a-z]|[\\y-\\x\\E-\\C\\A-\\B])([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])*([a-z]|[\\y-\\x\\E-\\C\\A-\\B])))\\.?$/i.15(a)},1v:7(a,b){8 6.K(b)||/^(5l?|5j):\\/\\/(((([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])|(%[\\1W-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|[\\y-\\x\\E-\\C\\A-\\B])|(([a-z]|\\d|[\\y-\\x\\E-\\C\\A-\\B])([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])*([a-z]|\\d|[\\y-\\x\\E-\\C\\A-\\B])))\\.)+(([a-z]|[\\y-\\x\\E-\\C\\A-\\B])|(([a-z]|[\\y-\\x\\E-\\C\\A-\\B])([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])*([a-z]|[\\y-\\x\\E-\\C\\A-\\B])))\\.?)(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])|(%[\\1W-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])|(%[\\1W-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])|(%[\\1W-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|[\\5h-\\5g]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|X|~|[\\y-\\x\\E-\\C\\A-\\B])|(%[\\1W-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i.15(a)},1u:7(a,b){8 6.K(b)||!/5e|5S/.15(2e 5T(a))},2q:7(a,b){8 6.K(b)||/^\\d{4}[\\/-]\\d{1,2}[\\/-]\\d{1,2}$/.15(a)},1s:7(a,b){8 6.K(b)||/^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/.15(a)},1U:7(a,b){8 6.K(b)||/^\\d+$/.15(a)},2c:7(b,e){l(6.K(e))8"1S-1Z";l(/[^0-9-]+/.15(b))8 I;p a=0,d=0,2p=I;b=b.1P(/\\D/g,"");Q(p n=b.F-1;n>=0;n--){p c=b.5c(n);p d=5a(c,10);l(2p){l((d*=2)>9)d-=9}a+=d;2p=!2p}8(a%10)==0},44:7(b,c,a){a=1h a=="1t"?a.1P(/,/g,\'|\'):"59|58?g|57";8 6.K(c)||b.62(2e 3s(".("+a+")$","i"))},2n:7(c,d,a){p b=$(a).56(".1d-2n").2J("4B.1d-2n",7(){$(d).J()});8 c==b.2M()}}});$.W=$.v.W})(2v);(7($){p c=$.2R;p d={};$.2R=7(a){a=$.H(a,$.H({},$.54,a));p b=a.40;l(a.41=="2S"){l(d[b]){d[b].2S()}8(d[b]=c.1Q(6,T))}8 c.1Q(6,T)}})(2v);(7($){$.P({3g:\'3F\',4B:\'3E\'},7(b,a){$.1E.37[a]={53:7(){l($.3H.4r)8 I;6.50(b,$.1E.37[a].2N,w)},4Z:7(){l($.3H.4r)8 I;6.4Y(b,$.1E.37[a].2N,w)},2N:7(e){T[0]=$.1E.2L(e);T[0].1A=a;8 $.1E.2m.1Q(6,T)}}});$.H($.2O,{1C:7(d,e,c){8 6.2J(d,7(a){p b=$(a.3G);l(b.2Z(e)){8 c.1Q(b,T)}})},4X:7(a,b){8 6.2H(a,[$.1E.2L({1A:a,3G:b})])}})})(2v);',62,389,'||||||this|function|return|||||||||||||if||||var|settings||||name|validator|true|uD7FF|u00A0||uFDF0|uFFEF|uFDCF||uF900|length|messages|extend|false|valid|optional|element|form|Please|enter|each|for|errorList|delete|arguments|currentForm|in|format|_|method|value||call|toHide|elements|required|test|else|data|maxlength|errorClass|pendingRequest|case|submitted|validate|add|rules|invalid|typeof|pending|message|successList|formSubmitted|showErrors|filter|toShow|attr|trim|remote|number|string|date|url|errorMap|max|metadata|minlength|type|input|delegate|checkable|event|min|success|console|email|classRuleSettings|errorsFor|unhighlight|getLength|normalizeRule|split|replace|apply|not|dependency|methods|digits|submitButton|da|x09|addClass|mismatch|undefined|reset|switch|submit|debug||validClass|currentElements|check|constructor|push|select|creditcard|groups|new|findByName|objectLength|focusInvalid|range|rangelength|x20|parameters|handle|equalTo|previousValue|bEven|dateISO|labelContainer|containers|depends|wrapper|jQuery|removeClass|defaultMessage|hide|errors|errorLabelContainer|resetForm|errorElement|staticRules|prepareElement|clean|prepareForm|triggerHandler|dependTypes|bind|break|fix|val|handler|fn|addWrapper|Number|ajax|abort|hideErrors|rulesCache|x0d|characters|than|window|is|param|old|idOrName|defaults|showLabel|submitHandler|theregex|special|highlight|meta|cancelSubmit|click|formatAndAdd|map|lastActive|catch|focus|findLastActive|ignore|button|toLowerCase|errorContainer|defaultShowErrors|grep|selected|error|numberOfInvalids|find|RegExp|checkForm|onsubmit|nothing|invalidHandler|Array|option|checkbox|remove|radio|text|makeArray|focusout|focusin|target|browser|init|autoCreateRanges|equal|or|x0c|size|try|x0b|ignoreTitle|x01|x0a|x22|attributeRules|between|classRules|no|metadataRules|x7f|port|mode|normalizeRules|originalMessage|accept|and|isFunction|the|to|addClassRules|numberDE|dateDE|stopRequest|startRequest|depend|nodeName|null|errorPlacement|errorContext|html|generated|checked|invalidElements|show|validElements|parent|field|msie|strong|findDefined|String|parentNode|customMessage|customMetaMessage|lastElement|id|on|blur|log|continue|onfocusout|removeAttrs|cancel|assigned|has|blockFocusCleanup|disabled|image|focusCleanup|can|onfocusin|visible|label|slice|textarea|file|password|unshift|keyup|triggerEvent|removeEventListener|teardown|addEventListener|appendTo|warn|setup|ajaxSettings|valueCache|unbind|gif|jpe|png|parseInt|prototype|charAt|greater|Invalid|unchecked|uF8FF|uE000|filled|ftp|less|https|x7e|x5d|x5b|blank|long|x1f|expr|x0e|x08|hidden|least|at|more|json|dataType|extension|with|x21|x23|default|addMethod|again|same|524288|2147483647|class|card|preventDefault|credit|only|boolean|ISO|NaN|Date|getElementsByName|document|insertAfter|URL|append|wrap|address|This|match|defined|No|setDefaults|Warning|returning|title|onclick|throw|onkeyup|removeAttr|checking|when|occured|exception'.split('|'),0,{}))
jQuery.validator.addMethod("phoneUS", 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");
jQuery.validator.addMethod("zipcode", function(zipcode, element) {
    zipcode = zipcode.replace(/\s+/g, ""); 
	return this.optional(element) || zipcode.length > 4 &&
		zipcode.match(/(^\d{5}$)|(^\d{5}-\d{4}$)/);
}, "Please specify a valid zipcode");
	
		function getCitiesFromState(state, select, spinnerNum) {
			if (window.XMLHttpRequest) {
				xmlhttp=new XMLHttpRequest();
			} else {
				xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			xmlhttp.onreadystatechange=function() {
				$('#mask2').show();
				if (xmlhttp.readyState==4 && xmlhttp.status==200) {
                    $('#mask2').hide();					
                    $('#'+select).html(xmlhttp.responseText);
					}
			}
			
			xmlhttp.open("GET","/includes/ajax/cities-from-state.php?state="+state,true);
			xmlhttp.send();
		}
		
		function validateZips(zip, el) {
					if (window.XMLHttpRequest) {
						xmlhttp=new XMLHttpRequest();
					} else {
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					xmlhttp.onreadystatechange=function() {
						if (xmlhttp.readyState==4 && xmlhttp.status==200) {
							if(xmlhttp.responseText == true) {
                            	//var new_position = $('#jumpup').offset();
    							//window.scrollTo(new_position.left,new_position.top);
								window.scrollTo(0, 0);

                                $('body').css('overflow', 'hidden');
                               // $('#mask').show();
								//$('#box').show();
								$('#boxstep2').dialog("open");
                                $('iframe').hide();
                                $('.video').hide();
							} else {
								jAlert('Invalid Moving From Zip Code', d_alert);
								return false;
							}
						}
					}
					xmlhttp.open("GET","/includes/ajax/validate-zip.php?zip="+zip,true);
					xmlhttp.send();
				}
		
		function getCityStateFromZip(zip) {
        	if (window.XMLHttpRequest) {
						xmlhttp=new XMLHttpRequest();
					} else {
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					xmlhttp.onreadystatechange=function() {
                    	$('#ajax-flag').attr('running', 'true');
						
                        if (xmlhttp.readyState==4 && xmlhttp.status==200) {
							if(xmlhttp.responseText) {
                                var cs = xmlhttp.responseText, csT = cs.split('-'),
                                	city = csT[0], state = csT[1], 
                                    insert = city + ', '+state+' '+zip;
                                
                               
                               
                                if (zip !== '' && zip !== undefined)
                                {
                                    zip = zip.replace(/(\r\n|\n|\r)/gm,"");
                                }
                                
                                if (city !== '' && city !== undefined)
                                {
                                	city = city.replace(/(\r\n|\n|\r)/gm,"");
                                }
                                
                                if (state !== '' && state !== undefined)
                                {
                                	state = state.replace(/(\r\n|\n|\r)/gm,"");
                                }
                                
								$('#from-location').html(insert);
                                $('#pickup-zip').val(zip);
                                $('#pickup-city').val(city);
                                $('#pickup-state').val(state);
							} else {
                            	if (zip.length == 5)
                                {
                                	jAlert('Sorry, but the zip code you provided does not correspond to any known U.S. zip codes.', d_alert);
                                }
							}
                            $('#ajax-flag').attr('running', 'false');
						}
					}
					xmlhttp.open("GET","/includes/ajax/city-state-from-zip.php?zip="+zip,true);
					xmlhttp.send();
        }
		
		
		function validateInitForm() {
			var pickupZip = $('#pickup').val(), deliveryState = $('#stateName').val(), deliveryCity = $('#to-city').val();
			
            if (pickupZip == '')
            {
				jAlert('Please select the zip code associated with the area you are moving from.', d_alert );
				return false;
			}
            
            if (deliveryCity == '' || deliveryState == '')
            {
            	jAlert('Please select the state and zip code you wish to relocate to.', d_alert );
                return false;
            }
		}
        
        function returnNum(evt) {
          var theEvent = evt || window.event;
          var key = theEvent.keyCode || theEvent.which;
          key = String.fromCharCode( key );
          var regex = /[0-9]|[\b]|[\t]/;
          if( !regex.test(key) ) {
            theEvent.returnValue = false;
            if(theEvent.preventDefault) theEvent.preventDefault();
          }
        }
        
        function returnAlpha(evt) {
          var theEvent = evt || window.event;
          var key = theEvent.keyCode || theEvent.which;
          key = String.fromCharCode( key );
          var regex = /[a-zA-Z]|[\b]|[\t]/;
          if( !regex.test(key) ) {
            theEvent.returnValue = false;
            if(theEvent.preventDefault) theEvent.preventDefault();
          }
        }
        
        function blockShift(evt)
        {
        	var theEvent = evt || window.event, 
            	key = theEvent.keyCode || theEvent.which;

            if (theEvent.shiftKey == true && key !== 64 && key !== 95)
            {
            	theEvent.returnValue = false;
            	if(theEvent.preventDefault) theEvent.preventDefault();
            }
        }
		
		   	function insertDate()
        {
        	var date = $('#move-date').val();
            $('#post-date-select').html(date);
            $('#pre-date-select').hide(500);       
            $('#post-date-select').show(500);
            $('#check_date').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/check.png") no-repeat 0px 10px');
            validateStepTwo(false);
        }
        
        function validateName()
        {
        	if ( ($('#first-name').valid()) && ($('#last-name').valid()) )
            {
            	$('#check_name').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/check.png") no-repeat 0px 10px');
            }
            else
            {
            	$('#check_name').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/x.png") no-repeat 0px 10px');
            }
        }
        
        function validateStepTwo(show)
        {
            var count = 0;
            
            if (show !== false)
            {
            	show = true;
            }
            
            if ($('#first-name').val() != '' || $('#last-name').val() != '')
            {
                if ($('#first-name').valid() && $('#last-name').valid())
                {
                    $('#check_name').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/check.png") no-repeat 0px 10px');
                }
                else
                {
                    $('#check_name').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/x.png") no-repeat 0px 10px');
                    count++;
                }
            }
            else
            {
            	if (show === true)
                {
                	$('#check_name').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/red-arrow.png") no-repeat 0px 10px');
                }
                count++;
            }
            
            if ($('#move-date').val() != '')
            {
                $('#check_date').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/check.png") no-repeat 0px 10px');
            }
            else
            {
            	if (show === true)
                {
                	$('#check_date').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/red-arrow.png") no-repeat 0px 10px');
                }
                count++;
            }
            
            if ($('#email').val() != '')
            {
                if ($('#email').valid())
                {
                    $('#check_email').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/check.png") no-repeat 0px 10px');
                }
                else
                {
                    $('#check_email').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/x.png") no-repeat 0px 10px');
                    count++
                }
            }
            else
            {
            	if (show === true)
                {
                	$('#check_email').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/red-arrow.png") no-repeat 0px 10px');
                }
                count++;
            }
            
            if ($('#phone').val() != '')
            {
                if ($('#phone').valid())
                {
                    $('#check_phone').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/check.png") no-repeat 0px 10px');
                }
                else
                {
                    $('#check_phone').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/x.png") no-repeat 0px 10px');
                    count++;
                }
            }
            else
            {
            	 if (show === true)
                {
                	$('#check_phone').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/red-arrow.png") no-repeat 0px 10px');
                }
                count++;
            }
            
           
        };
    
        $(function() {
        	$('input').each(function()
            {
                $(this).val('');
            });
            
            $('select').each(function()
            {
                $(this).val('');
            });
            
        	$('#pickup').focus();
            
        /*	var width = $(document).width();
            if (width <= 1024)
            {
            	$('#box').css('top', '65%');
            }*/
            
			////// FROM SECTION ///////
			$('#from-zip').live('change',function() {
				getCitiesFromState($(this).val(), 'from-city', '1');
				$('#pickup').val('');
				$('#pickup-zip').val('');
				$('#pickup-city').val('');
				$('#pickup-state').val('');				
							
			});
			
            $('#last-name').blur(function()
            {
            	validateName();
            });
            
            $('#first-name').blur(function()
            {
            	validateName();
            });
            
            $('#email').keyup(function(){
            	if ($(this).valid())
                {
                	$('#check_email').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/check.png") no-repeat 0px 10px');
                }
                else
                {
                	$('#check_email').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/x.png") no-repeat 0px 10px');
                }
            });
            
            $('#phone').keyup(function(){
            	if ($(this).valid())
                {
                	$('#check_phone').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/check.png") no-repeat 0px 10px');
                }
                else
                {
                	$('#check_phone').css('background', 'url("http://c3404038.r38.cf0.rackcdn.com/x.png") no-repeat 0px 10px');
                }
            });
            
			$('#from-city').change(function(e) {
				if ($(this).val() !== '')
                {
                    $('#pickup').val($(this).val());
                    hideZippers('pzip');
                    var city = $('#from-city option:selected').html(), state = $('#from-zip option:selected').val(), zip = $(this).val(), insert = '';
                    //console.log(\1);
                    insert = city + ', '+state+' '+zip;
                    $('#from-location').html(insert);
                    $('#pickup-zip').val(zip);
                    $('#pickup-city').val(city);
                    $('#pickup-state').val(state);
                    $('#ajax-flag').attr('running', 'false');
                }
                else
                {
                	jAlert('Please pick a valid city!', d_alert );
                }
			});
            
            
            $('#pickup').blur(function() {
				hideZippers('pzip');
                getCityStateFromZip($(this).val());				
			});
            
            $('#pickup').keypress(function() {
				hideZippers('pzip');
                getCityStateFromZip($(this).val());				
			});
			
			///////// TO SECTION ///////
			$('#stateName').live('change',function() {
				getCitiesFromState($(this).val(), 'to-city', '1');
			});
			
			/////// PERSONAL SECTION /////
		$('#quote-button').click(function() {
                            hideZippers('pzip');
                                var x = validateInitForm();

                                if(x !== false) {validateZips($('#pickup').val());}
								

			});
			
			$('#close-box1').live('click',function() {
				$('#mask').hide();
                $('body').css('overflow', 'auto');
				//$('#box').hide();
				$('#boxstep2').dialog("close");
                $('iframe').show();
                $('.video').show();
			});
            
            $('#close-box2').live('click',function() {
				$('#mask').hide();
                $('body').css('overflow', 'auto');
				//$('#box').hide();
				$('#boxstep2').dialog("close");
                $('iframe').show();
                $('.video').show();
			});
			
			$('#to-city').change(function(e) {
				if ($(this).val() !== '')
                {
                    var city = $('#to-city option:selected').html(), state = $('#stateName option:selected').val(), zip = $(this).val(), insert = '';
                    insert = city + ', '+state+' '+zip;
                    $('#to-location').html(insert);
                    $('#delivery-zip').val(zip);
                    $('#delivery-city').val(city);
                    $('#delivery-state').val(state);
                }
                else
                {
                	jAlert('Please pick a valid city!', d_alert );
                }
			});
            
            $('#pickup').keyup(function() {
                var zipLen = $('#pickup').val();
                
                if (zipLen.length == 5)
                {
                    $('#stateName').focus();
                }
			});
			
            
            $('#form-step2').submit(function() {
            	validateStepTwo();
            });
            
            $('.step2').each(function()
            {
            	$(this).keyup(function()
                {
                    validateStepTwo(false);
                });
            });
            
			$('#pickup').blur(function() {
				getCityStateFromZip($(this).val());
			});
            
            
            
            jQuery.validator.addMethod("accept", function(value, element, param)
            {
    			return value.match(new RegExp("^" + param + "$"));
			});
            
            jQuery.validator.addMethod("phoneUS", 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");
            
            jQuery.validator.addMethod("emailStrict", function(email, element)
            {
                return this.optional(element) 
                ||  email.match(/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9]){1,}?/);
            }, "Please specify a valid email address");
            
            
            $('#form-step2').validate(
            {
            	rules: {
                	'move-date':	'required',
                    'first-name':	{
                    					accept:		"[a-zA-Z]+"
                    				},
                    'last-name':	{
                    					accept:		"[a-zA-Z]+"
                    				},
                    email:			{
                    					required:	true,
                                        emailStrict:true
                    },
                    phone:			{
                    					required:	true,
                                        phoneUS:	true
                    }
                }
            });
            
            $('.only_nums').each(function() {
            	$(this).keypress(function(e) {
                	returnNum(e);
                });
            });
            
            $('.only_alphas').each(function() {
            	$(this).keypress(function(e) {
                	returnAlpha(e);
                });
            });
            
            $('#email').keypress(function(e)
            {
            	blockShift(e);
            });
            
            // $('#email').keyup(function() {
            	// var email = $(this).val(), 
                // ex = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9]){1,}?/, valid = '';
                
                // if (email.match(ex))
                // {
                	// console.log('Expression matches');
                // }
                // else
                // {
                	// console.log('No match');
                // }
            // });
		});
		    function get_keywords(rawquery) {
         $.ajax(
           {
              type:'POST',
              url:"/includes/src/get_keywords.php",
              data:{"rawquery":rawquery},
              cache:false
             }
        );
    }
      $('#stateName').live('click',function(){
                hideZippers('pzip');
                });
        $('#to-city').live('click',function(){
            hideZippers('pzip');
            });
   $('#pickup').live('keypress', function(e){
            ValidateZip(e);
        });
          function ValidateZip(evt) {
            var charCode = (evt.which) ? evt.which : evt.keyCode;
            if (charCode > 31 && (charCode < 48 || charCode > 57)){
                $('#pickup').focus();
                return false;
            }
            else if(charCode == 13  ){
                    return false;
                            }

       if($('#pickup').val().length == 4){
            var arraycharcode = new Array();
            arraycharcode[48]= 0; arraycharcode[49] = 1; arraycharcode[50]= 2;
            arraycharcode[51]=3;
            arraycharcode[52]=4; arraycharcode[53]=5; arraycharcode[54]=6; arraycharcode[55]=7;
            arraycharcode[56]=8; arraycharcode[57]=9;
            //alert(arraycharcode[charCode]);
            fullzip = $('#pickup').val() + arraycharcode[charCode] ;
            var myurl =  "/includes/ajax/validate-zip.php?zip="+ fullzip;
              $.get(myurl, function(result){
                   if(result == false){
                       jAlert('Sorry, but the zip code you provided does not correspond to any known U.S. zip codes.', d_alert);
                    $('#pickup').focus();
                    $('#from-zip').val('');
                    $('#from-city').val('');
                }
                        else{
                             var myurl2 =  "/includes/ajax/city-state-from-zip.php?zip="+ $('#pickup').val();
                              $.get(myurl2, function(result){
                                      var city =  $(result).filter('#city').html();
                                      var state = $(result).filter('#state').html();
                                      var insert = city +', '+ state + ' '+ $('#pickup').val();
                                       //alert(insert);

				  $('#from-zip').val(state);
                                      $('#from-location').html(insert);

                                        $('#pickup-zip').val($('#pickup').val());
                                      $('#pickup-city').val(city);
                                      $('#pickup-state').val(state);
                                       getCitiesFromState2(state,city, $('#pickup').val(), 'from-city');
}).error(function() {
    alert('woops');
                              
                              });
                        }
                  });
     }
}

 function getCitiesFromState2(state,city, zip, select) {

            if (window.XMLHttpRequest) {
                    xmlhttp=new XMLHttpRequest();
            } else {
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function() {
                   // $j('#mask1').show();
                    if (xmlhttp.readyState==4 && xmlhttp.status==200) {
                      //  $j('#mask1').hide();
                        $('#'+select).html(xmlhttp.responseText);
                            }

            }
            xmlhttp.open("GET","/includes/ajax/cities-from-state2.php?state="+state +"&city="+city+"&zip="+zip,true);
            xmlhttp.send();
    }
