/*
 * jFormer JavaScript Library v1.4.4
 * http://jFormer.com/
 *
 * Copyright 2011, Kirk Ouimet, Seth Zander Jensen
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jFormer.com/download#license
 *
 * Date: Mon Jan 10 2011
 */
/** OTHER LICENSES
 * jquery.simpletip 1.3.1. A simple tooltip plugin
 * Copyright (c) 2009 Craig Thompson
 * http://craigsworks.com
 * Licensed under GPLv3
 * http://www.opensource.org/licenses/gpl-3.0.html
 * Version : 1.3.1
 * Released: February 5, 2009 - 11:04am
 * ----
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 3/9/2009
 * @author Ariel Flesler
 * @version 1.4.1
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 * ----
 * Masked Input plugin for jQuery
 * Copyright (c) 2007-2009 Josh Bush (digitalbush.com)
 * Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
 * Version: 1.2.2 (03/09/2009 22:39:06)
 * ----
 * Date Input 1.2.1
 * Requires jQuery version: >= 1.2.6
 * Copyright (c) 2007-2008 Jonathan Leighton & Torchbox Ltd
 */
(function(){var a=false,b=/xyz/.test(function(){})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(c){function d(){!a&&this.init&&this.init.apply(this,arguments)}var e=this.prototype;a=true;var f=new this;a=false;for(var g in c)f[g]=typeof c[g]=="function"&&typeof e[g]=="function"&&b.test(c[g])?function(h,j){return function(){var l=this._super;this._super=e[h];var k=j.apply(this,arguments);this._super=l;return k}}(g,c[g]):c[g];d.prototype=f;d.constructor=d;d.extend=arguments.callee;
return d}})();
DateInput=function(a){function b(c,d){if(typeof opts!="object")d={};a.extend(this,b.DEFAULT_OPTS,d);var e=a('<span class="jFormComponentDateButton">Find Date</span>');this.input=a(c);this.input.after(e);this.button=a(c).parent().find("span.jFormComponentDateButton");this.bindMethodsToObj("show","hide","hideIfClickOutside","keydownHandler","selectDate");this.build();this.selectDate();this.hide()}b.DEFAULT_OPTS={jFormComponentDateSelectorMonthNames:["January","February","March","April","May","June",
"July","August","September","October","November","December"],short_jFormComponentDateSelectorMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],short_day_names:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],start_of_week:0};b.prototype={build:function(){var c=a('<p class="jFormComponentDateSelectorMonthNavigator"><span class="jFormComponentDateSelectorButton jFormComponentDateSelectorPrevious" title="[Page-Up]">&#171;</span> <span class="jFormComponentDateSelectorMonthName"></span> <span class="jFormComponentDateSelectorButton jFormComponentDateSelectorNext" title="[Page-Down]">&#187;</span></p>');
this.monthNameSpan=a(".jFormComponentDateSelectorMonthName",c);a(".jFormComponentDateSelectorPrevious",c).click(this.bindToObj(function(){this.moveMonthBy(-1)}));a(".jFormComponentDateSelectorNext",c).click(this.bindToObj(function(){this.moveMonthBy(1)}));var d=a('<p class="jFormComponentDateSelectorYearNavigator"><span class="jFormComponentDateSelectorButton jFormComponentDateSelectorPrevious" title="[Ctrl+Page-Up]">&#171;</span> <span class="jFormComponentDateSelectorYearName"></span> <span class="jFormComponentDateSelectorButton jFormComponentDateSelectorNext" title="[Ctrl+Page-Down]">&#187;</span></p>');
this.yearNameSpan=a(".jFormComponentDateSelectorYearName",d);a(".jFormComponentDateSelectorPrevious",d).click(this.bindToObj(function(){this.moveMonthBy(-12)}));a(".jFormComponentDateSelectorNext",d).click(this.bindToObj(function(){this.moveMonthBy(12)}));c=a('<div class="jFormComponentDateSelectorNavigator"></div>').append(c,d);var e="<table><thead><tr>";a(this.adjustDays(this.short_day_names)).each(function(){e+="<th>"+this+"</th>"});e+="</tr></thead><tbody></tbody></table>";this.dateSelector=this.rootLayers=
a('<div class="jFormComponentDateSelector"></div>').append(c,e).insertAfter(this.input);if(a.browser.msie&&a.browser.version<7){this.ieframe=a('<iframe class="jFormComponentDateSelectorIEFrame" frameborder="0" src="#"></iframe>').insertBefore(this.dateSelector);this.rootLayers=this.rootLayers.add(this.ieframe);a(".jFormComponentDateSelectorButton",c).mouseover(function(){a(this).addClass("hover")});a(".jFormComponentDateSelectorButton",c).mouseout(function(){a(this).removeClass("hover")})}this.tbody=
a("tbody",this.dateSelector);this.input.change(this.bindToObj(function(){this.selectDate()}));this.selectDate()},selectMonth:function(c){var d=new Date(c.getFullYear(),c.getMonth(),1);if(!this.currentMonth||!(this.currentMonth.getFullYear()==d.getFullYear()&&this.currentMonth.getMonth()==d.getMonth())){this.currentMonth=d;d=this.rangeStart(c);var e=this.rangeEnd(c);e=this.daysBetween(d,e);for(var f="",g=0;g<=e;g++){var h=new Date(d.getFullYear(),d.getMonth(),d.getDate()+g,12,0);if(this.isFirstDayOfWeek(h))f+=
"<tr>";f+=h.getMonth()==c.getMonth()?'<td class="jFormComponentDateSelectorSelectedDay" date="'+this.dateToString(h)+'">'+h.getDate()+"</td>":'<td class="jFormComponentDateSelectorUnselectedMonth" date="'+this.dateToString(h)+'">'+h.getDate()+"</td>";if(this.isLastDayOfWeek(h))f+="</tr>"}this.tbody.empty().append(f);this.monthNameSpan.empty().append(this.monthName(c));this.yearNameSpan.empty().append(this.currentMonth.getFullYear());a(".jFormComponentDateSelectorSelectedDay",this.tbody).click(this.bindToObj(function(j){this.changeInput(a(j.target).attr("date"))}));
a("td[date="+this.dateToString(new Date)+"]",this.tbody).addClass("jFormComponentDateSelectorToday");a("td.jFormComponentDateSelectorSelectedDay",this.tbody).mouseover(function(){a(this).addClass("hover")});a("td.jFormComponentDateSelectorSelectedDay",this.tbody).mouseout(function(){a(this).removeClass("hover")})}a(".jFormComponentDateSelectorSelected",this.tbody).removeClass("jFormComponentDateSelectorSelected");a("td[date="+this.selectedDateString+"]",this.tbody).addClass("jFormComponentDateSelectorSelected")},
selectDate:function(c){if(typeof c=="undefined")c=this.stringToDate(this.input.val());c||(c=new Date);this.selectedDate=c;this.selectedDateString=this.dateToString(this.selectedDate);this.selectMonth(this.selectedDate)},changeInput:function(c){this.input.val(c).change();this.hide()},show:function(){this.rootLayers.css("display","block");this.button.unbind("click",this.show);this.input.unbind("focus",this.show);a(document.body).keydown(this.keydownHandler);a([window,document.body]).click(this.hideIfClickOutside);
this.setPosition()},hide:function(){this.rootLayers.css("display","none");a([window,document.body]).unbind("click",this.hideIfClickOutside);this.button.click(this.show);this.input.focus(this.show);a(document.body).unbind("keydown",this.keydownHandler)},hideIfClickOutside:function(c){c.target!=this.input[0]&&c.target!=this.button[0]&&!this.insideSelector(c)&&this.hide()},insideSelector:function(c){var d=this.dateSelector.offset();d.right=d.left+this.dateSelector.outerWidth();d.bottom=d.top+this.dateSelector.outerHeight();
return c.pageY<d.bottom&&c.pageY>d.top&&c.pageX<d.right&&c.pageX>d.left},keydownHandler:function(c){switch(c.keyCode){case 9:case 27:this.hide();return;case 13:this.changeInput(this.selectedDateString);break;case 33:this.moveDateMonthBy(c.ctrlKey?-12:-1);break;case 34:this.moveDateMonthBy(c.ctrlKey?12:1);break;case 38:this.moveDateBy(-7);break;case 40:this.moveDateBy(7);break;case 37:this.moveDateBy(-1);break;case 39:this.moveDateBy(1);break;default:return}c.preventDefault()},stringToDate:function(c){c=
c.replace(/[^\d]/g,"/");return c.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4,4})$/)?new Date(c):null},dateToString:function(c){function d(e){e=""+e;if(e.length==1)e="0"+e;return e}return d(c.getMonth()+1)+"/"+d(c.getDate())+"/"+c.getFullYear()},setPosition:function(){var c=this.button.position();this.rootLayers.css({top:c.top,left:c.left+this.button.outerWidth()+4});this.ieframe&&this.ieframe.css({width:this.dateSelector.outerWidth(),height:this.dateSelector.outerHeight()});c=c.top+this.dateSelector.outerHeight()+
12;var d="";d=jFormerUtility.isSet(window.scrollY)?window.scrollY:document.documentElement.scrollTop;d+a(window).height()>c||a.scrollTo(c-a(window).height()+"px",250,{axis:"y"})},moveDateBy:function(c){this.selectDate(new Date(this.selectedDate.getFullYear(),this.selectedDate.getMonth(),this.selectedDate.getDate()+c))},moveDateMonthBy:function(c){var d=new Date(this.selectedDate.getFullYear(),this.selectedDate.getMonth()+c,this.selectedDate.getDate());d.getMonth()==this.selectedDate.getMonth()+c+
1&&d.setDate(0);this.selectDate(d)},moveMonthBy:function(c){this.selectMonth(new Date(this.currentMonth.getFullYear(),this.currentMonth.getMonth()+c,this.currentMonth.getDate()))},monthName:function(c){return this.jFormComponentDateSelectorMonthNames[c.getMonth()]},bindToObj:function(c){var d=this;return function(){return c.apply(d,arguments)}},bindMethodsToObj:function(){for(var c=0;c<arguments.length;c++)this[arguments[c]]=this.bindToObj(this[arguments[c]])},indexFor:function(c,d){for(var e=0;e<
c.length;e++)if(d==c[e])return e},monthNum:function(c){return this.indexFor(this.jFormComponentDateSelectorMonthNames,c)},shortMonthNum:function(c){return this.indexFor(this.short_jFormComponentDateSelectorMonthNames,c)},shortDayNum:function(c){return this.indexFor(this.short_day_names,c)},daysBetween:function(c,d){c=Date.UTC(c.getFullYear(),c.getMonth(),c.getDate());d=Date.UTC(d.getFullYear(),d.getMonth(),d.getDate());return(d-c)/864E5},changeDayTo:function(c,d,e){c=e*(Math.abs(d.getDay()-c-e*7)%
7);return new Date(d.getFullYear(),d.getMonth(),d.getDate()+c)},rangeStart:function(c){return this.changeDayTo(this.start_of_week,new Date(c.getFullYear(),c.getMonth()),-1)},rangeEnd:function(c){return this.changeDayTo((this.start_of_week-1)%7,new Date(c.getFullYear(),c.getMonth()+1,0),1)},isFirstDayOfWeek:function(c){return c.getDay()==this.start_of_week},isLastDayOfWeek:function(c){return c.getDay()==(this.start_of_week-1)%7},adjustDays:function(c){for(var d=[],e=0;e<c.length;e++)d[e]=c[(e+this.start_of_week)%
7];return d}};a.fn.date_input=function(c){return this.each(function(){new b(this,c)})};a.date_input={initialize:function(c){a("input.date_input").date_input(c)}};return b}(jQuery);
(function(a){var b=(a.browser.msie?"paste":"input")+".mask",c=window.orientation!=undefined;a.mask={definitions:{"9":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"}};a.fn.extend({caret:function(d,e){if(this.length!=0)if(typeof d=="number"){e=typeof e=="number"?e:d;return this.each(function(){if(this.setSelectionRange){this.focus();this.setSelectionRange(d,e)}else if(this.createTextRange){var g=this.createTextRange();g.collapse(true);g.moveEnd("character",e);g.moveStart("character",d);g.select()}})}else{if(this[0].setSelectionRange){d=
this[0].selectionStart;e=this[0].selectionEnd}else if(document.selection&&document.selection.createRange){var f=document.selection.createRange();d=0-f.duplicate().moveStart("character",-1E5);e=d+f.text.length}return{begin:d,end:e}}},unmask:function(){return this.trigger("unmask")},mask:function(d,e){if(!d&&this.length>0){var f=a(this[0]),g=f.data("tests");return a.map(f.data("buffer"),function(n,o){return g[o]?n:null}).join("")}e=a.extend({placeholder:"_",completed:null},e);var h=a.mask.definitions;
g=[];var j=d.length,l=null,k=d.length;a.each(d.split(""),function(n,o){if(o=="?"){k--;j=n}else if(h[o]){g.push(RegExp(h[o]));if(l==null)l=g.length-1}else g.push(null)});return this.each(function(){function n(m){for(;++m<=k&&!g[m];);return m}function o(m){var p=a(this).caret(),q=m.keyCode;z=q<16||q>16&&q<32||q>32&&q<41;if(!m.shiftKey){if(q==36){m.preventDefault();a(this).caret(n(0))}if(q==35){m.preventDefault();m=r.val().indexOf(" ");for(p=r.val().length;g[m]==null||r.val().charAt(m)!=" ";){m+=1;if(m==
p)break}a(this).caret(m);return false}}if(p.begin-p.end!=0&&(!z||q==8||q==46))u(p.begin,p.end);if(q==8||q==46||c&&q==127){for(m=p.begin+(q==46?0:-1);!g[m]&&--m>=0;);for(p=m;p<k;p++)if(g[p]){s[p]=e.placeholder;q=n(p);if(q<k&&g[p].test(s[q]))s[p]=s[q];else break}y();r.caret(Math.max(l,m));return false}else if(q==27){r.val(t);r.caret(0,v());return false}}function x(m){if(z){z=false;return m.keyCode==8?false:null}m=m||window.event;var p=m.charCode||m.keyCode||m.which,q=a(this).caret();if(m.ctrlKey||m.altKey||
m.metaKey)return true;else if(p>=32&&p<=125||p>186){m=n(q.begin-1);if(m<k){p=String.fromCharCode(p);if(g[m].test(p)){q=m;for(var w=e.placeholder;q<k;q++)if(g[q]){var A=n(q),B=s[q];s[q]=w;if(A<k&&g[A].test(B))w=B;else break}s[m]=p;y();m=n(m);a(this).caret(m);e.completed&&m==k&&e.completed.call(r)}}}return false}function u(m,p){for(var q=m;q<p&&q<k;q++)if(g[q])s[q]=e.placeholder}function y(){return r.val(s.join("")).val()}function v(m){for(var p=r.val(),q=-1,w=0,A=0;w<k;w++)if(g[w]){for(s[w]=e.placeholder;A++<
p.length;){var B=p.charAt(A-1);if(g[w].test(B)){s[w]=B;q=w;break}}if(A>p.length)break}else if(s[w]==p[A]&&w!=j){A++;q=w}if(!m&&q+1<j){r.val("");u(0,k)}else if(m||q+1>=j){y();m||r.val(r.val().substring(0,q+1))}return j?w:l}var r=a(this),s=a.map(d.split(""),function(m){if(m!="?")return h[m]?e.placeholder:m}),z=false,t=r.val();r.data("buffer",s).data("tests",g);r.attr("readonly")||r.one("unmask",function(){r.unbind(".mask").removeData("buffer").removeData("tests")}).bind("focus.mask",function(){t=r.val();
var m=v();y();setTimeout(function(){m==d.length?r.caret(0,m):r.caret(m)},0)}).bind("blur.mask",function(){v();r.val()!=t&&r.change()}).bind("keydown.mask",o).bind("keypress.mask",x).bind(b,function(){setTimeout(function(){r.caret(v(true))},0)});v()})}})})(jQuery);
(function(a){function b(d){return typeof d=="object"?d:{top:d,left:d}}var c=a.scrollTo=function(d,e,f){a(window).scrollTo(d,e,f)};c.defaults={axis:"xy",duration:parseFloat(a.fn.jquery)>=1.3?0:1};c.window=function(){return a(window).scrollable()};a.fn.scrollable=function(){return this.map(function(){if(!(!this.nodeName||a.inArray(this.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1))return this;var d=(this.contentWindow||this).document||this.ownerDocument||this;return a.browser.safari||
d.compatMode=="BackCompat"?d.body:d.documentElement})};a.fn.scrollTo=function(d,e,f){if(typeof e=="object"){f=e;e=0}if(typeof f=="function")f={onAfter:f};if(d=="max")d=9E9;f=a.extend({},c.defaults,f);e=e||f.speed||f.duration;f.queue=f.queue&&f.axis.length>1;if(f.queue)e/=2;f.offset=b(f.offset);f.over=b(f.over);return this.scrollable().each(function(){function g(u){l.animate(o,e,f.easing,u&&function(){u.call(this,d,f)})}function h(u){var y="scroll"+u;if(!x)return j[y];u="client"+u;var v=j.ownerDocument.documentElement,
r=j.ownerDocument.body;return Math.max(v[y],r[y])-Math.min(v[u],r[u])}var j=this,l=a(j),k=d,n,o={},x=l.is("html,body");switch(typeof k){case "number":case "string":if(/^([+-]=)?\d+(\.\d+)?(px)?$/.test(k)){k=b(k);break}k=a(k,this);case "object":if(k.is||k.style)n=(k=a(k)).offset()}a.each(f.axis.split(""),function(u,y){var v=y=="x"?"Left":"Top",r=v.toLowerCase(),s="scroll"+v,z=j[s],t=y=="x"?"Width":"Height";if(n){o[s]=n[r]+(x?0:z-l.offset()[r]);if(f.margin){o[s]-=parseInt(k.css("margin"+v))||0;o[s]-=
parseInt(k.css("border"+v+"Width"))||0}o[s]+=f.offset[r]||0;if(f.over[r])o[s]+=k[t.toLowerCase()]()*f.over[r]}else o[s]=k[r];if(/^\d+$/.test(o[s]))o[s]=o[s]<=0?0:Math.min(o[s],h(t));if(!u&&f.queue){z!=o[s]&&g(f.onAfterFirst);delete o[s]}});g(f.onAfter)}).end()}})(jQuery);
(function(a){function b(e,f,g){var h=f.hash.slice(1),j=document.getElementById(h)||document.getElementsByName(h)[0];if(j){e&&e.preventDefault();var l=a(g.target);if(!(g.lock&&l.is(":animated")||g.onBefore&&g.onBefore.call(g,e,j,l)===false)){g.stop&&l.stop(true);if(g.hash){e=j.id==h?"id":"name";var k=a("<a> </a>").attr(e,h).css({position:"absolute",top:a(window).scrollTop(),left:a(window).scrollLeft()});j[e]="";a("body").prepend(k);location=f.hash;k.remove();j[e]=h}l.scrollTo(j,g).trigger("notify.serialScroll",
[j])}}}var c=location.href.replace(/#.*/,""),d=a.localScroll=function(e){a("body").localScroll(e)};d.defaults={duration:1E3,axis:"y",event:"click",stop:true,target:window,reset:true};d.hash=function(e){if(location.hash){e=a.extend({},d.defaults,e);e.hash=false;if(e.reset){var f=e.duration;delete e.duration;a(e.target).scrollTo(0,e);e.duration=f}b(0,location,e)}};a.fn.localScroll=function(e){function f(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,"")==c&&(!e.filter||a(this).is(e.filter))}
e=a.extend({},d.defaults,e);return e.lazy?this.bind(e.event,function(g){var h=a([g.target,g.target.parentNode]).filter(f)[0];h&&b(g,h,e)}):this.find("a,area").filter(f).bind(e.event,function(g){b(g,this,e)}).end().end()}})(jQuery);
(function(a){var b=".serialScroll",c=a.serialScroll=function(d){a.scrollTo.window().serialScroll(d)};c.defaults={duration:1E3,axis:"x",event:"click",start:0,step:1,lock:1,cycle:1,constant:1};a.fn.serialScroll=function(d){d=a.extend({},c.defaults,d);var e=d.event,f=d.step,g=d.lazy;return this.each(function(){function h(t){t.data+=v;j(t,this)}function j(t,m){if(!isNaN(m)){t.data=m;m=u}var p=t.data,q=t.type,w=d.exclude?k().slice(0,-d.exclude):k(),A=w.length,B=w[p],C=d.duration;q&&t.preventDefault();
if(r){clearTimeout(z);z=setTimeout(l,d.interval)}if(!B){p=p<0?0:p=A-1;if(v!=p)p=p;else if(d.cycle)p=A-p-1;else return;B=w[p]}if(!(!B||q&&v==p||d.lock&&x.is(":animated")||q&&d.onBefore&&d.onBefore.call(m,t,B,x,k(),p)===false)){d.stop&&x.queue("fx",[]).stop();if(d.constant)C=Math.abs(C/f*(v-p));x.scrollTo(B,C,d).trigger("notify"+b,[p])}}function l(){x.trigger("next"+b)}function k(){return a(y,u)}function n(t){if(!isNaN(t))return t;for(var m=k(),p;(p=m.index(t))==-1&&t!=u;)t=t.parentNode;return p}var o=
d.target?this:document,x=a(d.target||this,o),u=x[0],y=d.items,v=d.start,r=d.interval,s=d.navigation,z;g||(y=k());d.force&&j({},v);a(d.prev||[],o).bind(e,-f,h);a(d.next||[],o).bind(e,f,h);u.ssbound||x.bind("prev"+b,-f,h).bind("next"+b,f,h).bind("goto"+b,j);r&&x.bind("start"+b,function(){if(!r){clearTimeout(z);r=1;l()}}).bind("stop"+b,function(){clearTimeout(z);r=0});x.bind("notify"+b,function(t,m){var p=n(m);if(p>-1)v=p});u.ssbound=1;if(d.jump)(g?x:k()).bind(e,function(t){j(t,n(t.target))});if(s)s=
a(s,o).bind(e,function(t){t.data=Math.round(k().length/s.length)*s.index(this);j(t,this)})})}})(jQuery);
(function(){function a(b,c){var d=this;b=jQuery(b);var e=['<span class="tipArrow"></span><div class="tipContent">',c.content.html(),"</div>"].join(""),f=jQuery(c.content).addClass(c.baseClass).addClass(c.fixed?c.fixedClass:"").addClass(c.persistent?c.persistentClass:"").html(e);jQuery(window).resize(function(){f.is(":visible")&&d.updatePos()});c.hidden?f.hide():f.show();if(c.persistent){b.click(function(){b.get(0)});jQuery(window).mousedown(function(g){f.css("display")!=="none"&&c.focus&&jQuery(g.target).parents(".tooltip").andSelf().filter(function(){return this===
f.get(0)})})}else{b.hover(function(g){d.show(g)},function(){d.hide()});c.fixed||b.mousemove(function(g){f.css("display")!=="none"&&d.updatePos(g)})}jQuery.extend(d,{getVersion:function(){return[1,2,0]},getParent:function(){return b},getTooltip:function(){return f},getPos:function(){return f.position()},setPos:function(g,h){var j=b.position();if(typeof g=="string")g=parseInt(g)+j.left;if(typeof h=="string")h=parseInt(h)+j.top;f.css({left:g,top:h});return d},show:function(g){if(c.onBeforeShow()===false)return false;
d.updatePos(c.fixed?null:g);switch(c.showEffect){case "fade":f.fadeIn(c.showTime);break;case "slide":f.slideDown(c.showTime,d.updatePos);break;case "custom":c.showCustom.call(f,c.showTime);break;default:case "none":f.show()}f.addClass(c.activeClass);c.onShow.call(d);jQuery(document).trigger("blurTip",[f,"show"]);return d},hide:function(){c.onBeforeHide.call(d);switch(c.hideEffect){case "fade":f.fadeOut(c.hideTime);break;case "slide":f.slideUp(c.hideTime);break;case "custom":c.hideCustom.call(f,c.hideTime);
break;default:case "none":f.hide()}f.removeClass(c.activeClass);c.onHide.call(d);jQuery(document).trigger("blurTip",[f,"hide"]);return d},update:function(){return d},load:function(g,h){c.beforeContentLoad.call(d);f.load(g,h,function(){c.onContentLoad.call(d)});return d},boundryCheck:function(g,h){var j=g+f.outerWidth(),l=h+f.outerHeight(),k=jQuery(window).width()+jQuery(window).scrollLeft(),n=jQuery(window).height()+jQuery(window).scrollTop();return[j>=k,l>=n]},updatePos:function(g){var h=f.outerWidth(),
j=f.outerHeight();if(!g&&c.fixed)if(c.position.constructor==Array){o=parseInt(c.position[0]);g=parseInt(c.position[1])}else if(jQuery(c.position).attr("nodeType")===1){g=jQuery(c.position).position();o=g.left;g=g.top}else{var l=b.position(),k=b.outerWidth(),n=b.outerHeight(),o="";g="";switch(c.position){case "top":o=l.left-h/2+k/2;g=l.top-j;break;case "bottom":o=l.left-h/2+k/2;g=l.top+n;break;case "left":o=l.left-h;g=l.top-j/2+n/2;break;case "right":o=l.left+k;g=l.top-j/2+n/2;break;case "topRight":o=
l.left+k;g=l.top;break;default:case "default":o=k/2+l.left+20;g=l.top}}else{o=g.pageX;g=g.pageY}if(typeof c.position!="object"){o+=c.offset[0];g+=c.offset[1];if(c.boundryCheck){l=d.boundryCheck(o,g);if(l[0])o=o-h/2-2*c.offset[0];if(l[1])g=g-j/2-2*c.offset[1]}}else{if(typeof c.position[0]=="string")o=String(o);if(typeof c.position[1]=="string")g=String(g)}d.setPos(o,g);return d}})}jQuery.fn.simpletip=function(b){var c=jQuery(this).eq(typeof b=="number"?b:0).data("simpletip");if(c)return c;var d={content:"A simple tooltip",
persistent:false,focus:false,hidden:true,position:"default",offset:[0,0],boundryCheck:false,fixed:true,showEffect:"fade",showTime:150,showCustom:null,hideEffect:"fade",hideTime:150,hideCustom:null,baseClass:"tooltip",activeClass:"active",fixedClass:"fixed",persistentClass:"persistent",focusClass:"focus",onBeforeShow:function(){return true},onShow:function(){},onBeforeHide:function(){},onHide:function(){},beforeContentLoad:function(){},onContentLoad:function(){}};jQuery.extend(d,b);this.each(function(){var e=
new a(jQuery(this),d);jQuery(this).data("simpletip",e)});return this}})();
JFormer=Class.extend({init:function(a,b){this.initializing=true;this.options=$.extend(true,{animationOptions:{pageScroll:{duration:375,adjustHeightDuration:375},instance:{appearDuration:0,appearEffect:"fade",removeDuration:0,removeEffect:"fade",adjustHeightDuration:0},dependency:{appearDuration:250,appearEffect:"fade",hideDuration:100,hideEffect:"fade",adjustHeightDuration:100},alert:{appearDuration:250,appearEffect:"fade",hideDuration:100,hideEffect:"fade"},modal:{appearDuration:0,hideDuration:0}},
trackBind:false,disableAnalytics:false,setupPageScroller:true,validationTips:true,pageNavigator:false,saveState:false,splashPage:false,progressBar:false,alertsEnabled:true,clientSideValidation:true,debugMode:false,submitButtonText:"Submit",submitProcessingButtonText:"Processing...",onSubmitStart:function(){return true},onSubmitFinish:function(){return true}},b.options||{});if(this.options.trackBind)jQuery.fn.bind=function(d){return function(){console.count("jQuery Bind Count");console.log("jQuery Bind %o",
arguments[0],this);return d.apply(this,arguments)}}(jQuery.fn.bind);this.id=a;this.form=$(["form#",this.id].join(""));this.formData={};this.jFormPageWrapper=this.form.find("div.jFormPageWrapper");this.jFormPageScroller=this.form.find("div.jFormPageScroller");this.jFormPageNavigator=null;this.jFormPages={};this.maxJFormPageIdArrayIndexReached=this.currentJFormPage=null;this.jFormPageIdArray=[];this.currentJFormPageIdArrayIndex=null;this.blurredTips=[];this.lastEnabledPage=false;this.initializationTime=
(new Date).getTime()/1E3;this.jFormComponentCount=this.durationInSeconds=0;this.control=this.form.find("ul.jFormerControl");this.controlNextLi=this.form.find("ul.jFormerControl li.nextLi");this.controlNextButton=this.controlNextLi.find("button.nextButton");this.controlPreviousLi=this.form.find("ul.jFormerControl li.previousLi");this.controlPreviousButton=this.controlPreviousLi.find("button.previousButton");this.saveIntervalSetTimeoutId=null;this.initPages(b.jFormPages);if(this.options.splashPage!==
false||this.options.saveState!==false){if(this.options.splashPage==false)this.options.splashPage={};this.addSplashPage()}else{this.maxJFormPageIdArrayIndexReached=this.currentJFormPageIdArrayIndex=0;this.currentJFormPage=this.jFormPages[this.jFormPageIdArray[0]];this.currentJFormPage.active=true;this.currentJFormPage.startTime=(new Date).getTime()/1E3;this.options.pageNavigator!==false&&this.addPageNavigator()}this.options.setupPageScroller&&this.setupPageScroller();this.hideInactivePages();this.setupControl();
this.addSubmitListener();this.addEnterKeyListener();this.addBlurTipListener();this.checkDependencies(true);this.initializing=false;var c=this;$(window).load(function(){c.adjustHeight()})},initPages:function(a){var b=this,c=$.each,d={};c(a,function(e,f){var g=new JFormPage(b,e,f.options);g.show();g.options.dependencyOptions!==null&&$.each(g.options.dependencyOptions.dependentOn,function(h,j){if(d[j]===undefined)d[j]={pages:[],sections:[],components:[]};d[j].pages.push({jFormPageId:e})});c(f.jFormSections,
function(h,j){var l=new JFormSection(g,h,j.options);l.options.dependencyOptions!==null&&$.each(l.options.dependencyOptions.dependentOn,function(k,n){if(d[n]===undefined)d[n]={pages:[],sections:[],components:[]};d[n].sections.push({jFormPageId:e,jFormSectionId:h})});c(j.jFormComponents,function(k,n){b.jFormComponentCount+=1;var o=new window[n.type](l,k,n.type,n.options);l.addComponent(o);o.options.dependencyOptions!==null&&$.each(o.options.dependencyOptions.dependentOn,function(x,u){if(d[u]===undefined)d[u]=
{pages:[],sections:[],components:[]};d[u].components.push({jFormPageId:e,jFormSectionId:h,jFormComponentId:k})})});g.addSection(l)});b.addJFormPage(g)});$.each(d,function(e,f){$("#"+e+":text, textarea#"+e).bind("keyup",function(){$.each(f.pages,function(h,j){b.jFormPages[j.jFormPageId].checkDependencies()});$.each(f.sections,function(h,j){b.jFormPages[j.jFormPageId].jFormSections[j.jFormSectionId].checkDependencies()});$.each(f.components,function(h,j){b.jFormPages[j.jFormPageId].jFormSections[j.jFormSectionId].jFormComponents[j.jFormComponentId].checkDependencies()})});
$("#"+e+"-wrapper").bind("jFormComponent:changed",function(){$.each(f.pages,function(h,j){b.jFormPages[j.jFormPageId].checkDependencies()});$.each(f.sections,function(h,j){b.jFormPages[j.jFormPageId].jFormSections[j.jFormSectionId].checkDependencies()});$.each(f.components,function(h,j){b.jFormPages[j.jFormPageId].jFormSections[j.jFormSectionId].jFormComponents[j.jFormComponentId].checkDependencies()})});var g=b.select(e);if(g!==null&&g.options.instanceOptions!==null)g.options.dependencies=f})},select:function(a){var b=
false,c=null;$.each(this.jFormPages,function(d,e){$.each(e.jFormSections,function(f,g){$.each(g.jFormComponents,function(h,j){if(j.id==a){c=j;b=true}return!b});return!b});return!b});return c},checkDependencies:function(){$.each(this.jFormPages,function(a,b){b.checkDependencies();$.each(b.jFormSections,function(c,d){d.checkDependencies();$.each(d.jFormComponents,function(e,f){f.checkDependencies()})})})},addSplashPage:function(){var a=this;this.options.splashPage.jFormPage=new JFormPage(this,this.form.find("div.jFormerSplashPage").attr("id"));
this.options.splashPage.jFormPage.addSection(new JFormSection(this.options.splashPage.jFormPage,this.form.find("div.jFormerSplashPage").attr("id")+"-section"));this.options.splashPage.jFormPage.page.width(this.form.width());this.options.splashPage.jFormPage.active=true;this.options.splashPage.jFormPage.startTime=(new Date).getTime()/1E3;this.currentJFormPage=this.options.splashPage.jFormPage;this.jFormPageWrapper.height(this.options.splashPage.jFormPage.page.outerHeight());if(this.options.splashPage.customButtonId){this.options.splashPage.controlSplashLi=
this.form.find("#"+this.options.splashPage.customButtonId);this.options.splashPage.controlSplashButton=this.form.find("#"+this.options.splashPage.customButtonId)}else{this.options.splashPage.controlSplashLi=this.form.find("li.splashLi");this.options.splashPage.controlSplashButton=this.form.find("button.splashButton")}this.setupControl();this.options.saveState!==false?a.addSaveStateToSplashPage():this.options.splashPage.controlSplashButton.bind("click",function(b){b.preventDefault();a.beginFormFromSplashPage(false)})},
beginFormFromSplashPage:function(a,b){var c=this;if(this.options.pageNavigator!==false&&this.jFormPageNavigator==null){this.addPageNavigator();this.jFormPageNavigator.show()}else this.options.pageNavigator!==false&&this.jFormPageNavigator.show();this.form.find(".jFormPage").css("width",this.form.find(".jFormWrapperContainer").width());c.options.splashPage.jFormPage.active=false;if(!b){c.currentJFormPageIdArrayIndex=0;c.jFormPages[c.jFormPageIdArray[0]].scrollTo({onAfter:function(){c.options.splashPage.jFormPage.hide();
c.renumberPageNavigator()}})}a&&c.initSaveState()},addSaveStateToSplashPage:function(){var a=this,b=a.options.splashPage.jFormPage.id+"-section";$.each(a.options.saveState.components,function(e,f){a.options.splashPage.jFormPage.jFormSections[b].addComponent(new window[f.type](a.options.splashPage.jFormPage.jFormSections[b],e,f.type,f.options))});var c="newForm",d=this.options.splashPage.jFormPage.jFormSections[b].jFormComponents;d.saveStateStatus.component.find("input:option").bind("click",{context:this},
function(e){a.form.find("li.jFormerFailureNotice").remove();c=$(e.target).val();if(c=="newForm"){d.saveStatePassword.component.find("label").html('Create password: <span class="jFormComponentLabelRequiredStar"> *</span>');a.options.splashPage.controlSplashButton.text("Begin")}else if(c=="resumeForm"){d.saveStatePassword.component.find("label").html('Form password: <span class="jFormComponentLabelRequiredStar"> *</span>');a.options.splashPage.controlSplashButton.text("Resume")}});a.options.splashPage.controlSplashButton.bind("click",
{context:this},function(e){e.preventDefault();a.form.find("li.jFormerFailureNotice").remove();var f=d.saveStateIdentifier.validate(),g=d.saveStatePassword.validate();if(f&&g){if(c=="newForm"){a.options.splashPage.controlSplashButton.text("Creating form...");var h={};h.meta={};h.meta.totalTime=0;h.meta.currentPage=a.getActivePage().id;h.meta.maxPageIndex=a.maxJFormPageIdArrayIndexReached;h.form={}}else a.options.splashPage.controlSplashButton.text("Loading form...");$(e.target).attr("disabled","disabled");
$.ajax({url:a.form.attr("action"),type:"post",data:{jFormerTask:"initializeSaveState",identifier:d.saveStateIdentifier.getValue(),password:d.saveStatePassword.getValue(),formState:c,formData:jFormerUtility.jsonEncode(h)},dataType:"json",success:function(j){if(j.status=="success")if(c=="newForm")a.beginFormFromSplashPage(true,false);else{if(c=="resumeForm"){a.beginFormFromSplashPage(true,true);a.durationInSeconds=j.response.meta.totalTime;a.setData(j.response.form);a.maxJFormPageIdArrayIndexReached=
j.response.meta.maxPageIndex;a.options.pageNavigator!=null&&a.updatePageNavigator();if(a.jFormPages[j.response.meta.currentPage]==undefined)j.response.meta.currentPage=a.jFormPages[a.jFormPageIdArray[0]].id;if(a.jFormPages[j.response.meta.currentPage].active===false){a.currentJFormPageIdArrayIndex=$.inArray(j.response.meta.currentPage,a.jFormPageIdArray);a.jFormPages[j.response.meta.currentPage].scrollTo({onAfter:function(){a.options.splashPage.jFormPage.hide()}})}}}else if(j.status=="exists"){c==
"newForm"?a.options.splashPage.controlSplashButton.text("Begin"):a.options.splashPage.controlSplashButton.text("Resume");j.response.failureNoticeHtml&&a.control.append($('<li class="jFormerFailureNotice jFormComponentValidationFailed">'+j.response.failureNoticeHtml+"</li>"));$(e.target).removeAttr("disabled")}else if(j.status=="failure"){c=="newForm"?a.options.splashPage.controlSplashButton.text("Begin"):a.options.splashPage.controlSplashButton.text("Resume");j.response.failureNoticeHtml&&a.control.append($(['<li class="jFormerFailureNotice jFormComponentValidationFailed">',
j.response.failureNoticeHtml,"</li>"].join("")));j.response.failureJs&&eval(j.response.failureJs);$(e.target).removeAttr("disabled")}},error:function(){a.showAlert("There was a problem initializing the form.");a.setupControl()}})}else a.options.splashPage.jFormPage.focusOnFirstFailedComponent()})},addPageNavigator:function(){var a=this;this.jFormPageNavigator=this.form.find(".jFormPageNavigator");this.jFormPageNavigator.find(".jFormPageNavigatorLink:first").click(function(){if(a.currentJFormPageIdArrayIndex!=
0){a.currentJFormPageIdArrayIndex=0;a.scrollToPage(a.jFormPageIdArray[0],{})}});this.options.pageNavigator.position=="right"&&this.form.find(".jFormWrapperContainer").width(this.form.width()-this.jFormPageNavigator.width()-30)},updatePageNavigator:function(){for(var a=this,b,c,d=1;d<=this.maxJFormPageIdArrayIndexReached+1;d++){b=d;var e=$("#navigatePage"+b);this.currentJFormPageIdArrayIndex!=b-1?e.removeClass("jFormPageNavigatorLinkActive"):e.addClass("jFormPageNavigatorLinkActive");if(e.hasClass("jFormPageNavigatorLinkLocked")){e.removeClass("jFormPageNavigatorLinkLocked").addClass("jFormPageNavigatorLinkUnlocked");
e.click(function(f){f=$(f.target);f.is("li")||(f=f.closest("li"));c=f.attr("id").match(/[0-9]+$/);c=parseInt(c)-1;a.getActivePage().validate(true);a.currentJFormPageIdArrayIndex!=c&&a.scrollToPage(a.jFormPageIdArray[c]);a.currentJFormPageIdArrayIndex=c})}}},renumberPageNavigator:function(){$(".jFormPageNavigatorLink:visible").each(function(a,b){$(b).find("span").length>0?$(b).find("span").html(a+1):$(b).html("Page "+(a+1))})},addJFormPage:function(a){this.jFormPageIdArray.push(a.id);this.jFormPages[a.id]=
a},removeJFormPage:function(a){$("#"+a).remove();this.jFormPageIdArray=$.grep(this.jFormPageIdArray,function(b){return b!=a});delete this.jFormPages[a]},addEnterKeyListener:function(){var a=this;this.form.bind("keydown",{context:this},function(b){if(b.keyCode===13||b.charCode===13)$(b.target).is("textarea")||b.preventDefault()});this.form.bind("keyup",{context:this},function(b){a.getActivePage();if(b.keyCode===13||b.charCode===13){var c=$(b.target);if(!c.is("textarea"))if(c.is("button")){b.preventDefault();
c.trigger("click").blur()}else if(c.is(".jFormComponentEnterSubmits")){b.preventDefault();c.blur();a.controlNextButton.trigger("click")}else if(c.is("input:checkbox")){b.preventDefault();c.trigger("click")}else if(c.is("input:password")){b.preventDefault();c.blur();a.options.splashPage!==null&&a.currentJFormPage.id==a.options.splashPage.jFormPage.id?a.options.splashPage.controlSplashButton.trigger("click"):a.controlNextButton.trigger("click")}}})},addSubmitListener:function(){var a=this;this.form.bind("submit",
{context:this},function(b){b.preventDefault();a.submitEvent(b)})},initSaveState:function(){var a=this;if(this.options.saveState!==null){this.saveIntervalSetTimeoutId=setInterval(function(){a.saveState(a.options.saveState.showSavingAlert)},this.options.saveState.interval*1E3);this.saveStateInitialized=true}},saveState:function(a){if(this.saveRunning==true)return true;this.saveRunning=true;var b=this,c=this.durationInSeconds+this.getTimeActive(),d={};d.meta={};d.meta.totalTime=c;d.meta.currentPage=
this.getActivePage().id;d.meta.maxPageIndex=this.maxJFormPageIdArrayIndexReached;d.form=this.getData();$.ajax({url:b.form.attr("action"),type:"post",data:{jFormerTask:"saveState",formData:jFormerUtility.jsonEncode(d)},dataType:"json",success:function(){a===true&&b.showAlert("Saving...");b.saveRunning=false},error:function(e,f,g){if(f!="error")g=f?f:"unknown";b.showAlert("There was an error saving your form, we'll try again : "+g,"error");b.saveRunning=false}})},getData:function(){var a=this;this.formData=
{};$.each(this.jFormPages,function(b,c){a.formData[b]=c.getData()});return this.formData},setData:function(a){var b=this;this.formData=a;$.each(a,function(c,d){b.jFormPages[c]!=undefined&&b.jFormPages[c].setData(d)});return this.formData},setupPageScroller:function(a){var b={adjustHeightDuration:0,jFormWrapperContainerWidth:this.form.find(".jFormWrapperContainer").width(),jFormPageWrapperWidth:this.jFormPageWrapper.width(),activePageOuterHeight:this.getActivePage().page.outerHeight()};a=$.extend(b,
a);b=this.form.find(".jFormPage");b.css("width",a.jFormWrapperContainerWidth).show();this.jFormPageScroller.css("width",a.jFormPageWrapperWidth*(b.length+1));this.jFormPageWrapper.height(a.activePageOuterHeight);this.scrollToPage(this.currentJFormPage.id,a)},setupControl:function(){var a=this;this.controlNextButton.unbind().click(function(b){b.preventDefault();b.context=a;a.submitEvent(b)}).removeAttr("disabled");this.lastEnabledPage=false;for(i=this.jFormPageIdArray.length-1;i>this.currentJFormPageIdArrayIndex;i--){if(!this.jFormPages[this.jFormPageIdArray[i]].disabledByDependency){this.lastEnabledPage=
false;break}this.lastEnabledPage=true}this.controlPreviousButton.unbind().click(function(b){b.preventDefault();if(a.options.splashPage!==false&&a.currentJFormPageIdArrayIndex===0){a.currentJFormPageIdArrayIndex=null;a.jFormPageNavigator&&a.jFormPageNavigator.hide();a.options.splashPage.jFormPage.scrollTo()}else{if(a.jFormPages[a.jFormPageIdArray[a.currentJFormPageIdArrayIndex-1]].disabledByDependency)for(b=1;b<=a.currentJFormPageIdArrayIndex;b++){var c=a.currentJFormPageIdArrayIndex-b;if(c==0&&a.options.splashPage!==
false&&a.jFormPages[a.jFormPageIdArray[c]].disabledByDependency){a.jFormPageNavigator&&a.jFormPageNavigator.hide();a.options.splashPage.jFormPage.scrollTo();break}else if(!a.jFormPages[a.jFormPageIdArray[c]].disabledByDependency){a.currentJFormPageIdArrayIndex=c;break}}else a.currentJFormPageIdArrayIndex-=1;a.scrollToPage(a.jFormPageIdArray[a.currentJFormPageIdArrayIndex])}});if(this.currentJFormPageIdArrayIndex===0&&this.currentJFormPageIdArrayIndex!=this.jFormPageIdArray.length-1&&this.lastEnabledPage===
false){this.controlNextButton.html("Next");this.controlNextLi.show();this.controlPreviousLi.hide();this.controlPreviousButton.attr("disabled","disabled")}else if(a.currentJFormPageIdArrayIndex==this.jFormPageIdArray.length-1||this.lastEnabledPage===true){this.controlNextButton.html(this.options.submitButtonText);this.controlNextLi.show();if(a.currentJFormPageIdArrayIndex===0){this.controlPreviousLi.hide();this.controlPreviousButton.attr("disabled","")}else if(a.currentJFormPageIdArrayIndex>0){this.controlPreviousButton.removeAttr("disabled");
this.controlPreviousLi.show()}}else{this.controlNextButton.html("Next");this.controlNextLi.show();this.controlPreviousButton.removeAttr("disabled");this.controlPreviousLi.show()}if(this.options.splashPage!==false){if(this.options.splashPage.jFormPage.active){this.options.splashPage.controlSplashLi.show();this.controlNextLi.hide();this.controlPreviousLi.hide();this.controlPreviousButton.attr("disabled","disabled")}else this.options.splashPage.controlSplashLi.hide();if(this.currentJFormPageIdArrayIndex===
0&&this.options.saveState==false){this.controlPreviousButton.removeAttr("disabled");this.controlPreviousLi.show()}}if(this.control.find(".startOver").length==1){this.controlNextLi.hide();this.controlPreviousLi.hide();this.control.find(".startOver").one("click",function(b){b.preventDefault();a.currentJFormPageIdArrayIndex=0;a.scrollToPage(a.jFormPageIdArray[0],{onAfter:function(){$(b.target).parent().remove();a.removeJFormPage(a.id+"jFormPageFailure")}})})}},scrollToPage:function(a,b){if(this.jFormPages[a]&&
this.jFormPages[a].disabledByDependency)return false;var c=this;this.controlNextButton.attr("disabled",true);this.controlPreviousButton.attr("disabled",true);if(this.jFormPages[a]&&this.jFormPages[a].options.onScrollTo.onBefore!==null){if(this.jFormPages[a].options.onScrollTo.notificationHtml!==undefined)c.control.find(".jformerScrollToNotification").length!=0?c.control.find(".jformerScrollToNotification").html(this.jFormPages[a].options.onScrollTo.notificationHtml):c.control.append('<li class="jformerScrollToNotification">'+
this.jFormPages[a].options.onScrollTo.notificationHtml+"<li>");this.jFormPages[a].options.onScrollTo.onBefore()}var d=this.getActivePage();d.durationActiveInSeconds+=d.getTimeActive();$.each(this.jFormPages,function(f,g){g.show();g.active=false});if(c.options.splashPage!==false&&a==c.options.splashPage.jFormPage.id){c.currentJFormPage=c.options.splashPage.jFormPage;c.currentJFormPage.show()}else this.currentJFormPage=this.jFormPages[a];this.currentJFormPage.active=true;b&&b.adjustHeightDuration!==
undefined?c.adjustHeight({adjustHeightDuration:b.adjustHeightDuration}):c.adjustHeight();this.jFormPageWrapper.dequeue();this.scrollToTop();var e=this.initializing;this.jFormPageWrapper.scrollTo(c.currentJFormPage.page,c.options.animationOptions.pageScroll.duration,{onAfter:function(){$(c.jFormPageWrapper).queue("fx").length<=1&&c.hideInactivePages(c.getActivePage());if(c.maxJFormPageIdArrayIndexReached<c.currentJFormPageIdArrayIndex)c.maxJFormPageIdArrayIndexReached=c.currentJFormPageIdArrayIndex;
c.updatePageNavigator();c.currentJFormPage.startTime=(new Date).getTime()/1E3;b&&b.onAfter&&b.onAfter();c.setupControl();c.controlNextButton.removeAttr("disabled").blur();c.controlPreviousButton.removeAttr("disabled").blur();c.currentJFormPage.validationPassed===false&&!e&&c.currentJFormPage.focusOnFirstFailedComponent();if(c.jFormPages[a]&&c.jFormPages[a].options.onScrollTo.onAfter!==null){c.jFormPages[a].options.onScrollTo.onAfter();c.jFormPages[a].options.onScrollTo.notificationHtml!==null&&c.control.find("li.jFormerScrollToNotification").remove()}}});
return this},scrollToTop:function(){this.initializing||$(window).scrollTop()>this.form.offset().top&&$(document).scrollTo(this.form,this.options.animationOptions.pageScroll.duration,{offset:{top:-10}})},getActivePage:function(){return this.currentJFormPage},getTimeActive:function(){var a=0;$.each(this.jFormPages,function(b,c){a+=c.durationActiveInSeconds});a+=this.getActivePage().getTimeActive();return a},hideInactivePages:function(){$.each(this.jFormPages,function(a,b){b.hide()})},clearValidation:function(){$.each(this.jFormPages,
function(a,b){b.clearValidation()})},submitEvent:function(a){a.stopPropagation();a.preventDefault();this.control.find(".jFormerFailureNotice").remove();this.form.find(".jFormerFailure").remove();typeof this.options.onSubmitStart!="function"?eval(this.options.onSubmitStart):this.options.onSubmitStart();var b=false;if(this.options.clientSideValidation)b=this.currentJFormPageIdArrayIndex<this.jFormPageIdArray.length-1&&!this.lastEnabledPage?this.getActivePage().validate():this.validateAll();else{this.clearValidation();
b=true}if(this.options.onSubmitFinish())if(b&&this.currentJFormPageIdArrayIndex==this.jFormPageIdArray.length-1||this.lastEnabledPage===true)this.submitForm(a);else if(b&&this.currentJFormPageIdArrayIndex<this.jFormPageIdArray.length-1){if(this.jFormPages[this.jFormPageIdArray[this.currentJFormPageIdArrayIndex+1]].disabledByDependency)for(a=this.currentJFormPageIdArrayIndex+1;a<=this.jFormPageIdArray.length-1;a++){if(!this.jFormPages[this.jFormPageIdArray[this.currentJFormPageIdArrayIndex+a]].disabledByDependency){this.currentJFormPageIdArrayIndex+=
a;break}}else this.currentJFormPageIdArrayIndex+=1;this.scrollToPage(this.jFormPageIdArray[this.currentJFormPageIdArrayIndex])}},validateAll:function(){var a=this,b=true,c=0;$.each(this.jFormPages,function(d,e){if(e.validate()===false){a.currentJFormPageIdArrayIndex=c;a.currentJFormPage.id!=e.id&&e.scrollTo();return b=false}c++});return b},adjustHeight:function(a){var b=this.options.animationOptions.pageScroll.adjustHeightDuration;if(this.initializing)b=0;else if(a&&a.adjustHeightDuration!==undefined)b=
a.adjustHeightDuration;this.jFormPageWrapper.animate({height:this.getActivePage().page.outerHeight()},b)},submitForm:function(){var a=this.form.clone(false);a.attr("id",a.attr("id")+"-clone");a.attr("style","display: none;");a.empty();a.appendTo($(this.form).parent());var b=$('<input type="hidden" name="jFormer" />').attr("value",encodeURI(jFormerUtility.jsonEncode(this.getData()))),c=$('<input type="hidden" name="jFormerId" value="'+this.id+'" />');a.append(b);a.append(c);this.form.find("input:file").each(function(d,
e){if($(e).val()!=""){var f=$(e).closest(".jFormSection").attr("id"),g=$(e).closest(".jFormPage").attr("id");if($(e).attr("id").match(/-section[0-9]+/)){var h=null,j=$(e).closest(".jFormSection"),l=j.attr("id").replace(/-section[0-9]+/,"");f=f.replace(/-section[0-9]+/,"");j.closest(".jFormPage").find("div[id*="+l+"]").each(function(n,o){if(j.attr("id")==$(o).attr("id")){h=n+1;return false}return true});e.attr("name",e.attr("name").replace(/-section[0-9]+/,"-section"+h))}if($(e).attr("id").match(/-instance[0-9]+/)){l=
$(e).attr("id").replace(/-instance[0-9]+/,"");var k=null;$(e).closest(".jFormSection").find("input[id*="+l+"]").each(function(n,o){if($(o).attr("id")==$(e).attr("id")){k=n+1;return false}return true});e.attr("name",$(e).attr("name").replace(/-instance[0-9]+/,"-instance"+k))}$(e).attr("name",$(e).attr("name")+":"+g+":"+f);$(e).appendTo(a)}});a.submit();a.remove();this.options.debugMode?this.form.find("iframe:hidden").show():this.controlNextButton.text(this.options.submitProcessingButtonText).attr("disabled",
"disabled")},handleFormSubmissionResponse:function(a){var b=this;if(a.status=="failure"){a.response.validationFailed&&$.each(a.response.validationFailed,function(d,e){$.each(e,function(f,g){$.isArray(g)?$.each(g,function(h,j){var l;l=h!=0?"-section"+(h+1):"";$.each(j,function(k,n){b.jFormPages[d].jFormSections[f].instanceArray[h].jFormComponents[k+l].handleServerValidationResponse(n)})}):$.each(g,function(h,j){b.jFormPages[d].jFormSections[f].jFormComponents[h].handleServerValidationResponse(j)})})});
if(a.response.failureHtml){this.control.find(".jFormerFailure").remove();this.control.after('<div class="jFormerFailure">'+a.response.failureHtml+"</div>")}this.form.find("iframe").contents().find("body script").remove();this.form.find("iframe").contents().find("body").html()!==null&&this.form.find(".jFormerFailure").append("<p>Output:</p>"+this.form.find("iframe").contents().find("body").html().trim());this.controlNextButton.text(this.options.submitButtonText);this.controlNextButton.removeAttr("disabled");
this.getActivePage().focusOnFirstFailedComponent()}else if(a.status=="success"){if(a.response.successPageHtml){clearInterval(this.saveIntervalSetTimeoutId);var c=$('<div id="'+this.id+'jFormPageSuccess" class="jFormPage jFormPageSuccess">'+a.response.successPageHtml+"</div>");c.width(this.jFormPages[this.jFormPageIdArray[0]].page.width());this.jFormPageScroller.append(c);c=new JFormPage(this,this.id+"jFormPageSuccess");this.addJFormPage(c);this.control.hide();this.jFormPageNavigator&&this.jFormPageNavigator.hide();
c.scrollTo()}else if(a.response.failurePageHtml){c=$('<div id="'+this.id+'jFormPageFailure" class="jFormPage jFormPageFailure">'+a.response.failurePageHtml+"</div>");c.width(this.jFormPages[this.jFormPageIdArray[0]].page.width());this.jFormPageScroller.append(c);c=new JFormPage(this,this.id+"jFormPageFailure");this.addJFormPage(c);this.control.append($('<li class="startOver"><button class="startOverButton">Start Over</button></li>'));c.scrollTo()}if(a.response.failureNoticeHtml){this.control.find(".jFormerFailureNotice").remove();
this.control.append('<li class="jFormerFailureNotice">'+a.response.failureNoticeHtml+"</li>");this.controlNextButton.text(this.options.submitButtonText);this.controlNextButton.removeAttr("disabled")}if(a.response.failureHtml){this.control.find(".jFormerFailure").remove();this.control.after('<div class="jFormerFailure">'+a.response.failureHtml+"</div>");this.controlNextButton.text(this.options.submitButtonText);this.controlNextButton.removeAttr("disabled")}if(a.response.successJs)eval(a.response.successJs);
else a.response.failureJs&&eval(a.response.failureJs);if(a.response.redirect){this.controlNextButton.html("Redirecting...");document.location=a.response.redirect}}},showAlert:function(a,b,c,d){function e(){if(f.hideEffect=="slide")g.slideUp(f.hideDuration,function(){});else f.hideEffect=="fade"&&g.fadeOut(f.hideDuration,function(){})}if(this.options.alertsEnabled){var f=$.extend(this.options.animationOptions.alert,d),g=this.form.find(".jFormerAlertWrapper");c=this.form.find(".jFormerAlert");c.addClass(b);
c.text(a);if(f.appearEffect=="slide")g.slideDown(f.appearDuration,function(){setTimeout(e(),1E3)});else f.appearAffect=="fade"&&g.fadeIn(f.appearDuration,function(){setTimeout(e(),1E3)})}},showModal:function(a,b,c,d){var e=this.form.find(".jFormerModalWrapper"),f=$.extend(this.options.animationOptions.modal,d);if(e.length==0){d=$('<div class="jFormerModalTransparency"></div>');e=$('<div style="display: none;" class="jFormerModalWrapper"><div class="jFormerModal"><div class="jFormerModalHeader">'+
a+'</div><div class="jFormerModalContent">'+b+'</div><div class="jFormerModalFooter"><button>Okay</button></div></div></div>');this.form.find(".jFormerAlertWrapper").after(d);this.form.find(".jFormerAlertWrapper").after(e);c!=""&&e.addClass(c);e.find("button").click(function(){$(".jFormerModalWrapper").hide(f.hideDuration);$(".jFormerModalTransparency").hide(f.hideDuration);$(".jFormerModalWrapper").remove();$(".jFormerModalTransparency").remove();$("body").css("overflow","auto")})}var g=e.find(".jFormerModal");
g.css({position:"absolute"});var h=$(window);$("body").css("overflow","hidden");h.resize(function(){j=h.width()/2-g.width()/2;l=h.height()/2-g.height()/2+h.scrollTop();g.css({top:l,left:j});$(".jFormerModalTransparency").width(h.width()).height(h.height())});$(".jFormerModalTransparency").click(function(k){if($(k.target).is(".jFormerModalTransparency")){e.hide(f.hideDuration);e.remove();$(".jFormerModalTransparency").hide(f.hideDuration);$(".jFormerModalTransparency").remove();$("body").css("overflow",
"auto")}});e.show(f.appearDuration);var j=h.width()/2-g.width()/2,l=h.height()/2-g.height()/2+h.scrollTop();$(".jFormerModalTransparency").width(h.width()).height(h.height()*1.1).css("top",h.scrollTop());g.css({top:l,left:j})},recordAnalytics:function(){var a=this;this.options.disableAnalytics||setTimeout(function(){var b=$('<img src="'+("https:"==document.location.protocol?"https://ssl.":"http://www.")+"jformer.com/analytics/analytics.gif?pageCount="+a.jFormPageIdArray.length+"&componentCount="+
a.jFormComponentCount+"&formId="+a.id+'" style="display: none;" />');a.form.append(b);b.remove()},3E3)},updateProgressBar:function(){var a=0,b=0;$.each(this.jFormPages,function(d,e){$.each(e.jFormSections,function(f,g){$.each(g.jFormComponents,function(h,j){if(j.isRequired===true&&j.disabledByDependency===false&&g.disabledByDependency===false)if(j.type!="JFormComponentLikert"){a+=1;if(j.requiredCompleted===true)b+=1}})})});var c=parseInt(b/a*100);this.form.find(".jFormerProgressBar").animate({width:c+
"%"},500).html("<p>"+c+"%</p>")},addBlurTipListener:function(){var a=this;$(document).bind("blurTip",function(b,c,d){if(d=="hide"){a.blurredTips=$.map(a.blurredTips,function(e){return $(e).attr("id")==c.attr("id")?null:e});a.blurredTips[a.blurredTips.length-1]!=undefined&&a.blurredTips[a.blurredTips.length-1].removeClass("jFormerTipBlurred")}else if(d=="show"){a.blurredTips.length>0&&$.each(a.blurredTips,function(e,f){$(f).addClass("jFormerTipBlurred")});a.blurredTips.push(c);c.removeClass("jFormerTipBlurred")}})}});
JFormerUtility=function(){};
$.extend(JFormerUtility.prototype,{isSet:function(){var a=arguments,b=a.length,c=0;if(b==0)throw Error("Empty isSet.");for(;c!=b;)if(typeof a[c]=="undefined"||a[c]===null)return false;else c++;return true},empty:function(a){var b;if(a===""||a===0||a==="0"||a===null||a===false||a===undefined)return true;if(typeof a=="object"){for(b in a)if(typeof a[b]!=="function")return false;return true}return false},getExtraWidth:function(a){a=$(a);var b=0;b+=parseInt(a.css("padding-left"),10)+parseInt(a.css("padding-right"),
10);b+=parseInt(a.css("margin-left"),10)+parseInt(a.css("margin-right"),10);b+=parseInt(a.css("borderLeftWidth"),10)+parseInt(a.css("borderRightWidth"),10);return b},jsonEncode:function(a){var b=window.JSON;if(typeof b==="object"&&typeof b.stringify==="function")return b.stringify(a);var c=function(e){var f=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",
'"':'\\"',"\\":"\\\\"};f.lastIndex=0;return f.test(e)?'"'+e.replace(f,function(h){var j=g[h];return typeof j==="string"?j:"\\u"+("0000"+h.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'},d=function(e,f){var g="",h=0,j=h="";j=0;var l=g,k=[],n=f[e];if(n&&typeof n==="object"&&typeof n.toJSON==="function")n=n.toJSON(e);switch(typeof n){case "string":return c(n);case "number":return isFinite(n)?String(n):"null";case "boolean":case "null":return String(n);case "object":if(!n)return"null";g+="    ";
k=[];if(Object.prototype.toString.apply(n)==="[object Array]"){j=n.length;for(h=0;h<j;h+=1)k[h]=d(h,n)||"null";return j=k.length===0?"[]":g?"[\n"+g+k.join(",\n"+g)+"\n"+l+"]":"["+k.join(",")+"]"}for(h in n)if(Object.hasOwnProperty.call(n,h))if(j=d(h,n))k.push(c(h)+(g?": ":":")+j);return j=k.length===0?"{}":g?"{\n"+g+k.join(",\n"+g)+"\n"+l+"}":"{"+k.join(",")+"}"}};return d("",{"":a})}});jFormerUtility=new JFormerUtility;
(function(){var a=false,b=/xyz/.test(function(){})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(c){function d(){!a&&this.init&&this.init.apply(this,arguments)}var e=this.prototype;a=true;var f=new this;a=false;for(var g in c)f[g]=typeof c[g]=="function"&&typeof e[g]=="function"&&b.test(c[g])?function(h,j){return function(){var l=this._super;this._super=e[h];var k=j.apply(this,arguments);this._super=l;return k}}(g,c[g]):c[g];d.prototype=f;d.constructor=d;d.extend=arguments.callee;
return d}})();
JFormPage=Class.extend({init:function(a,b,c){this.options=$.extend({dependencyOptions:null,onScrollTo:{onBefore:null,onAfter:null,notificationHtml:null}},c||{});if(this.options.onScrollTo.onBefore!==null){var d=$.trim(this.options.onScrollTo.onBefore);this.options.onScrollTo.onBefore=function(){eval(d)}}if(this.options.onScrollTo.onAfter!==null){var e=$.trim(this.options.onScrollTo.onAfter);this.options.onScrollTo.onAfter=function(){eval(e)}}this.jFormer=a;this.id=b;this.page=$("#"+b);this.jFormSections=
{};this.formData={};this.active=false;this.validationPassed=null;this.disabledByDependency=false;this.durationActiveInSeconds=0},addSection:function(a){this.jFormSections[a.id]=a;return this},getData:function(){var a=this;if(this.disabledByDependency)this.formData=null;else{this.formData={};$.each(this.jFormSections,function(b,c){a.formData[b]=c.getData()})}return this.formData},setData:function(a){var b=this;$.each(a,function(c,d){if(b.jFormSections[c]!=undefined)b.jFormSections[c].setData(d);else a[c]=
undefined});return this.formData=a},getTimeActive:function(){return(new Date).getTime()/1E3-this.startTime},validate:function(a){if(this.disabledByDependency)return null;var b=this,c=$.each;b.validationPassed=true;c(this.jFormSections,function(d,e){c(e.instanceArray,function(f,g){c(g.jFormComponents,function(h,j){j.type!="JFormComponentLikert"&&c(j.instanceArray,function(l,k){k.validate();if(k.validationPassed==false)b.validationPassed=false})})})});if(b.validationPassed)$("#navigatePage"+(b.jFormer.currentJFormPageIdArrayIndex+
1)).removeClass("jFormPageNavigatorLinkWarning");else a||this.id===this.jFormer.currentJFormPage.id&&this.focusOnFirstFailedComponent();return b.validationPassed},clearValidation:function(){$.each(this.jFormSections,function(a,b){b.clearValidation()})},focusOnFirstFailedComponent:function(){var a=$.each,b=true;a(this.jFormSections,function(c,d){a(d.instanceArray,function(e,f){a(f.jFormComponents,function(g,h){a(h.instanceArray,function(j,l){if(!l.validationPassed||l.errorMessageArray.length>0){var k=
l.component.offset().top-30,n=$(window).scrollTop();n<k&&n+$(window).height()>l.component.position().top?l.component.find(":input:first").focus():$.scrollTo(k+"px",500,{onAfter:function(){l.component.find(":input:first").focus()}});b=false}return b});return b});return b});return b})},scrollTo:function(a){this.jFormer.scrollToPage(this.id,a);return this},show:function(){this.page.hasClass("jFormPageInactive")&&this.page.removeClass("jFormPageInactive")},hide:function(){this.active||this.page.addClass("jFormPageInactive")},
disableByDependency:function(a){if(this.disabledByDependency!==a){var b=$.inArray(this.id,this.jFormer.jFormPageIdArray);if(a===true){this.page.hide();if(this.jFormer.options.pageNavigator!==false)if(this.options.dependencyOptions.display=="hide"){$("#navigatePage"+(b+1)).hide();this.jFormer.renumberPageNavigator()}else $("#navigatePage"+(b+1)).addClass("jFormPageNavigatorLinkDependencyLocked").find("span").html("&nbsp;")}else{this.checkChildrenDependencies();this.page.show();if(this.jFormer.options.pageNavigator!==
false){this.options.dependencyOptions.display=="hide"?$("#navigatePage"+(b+1)).show():$("#navigatePage"+(b+1)).removeClass("jFormPageNavigatorLinkDependencyLocked");this.jFormer.renumberPageNavigator()}}this.disabledByDependency=a;this.jFormer.setupControl()}},checkDependencies:function(){this.options.dependencyOptions!==null&&this.disableByDependency(!eval(this.options.dependencyOptions.jsFunction))},checkChildrenDependencies:function(){$.each(this.jFormSections,function(a,b){b.checkDependencies()})}});
JFormSection=Class.extend({init:function(a,b,c){this.options=$.extend({dependencyOptions:null,instanceOptions:null},c||{});this.parentJFormPage=a;this.id=b;this.section=$("#"+b);this.jFormComponents={};this.formData=null;this.disabledByDependency=false;if(this.options.isInstance)this.clone=this.instanceArray=null;else{if(this.options.instanceOptions!=null){this.clone=this.section.clone();this.iterations=1}else this.clone=null;this.instanceArray=[this];this.createInstanceButton()}},createInstanceButton:function(){var a=
this;if(this.options.instanceOptions!=null){var b=this.id+"-addInstance",c='<button id="'+b+'" class="jFormSectionAddInstanceButton">'+this.options.instanceOptions.addButtonText+"</button>";this.options.dependencyOptions!==null&&this.options.dependencyOptions.display=="hide"&&c.hide();this.section.after(c);this.parentJFormPage.page.find("#"+b).bind("click",function(d){d.preventDefault();a.disabledByDependency||a.addSectionInstance()})}},addSectionInstance:function(){var a=this;if(this.instanceArray.length<
this.options.instanceOptions.max||this.options.instanceOptions.max===0){this.iterations++;var b=this.clone.clone(),c=this.id+"-removeInstance",d='<button id="'+c+'" class="jFormSectionRemoveInstanceButton">'+this.options.instanceOptions.removeButtonText+"</button>",e={};if(this.options.instanceOptions.animationOptions!==undefined)$.extend(e,this.parentJFormPage.jFormer.options.animationOptions.instance,this.options.instanceOptions.animationOptions);else e=this.parentJFormPage.jFormer.options.animationOptions.instance;
$(b).append(d);b.find("#"+c).bind("click",function(f){var g=$(f.target);f.preventDefault();a.instanceArray=$.map(a.instanceArray,function(h){if(h.section.attr("id")==g.parent().attr("id"))h=null;return h});if(e.removeEffect=="none"||e.removeDuration===0){g.parent().remove();g.remove()}else if(e.removeEffect=="slide"){g.parent().slideUp(e.removeDuration,function(){g.parent().remove();g.remove()});a.parentJFormPage.jFormer.adjustHeight(e)}else g.parent().fadeOut(e.removeDuration,function(){g.parent().remove();
g.remove();a.parentJFormPage.jFormer.adjustHeight(e)});if(a.instanceArray.length<a.options.instanceOptions.max||a.options.instanceOptions.max===0)a.parentJFormPage.page.find("#"+a.id+"-addInstance").show();a.relabelSectionInstances(a.instanceArray,e)});b.hide();this.parentJFormPage.page.find("#"+this.id+"-addInstance").before(b);if(e.appearEffect=="none"||e.appearDuration===0)b.show();else if(e.appearEffect=="slide")b.slideDown(e.appearDuration,function(){a.parentJFormPage.jFormer.adjustHeight(e)});
else{b.fadeIn(e.appearDuration,function(){});a.parentJFormPage.jFormer.adjustHeight(e)}this.nameSectionInstance(b);this.instanceArray.push(this.createSectionInstanceObject(b,this.options));this.relabelSectionInstances(this.instanceArray,e);this.instanceArray.length>=this.options.instanceOptions.max&&this.options.instanceOptions.max!==0&&this.parentJFormPage.page.find("#"+this.id+"-addInstance").hide()}return this},removeInstance:function(){return this},nameSectionInstance:function(a){function b(e,
f){var g=$(e).attr(f),h="";if(g.match(/(\-[A-Za-z0-9]+)&?/))h=g.match(/(\-[A-Za-z0-9]+)&?/)[1];d=h;d==""?$(e).attr(f,$(e).attr(f)+"-section"+c.iterations+d):$(e).attr(f,$(e).attr(f).replace(d,"-section"+c.iterations+d))}var c=this,d="";$(a).attr("id",$(a).attr("id")+"-section"+this.iterations);$(a).find("*").each(function(e,f){$(f).attr("id")&&b(f,"id");$(f).attr("for")&&b(f,"for");$(f).attr("name")&&b(f,"name")});return a},createSectionInstanceObject:function(a,b){var c=$.extend(true,{},b);c.isInstance=
true;var d=this,e=new JFormSection(this.parentJFormPage,this.id+"-section"+this.iterations,c);$.each(this.jFormComponents,function(f,g){var h=$.extend(true,{},g.options);h.isInstance=false;h=new window[g.type](e,g.id+"-section"+d.iterations,g.type,h);e.addComponent(h)});return e},relabelSectionInstances:function(a,b){$.each(a,function(c,d){if(c!==0){var e=c+1,f=d.section.find(".jFormSectionTitle").children(":first");if(f.length>0)f.text().match(/(\([0-9]+\))$/)?f.text(f.text().replace(/(\([0-9]+\))$/,
"("+e+")")):f.text(f.text()+" ("+e+")")}});this.parentJFormPage.jFormer.adjustHeight(b)},addComponent:function(a){this.jFormComponents[a.id]=a;return this},clearValidation:function(){$.each(this.jFormComponents,function(a,b){b.clearValidation()})},getData:function(){var a=this;if(this.disabledByDependency)this.formData=null;else if(this.instanceArray.length>1){this.formData=[];$.each(this.instanceArray,function(b,c){var d={};$.each(c.jFormComponents,function(e,f){if(f.type!="JFormComponentLikertStatement"){e=
e.replace(/-section[0-9]+/,"");d[e]=f.getData()}});a.formData.push(d)})}else{this.formData={};$.each(this.jFormComponents,function(b,c){if(c.type!="JFormComponentLikertStatement")a.formData[b]=c.getData()})}return this.formData},setData:function(a){var b=this;$.isArray(a)?$.each(a,function(c,d){c!==0&&b.instanceArray[c]==undefined&&b.addSectionInstance();$.each(d,function(e,f){if(c!==0)e=e+"-section"+(c+1);b.instanceArray[c].jFormComponents[e]!=undefined&&b.instanceArray[c].jFormComponents[e].setData(f)})}):
$.each(a,function(c,d){b.jFormComponents[c]!=undefined&&b.jFormComponents[c].setData(d)})},disableByDependency:function(a){var b=this,c=b.parentJFormPage.jFormer.initializing?{adjustHeightDuration:0,appearDuration:0,appearEffect:"none",hideDuration:0,hideEffect:"none"}:this.options.dependencyOptions.animationOptions!==undefined?$.extend(c,this.parentJFormPage.jFormer.options.animationOptions.dependency,this.options.dependencyOptions.animationOptions):this.parentJFormPage.jFormer.options.animationOptions.dependency,
d=this.section;$.each(this.instanceArray,function(f,g){if(f!==0)d=d.add(g.section)});if(this.options.instanceOptions!==null&&(this.instanceArray.length<this.options.instanceOptions.max||this.options.instanceOptions.max===0)){var e=$(this.parentJFormSection.section.find("#"+this.id+"-addInstance"));if(b.parentJFormPage.jFormer.initializing)if(!a&&e.is(":hidden")){e.show();b.parentJFormPage.jFormer.adjustHeight({adjustHeightDuration:0})}d=d.add(e)}if(this.disabledByDependency!==a){if(a)if(this.options.dependencyOptions.display==
"hide")if(c.hideEffect=="none"||c.hideDuration===0){d.hide();b.parentJFormPage.jFormer.adjustHeight(c)}else if(c.appearEffect==="fade")d.fadeOut(c.hideDuration,function(){b.parentJFormPage.jFormer.adjustHeight(c)});else c.appearEffect==="slide"&&d.slideUp(c.hideDuration,function(){b.parentJFormPage.jFormer.adjustHeight(c)});else{d.addClass("jFormSectionDependencyDisabled").find(":not(.jFormComponentDisabled) > :input").attr("disabled","disabled");this.parentJFormPage.jFormer.adjustHeight({adjustHeightDuration:0})}else{if(this.options.dependencyOptions.display==
"hide")if(c.appearEffect=="none"||c.appearDuration===0){d.show();b.parentJFormPage.jFormer.adjustHeight(c)}else if(c.hideEffect==="fade"){d.fadeIn(c.appearDuration);b.parentJFormPage.jFormer.adjustHeight(c)}else{if(c.hideEffect==="slide"){d.slideDown(c.appearDuration);b.parentJFormPage.jFormer.adjustHeight(c)}}else{d.removeClass("jFormSectionDependencyDisabled").find(":not(.jFormComponentDisabled) > :input").removeAttr("disabled");this.parentJFormPage.jFormer.adjustHeight({adjustHeightDuration:0})}this.checkChildrenDependencies()}this.disabledByDependency=
a}},checkDependencies:function(){this.options.dependencyOptions!==null&&this.disableByDependency(!eval(this.options.dependencyOptions.jsFunction))},checkChildrenDependencies:function(){$.each(this.jFormComponents,function(a,b){b.checkDependencies()})}});
JFormComponent=Class.extend({init:function(a,b,c,d){this.options=$.extend({validationOptions:[],showErrorTipOnce:false,triggerFunction:null,componentChangedOptions:null,dependencyOptions:null,instanceOptions:null,tipTargetPosition:"rightMiddle",tipCornerPosition:"leftTop",isInstance:false},d||{});this.parentJFormSection=a;this.id=b;this.component=$("#"+b+"-wrapper");this.formData=null;this.type=c;this.errorMessageArray=[];this.tip=null;this.tipDiv=this.component.find("#"+this.id+"-tip");this.tipTarget=
null;this.validationPassed=true;this.requiredCompleted=this.isRequired=this.disabledByDependency=false;this.validationFunctions={required:function(e){var f=["Required."];return e.value!=""?"success":f}};if(this.options.isInstance)this.clone=this.instanceArray=null;else{if(this.options.instanceOptions!=null){this.clone=this.component.clone();this.iterations=1}else this.clone=null;this.instanceArray=[this];this.createInstanceButton()}this.initialize();this.reformValidations();this.addHighlightListeners();
this.defineComponentChangedEventListener();this.catchComponentChangedEventListener();$.trim(this.tipDiv.html())!==""&&this.addTip();this.addTipListeners()},addHighlightListeners:function(){var a=this;this.component.find(":input:not(button):not(hidden)").each(function(b,c){$(c).bind("focus",function(){a.highlight()});$(c).bind("blur",function(){a.removeHighlight();if((a.type=="JFormComponentName"||a.type=="JFormComponentAddress"||a.type=="JFormComponentCreditCard")&&a.changed===true)a.validate()})});
if(this.component.find("input:checkbox, input:radio").length>0){this.component.mouseenter(function(){a.highlight()});this.component.mouseleave(function(){a.removeHighlight()})}return this},reformValidations:function(){var a={},b=this;$.each(this.options.validationOptions,function(c,d){if(d=="required")b.isRequired=true;if(c>=0)a[d]={component:b.component};else if(typeof d!="object"){a[c]={component:b.component};a[c][c]=d}else if(typeof d=="object"){if(d[0]!=undefined){a[c]={};a[c][c]=d}else a[c]=
d;a[c].component=b.component}});this.options.validationOptions=a},defineComponentChangedEventListener:function(){var a=this;this.component.find("input:checkbox, input:radio").each(function(b,c){$(c).bind("click",function(){$(this).trigger("jFormComponent:changed",a)})});this.component.find(":input:not(button, :checkbox, :radio)").each(function(b,c){$(c).bind("change",function(){$(this).trigger("jFormComponent:changed",a)})})},catchComponentChangedEventListener:function(){var a=this;this.component.bind("jFormComponent:changed",
function(){a.options.triggerFunction!==null&&eval(a.options.triggerFunction);if(a.type=="JFormComponentName"||a.type=="JFormComponentAddress"||a.type=="JFormComponentLikert"||a.type=="JFormComponentCreditCard")a.changed=true;a.parentJFormSection.parentJFormPage.jFormer.options.clientSideValidation&&a.validate();a.parentJFormSection.parentJFormPage.jFormer.options.progressBar!==false&&a.parentJFormSection.parentJFormPage.jFormer.updateProgressBar()})},highlight:function(){this.component.addClass("jFormComponentHighlight").trigger("jFormComponent:highlighted",
this.component);this.component.trigger("jFormComponent:showTip",this.component)},removeHighlight:function(){var a=this;this.component.removeClass("jFormComponentHighlight").trigger("jFormComponent:highlightRemoved",this.component);setTimeout(function(){a.component.hasClass("jFormComponentHighlight")||a.component.trigger("jFormComponent:hideTip",a.component)},1)},getData:function(){var a=this;if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)this.formData=null;else if(this.instanceArray.length>
1){this.formData=[];$.each(this.instanceArray,function(b,c){var d=c.getValue();a.formData.push(d)})}else this.formData=this.getValue();return this.formData},setData:function(a){var b=this;$.isArray(a)?$.each(a,function(c,d){if(b.type=="JFormComponentMultipleChoice"&&($.isArray(d)||b.multipeChoiceType=="radio")||b.type!="JFormComponentMultipleChoice"){c!==0&&b.instanceArray[c]==undefined&&b.addInstance();b.instanceArray[c].setValue(d)}else{b.setValue(a);return false}}):this.setValue(a)},createInstanceButton:function(){var a=
this;if(this.options.instanceOptions!=null){var b=$('<button id="'+this.id+'-addInstance" class="jFormComponentAddInstanceButton">'+this.options.instanceOptions.addButtonText+"</button>");this.options.dependencyOptions!==null&&b.hide();this.component.after(b);this.parentJFormSection.section.find("#"+this.id+"-addInstance").bind("click",function(c){c.preventDefault();a.disabledByDependency||a.addInstance()})}},addInstance:function(){this.options.componentChangedOptions!=null&&this.options.componentChangedOptions.instance!=
undefined&&this.options.componentChangedOptions.instance==true&&this.component.trigger("jFormComponent:changed",this);var a=this;if(this.instanceArray.length<this.options.instanceOptions.max||this.options.instanceOptions.max===0){var b=this.clone.clone(),c=this.parentJFormSection.section.find("#"+this.id+"-addInstance"),d={};d=this.options.instanceOptions.animationOptions!==undefined?$.extend(d,this.parentJFormSection.parentJFormPage.jFormer.options.animationOptions.instance,this.options.instanceOptions.animationOptions):
this.parentJFormSection.parentJFormPage.jFormer.options.animationOptions.instance;$(b).append('<button id="'+this.id+'-removeInstance" class="jFormComponentRemoveInstanceButton">'+this.options.instanceOptions.removeButtonText+"</button>");b.find("#"+this.id+"-removeInstance").bind("click",function(f){var g=$(f.target);f.preventDefault();a.instanceArray=$.map(a.instanceArray,function(h){if(h.component.attr("id")==g.parent().attr("id")){h.tip!=null&&h.tip.hide();h=null}return h});if(d.removeEffect==
"none"||d.removeDuration===0){g.parent().remove();g.remove()}else d.removeEffect=="slide"?g.parent().slideUp(d.removeDuration,function(){g.parent().remove();g.remove();a.parentJFormSection.parentJFormPage.jFormer.adjustHeight(d)}):g.parent().fadeOut(d.removeDuration,function(){g.parent().remove();g.remove();a.parentJFormSection.parentJFormPage.jFormer.adjustHeight(d)});if(a.instanceArray.length<a.options.instanceOptions.max||a.options.instanceOptions.max===0)c.show();a.relabelInstances(a.instanceArray,
d)});b.hide();c.before(b);if(d.appearEffect=="none"||d.appearDuration===0){if(!a.disabledByDependency||a.disabledByDependency&&a.options.dependencyOptions.display!="hide")b.show()}else a.disabledByDependency||(d.appearEffect=="slide"?b.slideDown(d.appearDuration,function(){a.parentJFormSection.parentJFormPage.jFormer.jFormPageWrapper.dequeue();a.parentJFormSection.parentJFormPage.jFormer.adjustHeight(d)}):b.fadeIn(d.appearDuration,function(){a.parentJFormSection.parentJFormPage.jFormer.jFormPageWrapper.dequeue();
a.parentJFormSection.parentJFormPage.jFormer.adjustHeight(d)}));this.nameInstance(b);b=this.createInstanceObject(b,this.options);this.instanceArray.push(b);this.relabelInstances(this.instanceArray,d);this.instanceArray.length==this.options.instanceOptions.max&&this.options.instanceOptions.max!==0&&c.hide();if(this.options.dependencies!=undefined){var e=a.parentJFormSection.parentJFormPage.jFormer;b.component.find(":text, textarea").bind("keyup",function(){$.each(a.options.dependencies.pages,function(f,
g){e.jFormPages[g.jFormPageId].checkDependencies()});$.each(a.options.dependencies.sections,function(f,g){e.jFormPages[g.jFormPageId].jFormSections[g.jFormSectionId].checkDependencies()});$.each(a.options.dependencies.components,function(f,g){e.jFormPages[g.jFormPageId].jFormSections[g.jFormSectionId].jFormComponents[g.jFormComponentId].checkDependencies()})});b.component.bind("jFormComponent:changed",function(){$.each(a.options.dependencies.pages,function(f,g){e.jFormPages[g.jFormPageId].checkDependencies()});
$.each(a.options.dependencies.sections,function(f,g){e.jFormPages[g.jFormPageId].jFormSections[g.jFormSectionId].checkDependencies()});$.each(a.options.dependencies.components,function(f,g){e.jFormPages[g.jFormPageId].jFormSections[g.jFormSectionId].jFormComponents[g.jFormComponentId].checkDependencies()})})}this.disabledByDependency&&this.disableByDependency(true)}return this},nameInstance:function(a){function b(e,f){var g=$(e).attr(f),h="";if(g.match(/\-(div|label|tip|removeInstance)\b/))h=g.match(/\-(div|label|tip|removeInstance)\b/)[0];
d=h;d==""?$(e).attr(f,$(e).attr(f)+"-instance"+c.iterations+d):$(e).attr(f,$(e).attr(f).replace(d,"-instance"+c.iterations+d))}a=$(a);var c=this,d="";this.iterations++;a.attr("id",a.attr("id").replace("-wrapper","-instance"+this.iterations+"-wrapper"));a.find("*").each(function(e,f){$(f).attr("id")&&b(f,"id");$(f).attr("for")&&b(f,"for");$(f).attr("name")&&b(f,"name")});return a},createInstanceObject:function(a,b){var c=$.extend(true,{},b);c.isInstance=true;if(this.options.componentChangedOptions!=
null&&this.options.componentChangedOptions.children!=undefined&&this.options.componentChangedOptions.children==false)c.componentChangedOptions=null;return new window[this.type](this.parentJFormSection,this.id+"-instance"+this.iterations,this.type,c)},relabelInstances:function(a,b){$.each(a,function(c,d){if(c!==0){var e=c+1,f=d.component.find("#"+d.component.attr("id").replace("-wrapper","-label"));if(f.length>0){var g=f.find("span.jFormComponentLabelRequiredStar");g.length>0&&g.remove();if(f.html().match(/:$/))f.html(f.html().replace(/(\([0-9]+\))?:/,
" ("+e+"):"));else f.text().match(/(\([0-9]+\))$/)?f.text(f.text().replace(/(\([0-9]+\))$/,"("+e+")")):f.text(f.text()+" ("+e+")")}else{f=d.component.find("label");g=f.find("span.jFormComponentLabelRequiredStar");g.length>0&&g.remove();f.text().match(/(\([0-9]+\))$/)?f.text(f.text().replace(/(\([0-9]+\))$/,"("+e+")")):f.text(f.text()+" ("+e+")")}f.append(g)}});this.parentJFormSection.parentJFormPage.jFormer.adjustHeight(b)},addTip:function(){var a=this;if(typeof this.tip!=="function")this.tip=this.tipTarget.simpletip({persistent:true,
focus:true,position:"topRight",content:a.tipDiv,baseClass:"jFormerTip",hideEffect:"none",onBeforeShow:function(){if(a.tipDiv.find(".tipContent").text()=="")return false},onShow:function(){var b=$(window).height(),c=this.getTooltip().offset().top+this.getTooltip().outerHeight()+12;$(window).scrollTop()+b<c&&$.scrollTo(c-b+"px",250,{axis:"y"})}}).simpletip()},addTipListeners:function(){var a=this;this.component.bind("jFormComponent:showTip",function(){a.tip&&typeof a.tip=="object"&&$.trim(a.tipDiv.html())!==
""&&a.tip.show()});this.component.bind("jFormComponent:hideTip",function(){a.tip&&typeof a.tip=="object"&&a.tip.hide();a.options.showErrorTipOnce&&a.clearValidation()});return this},clearValidation:function(){this.errorMessageArray=[];this.validationPassed=true;this.component.removeClass("jFormComponentValidationFailed");this.component.addClass("jFormComponentValidationPassed");this.component.find(".tipErrorUl").remove();if(this.tip&&typeof this.tip=="object"){this.tip.update(this.tipDiv.html());
$.trim(this.tipDiv.find(".tipContent").html())==""&&this.tipDiv.hide()}},initialize:function(){},getValue:function(){},setValue:function(){},clearData:function(){this.component.find(":input").val("")},validate:function(a){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;if(this.options.validationOptions.length<1)return true;if(a)var b=true;var c=this;this.clearValidation();var d=this.getValue();if(d===null)return true;$.each(this.options.validationOptions,function(e,
f){f.value=d;var g=c.validationFunctions[e](f);if(g=="success"){if(e.match("required"))c.requiredCompleted=true;return true}else{if(e.match("required")){c.requiredCompleted=false;if(c.parentJFormSection.parentJFormPage.jFormer.options.pageNavigator!=false){var h=$.inArray(c.parentJFormSection.parentJFormPage.id,c.parentJFormSection.parentJFormPage.jFormer.jFormPageIdArray);$("#navigatePage"+(h+1)).addClass("jFormPageNavigatorLinkWarning")}}if(a)b=false;else $.merge(c.errorMessageArray,g)}});if(a)return b;
else{if(this.errorMessageArray.length>0){this.handleErrors();this.validationPassed=false}return this.validationPassed}},handleServerValidationResponse:function(a){$.each(this.instanceArray,function(b,c){c.clearValidation()});if(a!=null&&a.length>0)if(this.instanceArray.length!=1)$.each(this.instanceArray,function(b,c){if(!jFormerUtility.empty(a[b])){$.each(a[b],function(d,e){e!=""&&c.errorMessageArray.push(e)});if(c.errorMessageArray.length>0){c.validationPassed=false;c.handleErrors()}}});else{this.errorMessageArray=
a;this.validationPassed=false;this.handleErrors()}},handleErrors:function(){this.component.removeClass("jFormComponentValidationPassed");this.component.addClass("jFormComponentValidationFailed");this.tipDiv.length==0&&this.createTipDiv();if(this.parentJFormSection.parentJFormPage.jFormer.options.validationTips){var a=$('<ul id="'+this.id+'-tipErrorUl" class="tipErrorUl"></ul>');$.each(this.errorMessageArray,function(b,c){a.append("<li>"+c+"</li>")});this.tipDiv.find(".tipContent").append(a);this.tip.update(this.tipDiv.html());
this.component.hasClass("jFormComponentHighlight")&&this.tip.show()}},createTipDiv:function(){this.tipDiv=$('<div id="'+this.id+'-tip" style="display: none;"></div>');this.component.append(this.tipDiv);this.addTip()},disableByDependency:function(a){var b=this,c={};this.options.componentChangedOptions!=null&&this.options.componentChangedOptions.dependency!=undefined&&this.options.componentChangedOptions.dependency==true&&this.component.trigger("jFormComponent:changed",this);var d=this.component;$.each(this.instanceArray,
function(f,g){if(f!==0)d=d.add(g.component)});if(this.options.instanceOptions!==null&&(this.instanceArray.length<this.options.instanceOptions.max||this.options.instanceOptions.max===0)){var e=$(this.parentJFormSection.section.find("#"+this.id+"-addInstance"));if(b.parentJFormSection.parentJFormPage.jFormer.initializing)if(!a&&e.is(":hidden")){e.show();b.parentJFormSection.parentJFormPage.jFormer.adjustHeight({adjustHeightDuration:0})}else if(this.options.dependencyOptions.display=="lock"){e.show();
b.parentJFormSection.parentJFormPage.jFormer.adjustHeight({adjustHeightDuration:0})}d=d.add(e)}c=b.parentJFormSection.parentJFormPage.jFormer.initializing?{adjustHeightDelay:0,appearDuration:0,appearEffect:"none",hideDuration:0,hideEffect:"none"}:this.options.dependencyOptions.animationOptions!==undefined?$.extend(c,this.parentJFormSection.parentJFormPage.jFormer.options.animationOptions.dependency,this.options.dependencyOptions.animationOptions):this.parentJFormSection.parentJFormPage.jFormer.options.animationOptions.dependency;
if(this.disabledByDependency!==a){if(a){this.clearValidation();if(this.options.dependencyOptions.display=="hide")if(c.hideEffect=="none"||c.hideDuration===0){d.hide(c.hideDuration);b.parentJFormSection.parentJFormPage.jFormer.adjustHeight(c)}else if(c.hideEffect==="fade")d.fadeOut(c.hideDuration,function(){b.parentJFormSection.parentJFormPage.jFormer.adjustHeight(c)});else c.hideEffect==="fade"&&d.slideUp(c.hideDuration,function(){b.parentJFormSection.parentJFormPage.jFormer.adjustHeight(c)});else d.addClass("jFormComponentDependencyDisabled").find(":input").attr("disabled",
"disabled")}else if(this.options.dependencyOptions.display=="hide")if(c.appearEffect=="none"||c.apearDuration===0){d.show();b.parentJFormSection.parentJFormPage.jFormer.adjustHeight(c)}else if(c.appearEffect==="fade"){d.fadeIn(c.appearDuration);b.parentJFormSection.parentJFormPage.jFormer.adjustHeight(c)}else{if(c.appearEffect==="slide"){d.slideDown(c.appearDuration);b.parentJFormSection.parentJFormPage.jFormer.adjustHeight(c)}}else d.removeClass("jFormComponentDependencyDisabled").find(":input").removeAttr("disabled");
this.disabledByDependency=a}},checkDependencies:function(){this.options.dependencyOptions!==null&&this.disableByDependency(!eval(this.options.dependencyOptions.jsFunction))}});
JFormComponentAddress=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d)},initialize:function(){this.tipTarget=this.component;this.options.emptyValue&&this.addEmptyValues();this.validationFunctions={required:function(a){var b=[];a.value.addressLine1==""&&b.push(["Street Address is required."]);a.value.city==""&&b.push(["City is required."]);a.value.state==""&&b.push(["State is required."]);a.value.zip==""&&b.push(["Zip is required."]);a.value.country==""&&b.push(["Country is required."]);
return b.length<1?"success":b}};this.changed=false},setValue:function(a){if(a===null||a==="")a={addressline1:"",city:"",state:"",zip:""};if(this.options.emptyValue){a.addressLine1!=this.options.emptyValue.addressLine1&&this.component.find(":input[id*=addressLine1]").removeClass("defaultValue").val(a.addressLine1).blur();a.addressLine2!=this.options.emptyValue.addressLine2&&this.component.find(":input[id*=addressLine2]").removeClass("defaultValue").val(a.addressLine2).blur();a.city!=this.options.emptyValue.city&&
this.component.find(":input[id*=city]").removeClass("defaultValue").val(a.city).blur();if(a.state!=this.options.emptyValue.state||this.options.emptyValue.state==undefined)this.component.find(":input[id*=state]").removeClass("defaultValue").val(a.state).blur();a.zip!=this.options.emptyValue.zip&&this.component.find(":input[id*=zip]").removeClass("defaultValue").val(a.zip).blur()}else{this.component.find(":input[id*=addressLine1]").val(a.addressLine1);this.component.find(":input[id*=addressLine2]").val(a.addressLine2);
this.component.find(":input[id*=city]").val(a.city);this.component.find(":input[id*=state]").val(a.state);this.component.find(":input[id*=zip]").val(a.zip)}this.component.find(":input[id*=country]").val(a.country);this.validate(true)},getValue:function(){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;var a={},b=this;a.addressLine1=b.component.find(":input[id*=addressLine1]").val();a.addressLine2=b.component.find(":input[id*=addressLine2]").val();a.city=b.component.find(":input[id*=city]").val();
a.state=b.component.find(":input[id*=state]").val();a.zip=b.component.find(":input[id*=zip]").val();a.country=b.component.find(":input[id*=country]").val();this.component.find(":input").each(function(c,d){a[$(d).attr("id").replace(b.id+"-","")]=$(d).val()});if(this.options.emptyValue){if(a.addressLine1==this.options.emptyValue.addressLine1)a.addressLine1="";if(a.addressLine2==this.options.emptyValue.addressLine2)a.addressLine2="";if(a.city==this.options.emptyValue.city)a.city="";if(a.state==this.options.emptyValue.state)a.state=
"";if(a.zip==this.options.emptyValue.zip)a.zip=""}return a},validate:function(){if(this.parentJFormSection.parentJFormPage.jFormer.options.clientSideValidation){var a=this;this.changed||this._super();setTimeout(function(){if(!a.component.hasClass("jFormComponentHighlight")){if(a.options.validationOptions.length<1)return true;a.clearValidation();$.each(a.options.validationOptions,function(b,c){c.value=a.getValue();var d=a.validationFunctions[b](c);if(d!="success"){$.merge(a.errorMessageArray,d);a.validationPassed=
false}});a.errorMessageArray.length>0&&a.handleErrors();a.changed=false;return a.validationPassed}},1)}},addEmptyValues:function(){var a=this;$.each(this.options.emptyValue,function(b,c){var d=a.component.find("input[id*="+b+"]");d.addClass("defaultValue");d.focus(function(e){if($.trim($(e.target).val())==c){$(e.target).val("");$(e.target).removeClass("defaultValue")}});d.blur(function(e){if($.trim($(e.target).val())==""){$(e.target).addClass("defaultValue");$(e.target).val(c)}});d.trigger("blur")})}});
JFormComponentCreditCard=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d)},initialize:function(){this.tipTarget=this.component;this.options.emptyValues&&this.addEmptyValues();this.validationFunctions={required:function(a){var b=[];a.value.cardType!=undefined&&a.value.cardType==""&&b.push(["Card type is required."]);a.value.cardNumber==""&&b.push(["Credit card number is required."]);a.value.cardNumber!=""&&a.value.cardNumber.match(/[^\d]/)&&b.push(["Card number may only contain numbers."]);
if(a.value.cardNumber!=""&&(a.value.cardNumber.length<13||a.value.cardNumber.length>16))b.push(["Card number must contain 13 to 16 digits."]);a.value.expirationMonth==""&&b.push(["Expiration month is required."]);a.value.expirationYear==""&&b.push(["Expiration year is required."]);a.value.securityCode!=undefined&&a.value.securityCode==""&&b.push(["Security code is required."]);a.value.securityCode!=undefined&&a.value.securityCode!=""&&a.value.securityCode.match(/[^\d]/)&&b.push(["Security code may only contain numbers."]);
a.value.securityCode!=undefined&&a.value.securityCode!=""&&a.value.securityCode.length<3&&b.push(["Security code must contain 3 or 4 digits."]);return b.length<1?"success":b}};this.changed=false},setValue:function(a){if(this.options.emptyValues){a.cardType!=undefined&&this.component.find(":input[id*=cardType]").removeClass("defaultValue").val(a.cardType).blur();a.cardNumber!=this.options.emptyValues.cardNumber&&this.component.find(":input[id*=cardNumber]").removeClass("defaultValue").val(a.cardNumber).blur();
this.component.find(":input[id*=expirationMonth]").removeClass("defaultValue").val(a.expirationMonth).blur();this.component.find(":input[id*=expirationYear]").removeClass("defaultValue").val(a.expirationYear).blur();a.securityCode!=undefined&&a.securityCode!=this.options.emptyValues.securityCode&&this.component.find(":input[id*=expirationMonth]").removeClass("defaultValue").val(a.expirationMonth).blur()}else{a.cardType!=undefined&&this.component.find(":input[id*=cardType]").val(a.cardType);this.component.find(":input[id*=cardNumber]").val(a.cardNumber);
this.component.find(":input[id*=expirationMonth]").val(a.expirationMonth);this.component.find(":input[id*=expirationYear]").val(a.expirationYear);a.securityCode!=undefined&&this.component.find(":input[id*=securityCode]").val(a.securityCode)}this.validate(true)},getValue:function(){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;var a={};if(this.component.find(":input[id*=cardType]").length!=0)a.cardType=this.component.find(":input[id*=cardType]").val();a.cardNumber=
this.component.find(":input[id*=cardNumber]").val();a.expirationMonth=this.component.find(":input[id*=expirationMonth]").val();a.expirationYear=this.component.find(":input[id*=expirationYear]").val();if(this.component.find(":input[id*=securityCode]").length!=0)a.securityCode=this.component.find(":input[id*=securityCode]").val();if(this.options.emptyValues){if(a.cardNumber==this.options.emptyValues.cardNumber)a.cardNumber="";if(a.securityCode!=undefined&&a.securityCode==this.options.emptyValues.securityCode)a.securityCode=
""}return a},validate:function(){if(this.parentJFormSection.parentJFormPage.jFormer.options.clientSideValidation){var a=this;this.changed||this._super();setTimeout(function(){if(!a.component.hasClass("jFormComponentHighlight")){if(a.options.validationOptions.length<1)return true;a.clearValidation();$.each(a.options.validationOptions,function(b,c){c.value=a.getValue();var d=a.validationFunctions[b](c);if(d!="success"){$.merge(a.errorMessageArray,d);a.validationPassed=false}});a.errorMessageArray.length>
0&&a.handleErrors();a.changed=false;return a.validationPassed}},1)}},addEmptyValues:function(){var a=this;$.each(this.options.emptyValues,function(b,c){var d=a.component.find("input[id*="+b+"]");d.addClass("defaultValue");d.focus(function(e){if($.trim($(e.target).val())==c){$(e.target).val("");$(e.target).removeClass("defaultValue")}});d.blur(function(e){if($.trim($(e.target).val())==""){$(e.target).addClass("defaultValue");$(e.target).val(c)}});d.trigger("blur")})}});
JFormComponentDate=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d)},initialize:function(){var a=this;this.monthArray=["January","February","March","April","May","June","July","August","September","October","November","December"];this.addCalendar();this.tipTarget=this.component.find(".jFormComponentDateSelector");if(this.tipTarget==undefined)this.tipTarget=this.component;this.options.validationOptions.length==0&&this.reformValidations();this.validationFunctions={required:function(b){var c=
[];if(b.value.month==""||b.value.day==""||b.value.year==""||b.value==null){c.push("Required.");return c}var d=parseInt(b.value.month),e=parseInt(b.value.day);b=b.value.year;var f=false;b.match(/[\d]{4}/)||c.push("You must enter a valid year.");if(d<1||d>12)c.push("You must enter a valid month.");if(d==4||d==6||d==9||d==11){if(e>30)f=true}else if(d==2){b=parseInt(b);if(e>(b%4==0&&(b%100!=0||b%400==0)?29:28))f=true}if(e>31||e<1)f=true;f&&c.push("You must enter a valid day.");return c.length<1?"success":
c},minDate:function(b){var c=[],d=a.getDateFromString(b.minDate);a.getDateFromObject(b.value)<d&&c.push("Date must be on or after "+a.monthArray[d.getMonth()]+" "+d.getDate()+", "+d.getFullYear()+".");return c.length<1?"success":c},maxDate:function(b){var c=[],d=a.getDateFromString(b.maxDate);a.getDateFromObject(b.value)>d&&c.push("Date must be on or before "+a.monthArray[d.getMonth()]+" "+d.getDate()+", "+d.getFullYear()+".");return c.length<1?"success":c},teenager:function(b){var c=new Date(b.value.year,
b.value.month,b.value.day),d=new Date;c=new Date(d.getFullYear()-13,d.getMonth(),d.getDate())-c;return b.value==""||c>=0?"success":"You must be at least 13 years old to use this site."}}},highlight:function(){var a=this;this.component.addClass("jFormComponentHighlight").trigger("jFormComponent:highlighted",this.component);setTimeout(function(){a.component.trigger("jFormComponent:showTip",a.component)},1)},addCalendar:function(){var a=this.component.find("input:text");a.date_input();a.bind("keyup",
function(b){b.keyCode==9||b.keyCode==27||b.keyCode==13||b.keyCode==33||b.keyCode==34||b.keyCode==38||b.keyCode==40||b.keyCode==37||b.keyCode==39||a.val().length==10&&a.trigger("change")})},getValue:function(){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;var a={month:"",day:"",year:""},b=$("#"+this.id).val();if(b!=""){b=b.split(b.match(/[^\d]/));if(b[0]!=undefined)a.month=b[0];if(b[1]!=undefined)a.day=b[1];if(b[2]!=undefined)a.year=b[2]}return a},getDateFromString:function(a){a=
a.split("-");return new Date(parseInt(a[0],10),parseInt(a[1],10)-1,parseInt(a[2],10))},getDateFromObject:function(a){return new Date(parseInt(a.year,10),parseInt(a.month,10)-1,parseInt(a.day,10))},setValue:function(a){function b(c){if(c==""||c=="undefined")return"";c=""+c;if(c.length==1)c="0"+c;return c}if(a==null||a.month=="undefined"||a.year=="undefined"||a.day=="undefined")$("#"+this.id).val("");else{$("#"+this.id).val(b(a.month)+"/"+b(a.day)+"/"+a.year);$("#"+this.id).val()=="//"&&$("#"+this.id).val("");
this.validate(true)}}});JFormComponentDropDown=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d)},initialize:function(){this.tipTarget=this.component.find("select:last")},getValue:function(){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;return $("#"+this.id).val()},setValue:function(a){$("#"+this.id).val(a).trigger("jFormComponent:changed");this.validate(true)}});
JFormComponentFile=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d)},initialize:function(){var a=this.component.find("button").parent();if(a.length<1)a=this.component.find("input:file");this.tipTarget=a;this.options.customStyle&&this.setOnChange();this.validationFunctions={required:function(b){var c=["Required."];return b.value!=""?"success":c},extension:function(b){var c=["Must have the ."+b.extension+" extension."],d=RegExp("\\."+b.extension+"$","i");return b.value==""||b.value.match(d)?
"success":c},extensionType:function(b){var c,d=["Incorrect file type."];if($.isArray(b.extensionType))c=RegExp("\\.("+b.extensionType.join("|")+")$","i");else{c={};c.image=/\.(bmp|gif|jpe?g|png|psd|psp|thm|tif)/i;c.document=/\.(doc|docx|log|msg|pages|rtf|txt|wpd|wps)/i;c.audio=/\.(aac|aif|iff|m3u|mid|midi|mp3|mpa|ra|wav|wma)/i;c.video=/\.(3g2|3gp|asf|asx|avi|flv|mov|mp4|mpg|rm|swf|vob|wmv)/i;c.web=/\.(asp|css|htm|html|js|jsp|php|rss|xhtml)/i;c=RegExp(c[b.extensionType]);d=["Must be an "+b.extensionType+
" file type."]}return b.value==""||b.value.match(c)?"success":d},size:function(){return true},imageDimensions:function(){return true},minImageDimensions:function(){return true}}},setOnChange:function(){var a=this;this.component.find("input:file").change(function(b){b=b.target.value.replace(/.+\\/,"");a.component.find("input:text").val(b)})},setValue:function(){return false},getValue:function(){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;return this.component.find("input:file").val()},
validate:function(){this._super()}});JFormComponentHidden=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d)},getValue:function(){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;return $("#"+this.id).val()},validate:function(){this._super()}});
JFormComponentLikert=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d)},initialize:function(){var a=this;this.changed=false;this.tipTarget=this.component;this.statementComponentArray={};$.each(this.options.statementArray,function(b,c){if(!jFormerUtility.empty(a.options.validationOptions))c.validationOptions=a.options.validationOptions;var d=new JFormComponentLikertStatement(a.parentJFormSection,b,"JFormComponentLikertStatement",c);d.id=a.id+"-"+d.id;a.parentJFormSection.addComponent(d);
a.statementComponentArray[b]=d})},clearValidation:function(){$.each(this.statementComponentArray,function(a,b){b.clearValidation()})},setValue:function(){},catchComponentChangedEventListener:function(){return null},addHighlightListeners:function(){return null},defineComponentChangedEventListener:function(){return null},addTipListeners:function(){return null},getValue:function(){var a={};$.each(this.statementComponentArray,function(b,c){a[b]=c.getValue()});return a},handleErrors:function(){return true},
handleServerValidationResponse:function(a){var b=this;a.length>0&&$.each(this.instanceArray,function(c,d){$.each(a,function(e,f){$.each(f,function(g,h){var j=b.parentJFormSection.jFormComponents[d.id+"-"+g];if(j!=undefined){j.errorMessageArray=[h];j.validationPassed=false;j.handleErrors()}})})})},validate:function(){return true}});
JFormComponentLikertStatement=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d)},initialize:function(){this.changed=false;this.tipTarget=this.component=$("input[name="+this.id+"]:first").closest("tr");this.tipDiv=this.component.find("div.jFormComponentLikertStatementTip");this.validationFunctions={required:function(a){var b=["Required."];return a.value.length>0?"success":b}}},setValue:function(a){this.component.find("input").val([a]);this.validate(true)},validate:function(){this._super()},
getValue:function(){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;var a=this.component.find("input:checked");return a=a.length>0?a.val():""}});
JFormComponentMultipleChoice=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d)},initialize:function(){this.tipTarget=this.component;this.addChoiceTips();this.validationFunctions={required:function(a){var b=["Required."];return a.value.length>0?"success":b},minOptions:function(a){var b=["You must select more than "+a.minOptions+" options"];return a.value.length==0||a.value.length>a.minOptions?"success":b},maxOptions:function(a){var b=["You may select up to "+a.maxOptions+" options. You have selected "+
a.value.length+"."];return a.value.length==0||a.value.length<=a.maxOptions?"success":b}}},addChoiceTips:function(){var a=this.component.find("div.jFormComponentMultipleChoiceTip");a.length>0&&a.each(function(b,c){var d=$(c).prev("label").find(".jFormComponentMultipleChoiceTipIcon");if(d.length==0)d=$(c).parent();d.simpletip({position:"topRight",content:$(c),baseClass:"jFormerTip jFormComponentMultipleChoiceTip",hideEffect:"none"})})},getValue:function(){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;
var a;if(this.options.multipleChoiceType=="checkbox"){a=[];this.component.find("input:checked").each(function(b,c){a.push($(c).val())})}else a=this.component.find("input:checked").length>0?this.component.find("input:checked").val():"";return a},setValue:function(a){var b=this;if(this.options.multipleChoiceType=="checkbox")$.each(a,function(c,d){b.component.find("input[value='"+d+"']").attr("checked","checked").trigger("jFormComponent:changed")});else{this.component.find("input[value='"+a+"']").attr("checked",
"checked").trigger("jFormComponent:changed");a==null&&this.component.find("input").attr("checked",false).trigger("jFormComponent:changed")}this.validate(true)}});
JFormComponentName=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d)},initialize:function(){this.tipTarget=this.component.find("input:last");this.options.emptyValue&&this.addEmptyValues();this.changed=false;this.validationFunctions={required:function(a){var b=[];a.value.firstName==""&&b.push(["First name is required."]);a.value.lastName==""&&b.push(["Last name is required."]);return b.length<1?"success":b}}},setValue:function(a){if(this.options.emptyValue){a.firstName!=this.options.emptyValue.firstName&&
this.component.find("input[id*=firstName]").removeClass("defaultValue").val(a.firstName).blur();this.component.find("input[id*=middleInitial]").removeClass("defaultValue").val(a.middleInitial).blur();a.lastName!=this.options.emptyValue.lastName&&this.component.find("input[id*=lastName]").removeClass("defaultValue").val(a.lastName).blur()}else{this.component.find("input[id*=firstName]").val(a.firstName);this.component.find("input[id*=middleInitial]").val(a.middleInitial);this.component.find("input[id*=lastName]").val(a.lastName)}this.validate(true)},
getValue:function(){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;var a={};a.firstName=this.component.find("input[id*=firstName]").val();a.middleInitial=this.component.find("input[id*=middleInitial]").val();a.lastName=this.component.find("input[id*=lastName]").val();if(this.options.emptyValue){if(a.firstName==this.options.emptyValue.firstName)a.firstName="";if(this.component.find("input[id$=middleInitial]").hasClass("defaultValue"))a.middleInitial="";if(a.lastName==
this.options.emptyValue.lastName)a.lastName=""}return a},validate:function(){if(this.parentJFormSection.parentJFormPage.jFormer.options.clientSideValidation){var a=this;this.changed||this._super();setTimeout(function(){if(!a.component.hasClass("jFormComponentHighlight")){if(a.options.validationOptions.length<1)return true;a.clearValidation();$.each(a.options.validationOptions,function(b,c){c.value=a.getValue();var d=a.validationFunctions[b](c);if(d!="success"){$.merge(a.errorMessageArray,d);a.validationPassed=
false}});a.errorMessageArray.length>0&&a.handleErrors();a.changed=false;return a.validationPassed}},1)}},addEmptyValues:function(){var a=this;$.each(this.options.emptyValue,function(b,c){var d=a.component.find("input[id*="+b+"]");d.addClass("defaultValue");d.focus(function(e){if($.trim($(e.target).val())==c){$(e.target).val("");$(e.target).removeClass("defaultValue")}});d.blur(function(e){if($.trim($(e.target).val())==""){$(e.target).addClass("defaultValue");$(e.target).val(c)}});d.trigger("blur")})}});
JFormComponentSingleLineText=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d)},initialize:function(){this.tipTarget=this.component.find("input:last");this.enterSubmits=false;this.options.mask&&this.addMask();this.options.emptyValue&&this.addEmptyValue();this.component.find("input:password").length==1&&this.options.showStrength&&this.addPasswordStrength();this.validationFunctions={alpha:function(a){var b=["Must only contain letters."];return a.value==""||a.value.match(/^[A-Za-z]+$/i)?
"success":b},alphaDecimal:function(a){var b=["Must only contain letters, numbers, or periods."];return a.value==""||a.value.match(/^[A-Za-z0-9\.]+$/i)?"success":b},alphaNumeric:function(a){var b=["Must only contain letters or numbers."];return a.value==""||a.value.match(/^[A-Za-z0-9]+$/i)?"success":b},blank:function(a){var b=["Must be blank."];return $.trim(a.value).length==0?"success":b},canadianPostal:function(a){var b=["Must be a valid Canadian postal code."];return a.value==""||a.value.match(/^[ABCEGHJKLMNPRSTVXY][0-9][A-Z] [0-9][A-Z][0-9]$/)?
"success":b},date:function(a){var b=["Must be a date in the mm/dd/yyyy format."];return a.value==""||a.value.match(/^(0?[1-9]|1[012])[\- \/.](0?[1-9]|[12][0-9]|3[01])[\- \/.](19|20)[0-9]{2}$/)?"success":b},dateTime:function(a){var b=["Must be a date in the mm/dd/yyyy hh:mm:ss tt format. ss and tt are optional."];return a.value==""||a.value.match(/^(0?[1-9]|1[012])[\- \/.](0?[1-9]|[12][0-9]|3[01])[\- \/.](19|20)?[0-9]{2} [0-2]?\d:[0-5]\d(:[0-5]\d)?( ?(a|p)m)?$/i)?"success":b},decimal:function(a){var b=
["Must be a number without any commas. Decimal is optional."];return a.value==""||a.value.match(/^-?((\d+(\.\d+)?)|(\.\d+))$/)?"success":b},decimalNegative:function(a){var b=["Must be a negative number without any commas. Decimal is optional."],c=this.decimal(a);return a.value==""||c=="success"&&parseFloat(a.value)<0?"success":b},decimalPositive:function(a){var b=["Must be a positive number without any commas. Decimal is optional."],c=this.decimal(a);return a.value==""||c=="success"&&parseFloat(a.value)>
0?"success":b},decimalZeroNegative:function(a){var b=["Must be zero or a negative number without any commas. Decimal is optional."],c=self.validations.decimal({value:a.value});return a.value==""||c=="success"&&parseFloat(a.value)<=0?"success":b},decimalZeroPositive:function(a){var b=["Must be zero or a positive number without any commas. Decimal is optional."],c=this.decimal(a);return a.value==""||c=="success"&&parseFloat(a.value)>=0?"success":b},email:function(a){var b=["Must be a valid e-mail address."];
return a.value==""||a.value.match(/^[A-Z0-9._%-\+]+@(?:[A-Z0-9\-]+\.)+[A-Z]{2,4}$/i)?"success":b},integer:function(a){var b=["Must be a whole number."];return a.value==""||a.value.match(/^-?\d+$/)?"success":b},integerNegative:function(a){var b=["Must be a negative whole number."],c=this.integer(a);return a.value==""||c=="success"&&parseInt(a.value,10)<0?"success":b},integerPositive:function(a){var b=["Must be a positive whole number."],c=this.integer(a);return a.value==""||c=="success"&&parseInt(a.value,
10)>0?"success":b},integerZeroNegative:function(a){var b=["Must be zero or a negative whole number."],c=this.integer(a);return a.value==""||c=="success"&&parseInt(a.value,10)<=0?"success":b},integerZeroPositive:function(a){var b=["Must be zero or a positive whole number."],c=this.integer(a);return a.value==""||c=="success"&&parseInt(a.value,10)>=0?"success":b},isbn:function(a){var b=["Must be a valid ISBN and consist of either ten or thirteen characters."];if(a.value.match(/^(?=.{13}$)\d{1,5}([\- ])\d{1,7}\1\d{1,6}\1(\d|X)$/))b=
"sucess";if(a.value.match(/^\d{9}(\d|X)$/))b="sucess";if(a.value.match(/^(?=.{17}$)\d{3}([\- ])\d{1,5}\1\d{1,7}\1\d{1,6}\1(\d|X)$/))b="sucess";if(a.value.match(/^\d{3}[\- ]\d{9}(\d|X)$/))b="sucess";if(a.value.match(/^\d{12}(\d|X)$/))b="sucess";return b},length:function(a){var b=["Must be exactly "+a.length+" characters long. Current value is "+a.value.length+" characters."];return a.value==""||a.value.length==a.length?"success":b},matches:function(a){var b=["Does not match."],c=a.matches;if(a.sectionInstances){var d=
a.component.attr("id").match(/-section[\d]+/);if(d)c=a.matches+d}return a.value==$("#"+c).val()?"success":b},maxLength:function(a){var b=["Must be less than "+a.maxLength+" characters long. Current value is "+a.value.length+" characters."];return a.value==""||a.value.length<=a.maxLength?"success":b},maxFloat:function(a){var b="Must be numeric and cannot have more than "+a.maxFloat+" decimal place(s).",c=RegExp("^-?((\\d+(\\.\\d{0,"+a.maxFloat+"})?)|(\\.\\d{0,"+a+"}))$");return a.value==""||a.value.match(c)?
"success":b},maxValue:function(a){var b=["Must be numeric with a maximum value of "+a.maxValue+"."];return a.value<=a.maxValue?"success":b},minLength:function(a){var b=["Must be at least "+a.minLength+" characters long. Current value is "+a.value.length+" characters."];return a.value==""||a.value.length>=a.minLength?"success":b},minValue:function(a){var b=["Must be numeric with a minimum value of "+a.minValue+"."];return a.value>=a.minValue?"success":b},money:function(a){var b=["Must be a valid dollar value."];
return a.value==""||a.value.match(/^\$?[1-9][0-9]{0,2}(,?[0-9]{3})*(\.[0-9]{2})?$/)?"success":b},moneyNegative:function(a){var b=["Must be a valid negative dollar value."];return a.value==""||a.value.match(/^((-?\$)|(\$-?)|(-))?((\d+(\.\d{2})?)|(\.\d{2}))$/)&&RegExp.$5<0?"success":b},moneyPositive:function(a){var b=["Must be a valid positive dollar value."];return a.value==""||a.value.match(/^((-?\$)|(\$-?)|(-))?((\d+(\.\d{2})?)|(\.\d{2}))$/)&&RegExp.$5>0?"success":b},moneyZeroNegative:function(a){var b=
["Must be zero or a valid negative dollar value."];return a.value==""||a.value.match(/^((-?\$)|(\$-?)|(-))?((\d+(\.\d{2})?)|(\.\d{2}))$/)&&RegExp.$5<=0?"success":b},moneyZeroPositive:function(a){var b=["Must be zero or a valid positive dollar value."];return a.value==""||a.value.match(/^((-?\$)|(\$-?)|(-))?((\d+(\.\d{2})?)|(\.\d{2}))$/)&&RegExp.$5>=0?"success":b},password:function(a){var b=["Must be between 4 and 32 characters."];return a.value==""||a.value.match(/^.{4,32}$/)?"success":b},phone:function(a){var b=
["Must be a 10 digit phone number."];return a.value==""||a.value.match(/^(1[\-. ]?)?\(?[0-9]{3}\)?[\-. ]?[0-9]{3}[\-. ]?[0-9]{4}$/)?"success":b},postalZip:function(a){var b=["Must be a valid United States zip code, Canadian postal code, or United Kingdom postal code."];return a.value==""||this.zip(a)=="success"||this.canadianPostal(a)=="success"||this.ukPostal()=="success"?"success":b},required:function(a){var b=["Required."];return a.value!=""?"success":b},serverSide:function(a){if(a.value=="")return"success";
var b=[];a.component.addClass("jFormComponentServerSideCheck");$.ajax({url:a.url,type:"post",data:{task:a.task,value:a.value},dataType:"json",cache:false,async:false,success:function(c){if(c.status!="success")b=c.response;a.component.removeClass("jFormComponentServerSideCheck")},error:function(c,d,e){if(d!="error")e=d?d:"Unknown error";b=["There was an error during server side validation: "+e];a.component.removeClass("jFormComponentServerSideCheck")}});return b.length<1?"success":b},ssn:function(a){var b=
["Must be a valid United States social security number."];return a.value==""||a.value.match(/^\d{3}-?\d{2}-?\d{4}$/i)?"success":b},teenager:function(a){var b=new Date(a.value),c=new Date;b=new Date(c.getFullYear()-13,c.getMonth(),c.getDate())-b;return a.value==""||b>=0?"success":"Must be at least 13 years old."},time:function(a){var b=["Must be a time in the hh:mm:ss tt format. ss and tt are optional."];return a.value==""||a.value.match(/^[0-2]?\d:[0-5]\d(:[0-5]\d)?( ?(a|p)m)?$/i)?"success":b},ukPostal:function(a){var b=
["Must be a valid United Kingdom postal code."];return a.value==""||a.value.match(/^[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}$/)?"success":b},url:function(a){var b=["Must be a valid Internet address."];return a.value==""||a.value.match(/^((ht|f)tp(s)?:\/\/|www\.)?([\-A-Z0-9.]+)(\.[a-zA-Z]{2,4})(\/[\-A-Z0-9+&@#\/%=~_|!:,.;]*)?(\?[\-A-Z0-9+&@#\/%=~_|!:,.;]*)?$/i)?"success":b},username:function(a){var b=["Must use 4 to 32 characters and start with a letter."];return a.value==""||a.value.match(/^[A-Za-z](?=[A-Za-z0-9_.]{3,31}$)[a-zA-Z0-9_]*\.?[a-zA-Z0-9_]*$/)?
"success":b},zip:function(a){var b=["Must be a valid United States zip code."];return a.value==""||a.value.match(/^[0-9]{5}(?:-[0-9]{4})?$/)?"success":b}}},addMask:function(){this.component.find("input").mask("?"+this.options.mask,{placeholder:" "})},addPasswordStrength:function(){var a=this,b=this.component,c="<p id='"+this.id+"-strength' > Strength: <b> "+this.getPasswordStrength().strength+" </b> </p>";b.find("div.jFormComponentTip").append(c);b.find("input:password").bind("keyup",function(){b.find("#"+
a.id+"-strength b").text(a.getPasswordStrength().strength);a.tip.update(b.find("div.jFormComponentTip").html())})},getPasswordStrength:function(){var a=this.getValue(),b=0,c="None";if(a.length>=6)b+=1;if(a.length>=10)b+=1;if(a.match(/[a-z]/))b+=1;if(a.match(/[A-Z]/))b+=1;if(a.match(/\d+/))b+=1;if(a.match(/(\d.*\d)/))b+=1;if(a.match(/[!,@#$%\^&*?_~]/))b+=1;if(a.match(/([!,@#$%\^&*?_~].*[!,@#$%\^&*?_~])/))b+=1;if(a.match(/[a-z]/)&&a.match(/[A-Z]/))b+=1;if(a.match(/\d/)&&a.match(/\D/))b+=1;if(a.match(/[a-z]/)&&
a.match(/[A-Z]/)&&a.match(/\d/)&&a.match(/[!,@#$%\^&*?_~]/))b+=1;if(b===0)c="None";else if(b<=1)c="Very Weak";else if(b<=3)c="Weak";else if(b<=5)c="Good";else if(b<=7)c="Strong";else if(b>7)c="Very Strong";return{score:b,strength:c}},getValue:function(){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;var a=$("#"+this.id).val();return this.options.emptyValue?a==this.options.emptyValue?"":a:a},setValue:function(a){$("#"+this.id).val(a).removeClass("defaultValue");
this.validate(true)},addEmptyValue:function(){var a=this.options.emptyValue,b=this.component.find("input");b.addClass("defaultValue");b.val(a);var c="";b.focus(function(d){c=$(d.target);if($.trim(c.val())==a){c.val("");c.removeClass("defaultValue")}});b.blur(function(d){c=$(d.target);if($.trim(c.val())==""){c.addClass("defaultValue");c.val(a)}})}});
JFormComponentTextArea=JFormComponent.extend({init:function(a,b,c,d){this._super(a,b,c,d);this.options.allowTabbing&&this.allowTabbing();this.options.emptyValue&&this.addEmptyValue();this.options.autoGrow&&this.addAutoGrow()},initialize:function(){this.tipTarget=this.component.find("textarea");this.options.emptyValue&&this.addEmptyValue()},allowTabbing:function(){this.component.find("textarea").bind("keydown",function(a){if(a!=null)if(a.keyCode==9){if(this.setSelectionRange){var b=this.selectionStart,
c=this.selectionEnd;this.value=this.value.substring(0,b)+"\t"+this.value.substr(c);this.setSelectionRange(b+1,b+1);this.focus()}else if(this.createTextRange){document.selection.createRange().text="\t";a.returnValue=false}a.preventDefault&&a.preventDefault();return false}})},addEmptyValue:function(){var a=this.options.emptyValue,b=this.component.find("textarea");b.addClass("defaultValue");b.val(a);var c="";b.focus(function(d){c=$(d.target);if($.trim(c.val())==a){c.val("");c.removeClass("defaultValue")}});
b.blur(function(d){c=$(d.target);if($.trim(c.val())==""){c.addClass("defaultValue");c.val(a)}})},addAutoGrow:function(){var a=this,b=this.component.find("textarea"),c=b.height();b.css("lineHeight");var d=$("<div></div>").css({position:"absolute",top:-1E4,left:-1E4,width:b.width()-parseInt(b.css("paddingLeft"))-parseInt(b.css("paddingRight")),fontSize:b.css("fontSize"),fontFamily:b.css("fontFamily"),lineHeight:b.css("lineHeight"),resize:"none"}).appendTo(document.body),e=function(){var f=b.val().replace(/</g,
"&lt;").replace(/>/g,"&gt;").replace(/&/g,"&amp;").replace(/\n$/,"<br/>&nbsp;").replace(/\n/g,"<br/>").replace(/ {2,}/g,function(g){for(var h=0,j="";h<g.length-1;h++)j+="&nbsp;";return j+" "});d.html(f);b.css("height",Math.max(d.height()+20,c));a.parentJFormSection.parentJFormPage.jFormer.currentJFormPage&&a.parentJFormSection.parentJFormPage.jFormer.adjustHeight({delay:0})};$(b).change(e).keyup(e).keydown(e);e.apply(b);return this},getValue:function(){if(this.disabledByDependency||this.parentJFormSection.disabledByDependency)return null;
var a=$("#"+this.id).val();return this.options.emptyValue?a==this.options.emptyValue?"":a:a},setValue:function(a){$("#"+this.id).val(a);this.validate(true)}});