fbuilderjQuery=(typeof fbuilderjQuery!='undefined')?fbuilderjQuery:jQuery;fbuilderjQuery(window).bind('pageshow',function(event){if(typeof event.originalEvent['persisted']!='undefined'&&event.originalEvent['persisted'])location.reload();});fbuilderjQuery.fbuilderjQueryGenerator=function(){if('fbuilderGeneratorFlag'in fbuilderjQuery)return;(function($){$.fbuilder=$.fbuilder||{};$.fbuilder['objName']='fbuilderjQuery';;(function(root){var lib={};lib.cf_logical_version='0.1';lib.IF=function(_if,_then,_else){if(_if){return(typeof _then==='undefined')?true:_then;}else{return(typeof _else==='undefined')?false:_else;}};lib.AND=function(){for(var i=0,h=arguments.length;i=12)?'pm':'am';h=h%12;h=(h==0)?12:h;} h=(h<10)?'0'+h:h;i=(i<10)?'0'+i:i;s=(s<10)?'0'+s:s;return format.replace(/y+/i,y).replace(/m+/i,m).replace(/d+/i,d).replace(/h+/i,h).replace(/i+/i,i).replace(/s+/i,s).replace(/a+/i,a);} return num;};} if(window.GCD==undefined) {window.GCD=window.gcd=function(a,b) {if(!b)return a;return GCD(b,a%b);};} if(window.LOGAB==undefined) {window.LOGAB=window.logab=function(a,b) {return LOG(a)/LOG(b);};} var math_prop=["LN10","PI","E","LOG10E","SQRT2","LOG2E","SQRT1_2","LN2","cos","pow","log","tan","sqrt","asin","abs","max","exp","atan2","random","acos","atan","min","sin"];for(var i=0,h=math_prop.length;i').text(value).html() value=value.replace(/"/g,""").replace(/&lt;/g,'<').replace(/&gt;/g,'>');return value;};$.fbuilder['htmlDecode']=function(value) {if(/&(?:#x[a-f0-9]+|#[0-9]+|[a-z0-9]+);?/ig.test(value))value=$('
').html(value).text();return value;};$.fbuilder['escape_symbol']=function(value) {return value.replace(/([\^\$\-\.\,\[\]\(\)\/\\\*\?\+\!\{\}])/g,"\\$1");};$.fbuilder['parseValStr']=function(value) {if(typeof value=='undefined'||value==null)value='';value=$.trim(value.replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\\/g,"\\\\"));return($.isNumeric(value))?value*1:'"'+value+'"';};$.fbuilder['parseVal']=function(value,thousandSeparator,decimalSymbol) {if(typeof value=='undefined'||value==null||value=='')return 0;value=$.trim(value);if(/(\d{1,2}[\/\.\-]\d{1,2}[\/\.\-]\d{4})|(\d{4}[\/\.\-]\d{1,2}[\/\.\-]\d{1,2})/.test(value)) return $.fbuilder['parseValStr'](value);thousandSeparator=$.fbuilder.escape_symbol((typeof thousandSeparator=='undefined')?',':thousandSeparator);decimalSymbol=(typeof decimalSymbol=='undefined'||/^\s*$/.test(decimalSymbol))?'.':decimalSymbol;var correction=new RegExp(((/^\s*$/.test(thousandSeparator))?',':thousandSeparator)+('\(\\d{1,2}\)$')),correctionReplacement=decimalSymbol+'$1';thousandSeparator=new RegExp(thousandSeparator,'g');decimalSymbol=new RegExp($.fbuilder.escape_symbol(decimalSymbol),'g');var t=value.replace(correction,correctionReplacement).replace(thousandSeparator,'').replace(decimalSymbol,'.').replace(/\s/g,''),p=/[+\-]?((\d+(\.\d+)?)|(\.\d+))(?:[eE][+\-]?\d+)?/.exec(t);return(p)?p[0]*1:$.fbuilder['parseValStr'](value);};$.fn.fbuilder=function(options){var opt=$.extend({},{pub:false,identifier:"",title:""},options,true);opt.messages=$.extend({previous:"Previous",next:"Next",pageof:"Page {0} of {0}",required:"This field is required.",email:"Please enter a valid email address.",datemmddyyyy:"Please enter a valid date with this format(mm/dd/yyyy)",dateddmmyyyy:"Please enter a valid date with this format(dd/mm/yyyy)",number:"Please enter a valid number.",digits:"Please enter only digits.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),equalTo:"Please enter the same value again.",max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}."),currency:"Please enter a valid currency value."},opt.messages);opt.messages.max=$.validator.format(opt.messages.max);opt.messages.min=$.validator.format(opt.messages.min);$.extend($.validator.messages,opt.messages);var items=[],reloadItemsPublic=function() {var form_tag=$("#fieldlist"+opt.identifier).closest('form');form_tag.addClass(theForm.formtemplate);if(!opt.cached) {$("#fieldlist"+opt.identifier).html("").addClass(theForm.formlayout);$("#formheader"+opt.identifier).html(theForm.show());var page=0;$("#fieldlist"+opt.identifier).append('
');for(var i=0;i
');} else {$("#fieldlist"+opt.identifier+" .pb"+page).append(items[i].show());if(items[i].predefinedClick) {$("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).attr("placeholder",items[i].predefined);$("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).attr("value","");} if(items[i].userhelpTooltip) {var uh_t,uh=$("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).closest(".dfield");if(uh.length==0) {uh=$("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).closest(".fields");} uh_t=uh.find(".uh");if(uh_t.length&&uh_t.text()!="") {uh.attr("uh",uh_t.text());uh_t.text("");}}}}} else {var page=form_tag.find('.pbreak').length,i=items.length;} if(page>0) {if(!opt.cached) {$("#fieldlist"+opt.identifier+" .pb"+page).addClass("pbEnd");$("#fieldlist"+opt.identifier+" .pbreak").each(function(index){var code=$(this).html();var bSubmit='';if(index==page) {if($("#cpcaptchalayer"+opt.identifier).length&&!/^\s*$/.test($("#cpcaptchalayer"+opt.identifier).html())) {code+='
'+$("#cpcaptchalayer"+opt.identifier).html()+'
';$("#cpcaptchalayer"+opt.identifier).html("");} if($("#cp_subbtn"+opt.identifier).html()) {bSubmit='
'+$("#cp_subbtn"+opt.identifier).html()+'
';}} $(this).html('
'+opt.messages.pageof.replace(/\{\s*\d+\s*\}/,(index+1)).replace(/\{\s*\d+\s*\}/,(page+1))+''+code+'
'+opt.messages.previous+'
'+opt.messages.next+'
'+bSubmit+'
');});} $('#fieldlist'+opt.identifier).find(".pbPrevious,.pbNext").bind("keyup",function(evt){if(evt.which==13||evt.which==32)$(this).click();}).bind("click",{'identifier':opt.identifier},function(evt){var identifier=evt.data.identifier;if(($(this).hasClass("pbPrevious"))||(($(this).hasClass("pbNext"))&&$(this).closest("form").valid())) {var page=parseInt($(this).parents(".pbreak").attr("page"));(($(this).hasClass("pbPrevious"))?page--:page++);$("#fieldlist"+identifier+" .pbreak").css("display","none");$("#fieldlist"+identifier+" .pbreak").find(".field").addClass("ignorepb");$("#fieldlist"+identifier+" .pb"+page).css("display","block");$("#fieldlist"+identifier+" .pb"+page).find(".field").removeClass("ignorepb");if($("#fieldlist"+identifier+" .pb"+page).find(".fields").length>0) {try {var ffocusable=$("#fieldlist"+identifier+" .pb"+page).find(":focusable"),_wScrollTop=$(window).scrollTop(),_viewportHeight=$(window).height(),_scrollTop=$("#fieldlist"+identifier+" .pb"+page).closest('form').offset().top;if(ffocusable.length) {ffocusable[0].focus();} if(_scrollTop<_wScrollTop||(_wScrollTop+_viewportHeight)<_scrollTop) {$('html, body').animate({scrollTop:_scrollTop},50);}} catch(e){}}} else {$(this).closest("form").validate().focusInvalid();} return false;});} else {if(!opt.cached) {if($("#cpcaptchalayer"+opt.identifier).length&&!/^\s*$/.test($("#cpcaptchalayer"+opt.identifier).html())) {$("#fieldlist"+opt.identifier+" .pb"+page).append('
'+$("#cpcaptchalayer"+opt.identifier).html()+'
');$("#cpcaptchalayer"+opt.identifier).html("");} if($("#cp_subbtn"+opt.identifier).html()) {$("#fieldlist"+opt.identifier+" .pb"+page).append('
'+$("#cp_subbtn"+opt.identifier).html()+'
');}}} if(!opt.cached&&opt.setCache) {var url=document.location.href,data={'cffaction':'cff_cache','cache':form_tag.html().replace(/\n+/g,''),'form':form_tag.find('[name="cp_calculatedfieldsf_id"]').val()};$.post(url,data,function(data){if(typeof console!='undefined')console.log(data);});} $(document).on('click','#fbuilder .captcha img',function(){var e=$(this);e.attr('src',e.attr('src').replace(/&\d+$/,'')+'&'+Math.floor(Math.random()*1000));});$(form_tag).find('.captcha img').click();$('#fieldlist'+opt.identifier).find(".pbSubmit").bind("keyup",function(evt){if(evt.which==13||evt.which==32)$(this).click();}).bind("click",{'identifier':opt.identifier},function(evt){$(this).closest("form").submit();});if(i>0) {theForm.after_show(opt.identifier);for(var i=0;i

'+this.title+'

'+this.description+'';},after_show:function(id){var form=$('#cp_calculatedfieldsf_pform'+id);if(typeof $.fn.fbuilder_localstorage!='undefined'&&form.hasClass('persist-form')) {form.fbuilder_localstorage();} form.attr('data-evalequations',this.evalequations).attr('data-evalequationsevent',this.evalequationsevent).attr('autocomplete',((this.autocomplete)?'on':'off')).find('input,select').blur(function(){try{$(this).valid();}catch(e){};});}});var theForm,ffunct={toShow:{},toHide:{},hiddenByContainer:{},getItem:function(name) {for(var i in items) {if(items[i].name==name) {return items[i];}} return false;},getItems:function() {return items;},loadData:function(f) {var d=window[f];if(typeof d!='undefined') {if(typeof d=='object'&&(typeof d.nodeType!=='undefined'||d instanceof jQuery)){d=jQuery.parseJSON(jQuery(d).val());} else if(typeof d=='string'){d=jQuery.parseJSON(d);} if(d.length==2) {this.formId=d[1]['formid'];items=[];for(var i=0;i
'+this.userhelp+'
';},after_show:function() {if(this.regExp!=""&&typeof $['validator']!='undefined') {var parts=this.regExp.match(/(\/)(.*)(\/)([gimy]{0,4})$/i);this.regExp=(parts===null)?new RegExp(this.regExp):new RegExp(parts[2],parts[4].toLowerCase());if(!('pattern'in $.validator.methods)) $.validator.addMethod('pattern',function(value,element,param) {try{return this.optional(element)||param.test(value);} catch(err){return true;}});$('#'+this.name).rules('add',{'pattern':this.regExp,messages:{'pattern':this.regExpMssg}});}},val:function() {var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length)return $.fbuilder.parseValStr(e.val());return 0;}});$.fbuilder.controls['fcurrency']=function(){};$.extend($.fbuilder.controls['fcurrency'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Currency",ftype:"fcurrency",predefined:"",predefinedClick:false,required:false,readonly:false,size:"small",currencySymbol:"$",currencyText:"USD",thousandSeparator:",",centSeparator:".",min:"",max:"",formatDynamically:false,getFormattedValue:function(value) {if(value=='')return value;var ts=this.thousandSeparator,cs=((cs=$.trim(this.centSeparator))!=='')?cs:'.',v=$.fbuilder.parseVal(value,ts,cs),parts=[],counter=0,str='',sign='';if(!isNaN(v)) {if(v<0)sign='-';v=ABS(v);parts=v.toString().split(".");for(var i=parts[0].length-1;i>=0;i--) {counter++;str=parts[0][i]+str;if(counter%3==0&&i!=0)str=ts+str;} parts[0]=str;if(parts[1]) {if(parts[1].length==1)parts[1]+='0';} else parts[1]='00';return this.currencySymbol+sign+parts.join(cs)+this.currencyText;} else {return value;}},show:function() {return'
'+this.userhelp+'
';},after_show:function() {var me=this;if(this.formatDynamically) {$(document).on('change','[name="'+me.name+'"]',function(){this.value=me.getFormattedValue(this.value);});} if(typeof $['validator']!='undefined') {if(!('cffcurrency'in $.validator.methods)) $.validator.addMethod('cffcurrency',function(v,el) {var f=el.id.match(/_\d+$/),esc=$.fbuilder.escape_symbol,r;e=$.fbuilder['forms'][f[0]].getItem(el.name);r=new RegExp('^\\s*('+esc(e.currencySymbol)+')?\\s*\\-?\\d+('+esc(e.thousandSeparator)+'\\d{3})*('+e.centSeparator+'\\d+)?\\s*('+esc(e.currencyText)+')?\\s*$','i');return this.optional(el)||r.test(v)||$.isNumeric(v);},$.validator.messages['currency']);$.validator.methods.min=function(v,el,p) {var f=el.id.match(/_\d+$/),e;if(f)e=$.fbuilder['forms'][f[0]].getItem(el.name);if(e)v=e.val();return this.optional(el)||v>=p;};$.validator.methods.max=function(v,el,p) {var f=el.id.match(/_\d+$/),e;if(f)e=$.fbuilder['forms'][f[0]].getItem(el.name);if(e)v=e.val();return this.optional(el)||v<=p;};}},val:function(raw) {raw=raw||false;var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length) {var v=e.val();if(raw)return($.isNumeric(v))?v:$.fbuilder.parseValStr(v);v=$.trim(v);v=v.replace(new RegExp($.fbuilder['escape_symbol'](this.currencySymbol),'g'),'').replace(new RegExp($.fbuilder['escape_symbol'](this.currencyText),'g'),'');return $.fbuilder.parseVal(v,this.thousandSeparator,this.centSeparator);} return 0;}});$.fbuilder.controls['fnumber']=function(){};$.extend($.fbuilder.controls['fnumber'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Number",ftype:"fnumber",predefined:"",predefinedClick:false,required:false,readonly:false,size:"small",thousandSeparator:"",decimalSymbol:".",min:"",max:"",formatDynamically:false,dformat:"digits",formats:new Array("digits","number"),getFormattedValue:function(value) {if(value=='')return value;var ts=this.thousandSeparator,ds=((ds=$.trim(this.decimalSymbol))!=='')?ds:'.',v=$.fbuilder.parseVal(value,ts,ds),s='',counter=0,str='',parts=[];if(!isNaN(v)) {if(v<0)s='-';v=ABS(v);parts=v.toString().split(".");for(var i=parts[0].length-1;i>=0;i--){counter++;str=parts[0][i]+str;if(counter%3==0&&i!=0)str=ts+str;} parts[0]=str;return s+parts.join(ds);} else {return value;}},show:function() {var _type=(this.dformat=='digits'||(/^\s*$/.test(this.thousandSeparator)&&/^\s*\.\s*$/.test(this.decimalSymbol)))?'number':'text';return'
'+this.userhelp+'
';},after_show:function() {var me=this;if(this.formatDynamically&&this.dformat!='digits') {$(document).on('change','[name="'+me.name+'"]',function(){this.value=me.getFormattedValue(this.value);});} if(typeof $['validator']!='undefined') {$.validator.methods.number=function(v,el) {var f=el.id.match(/_\d+$/),esc=$.fbuilder.escape_symbol,e,r;if(f)e=$.fbuilder['forms'][f[0]].getItem(el.name);if(!e)e={thousandSeparator:',',decimalSymbol:'.'};r=new RegExp('^\\s*\\-?\\d+('+esc(e.thousandSeparator)+'\\d{3})*('+esc(e.decimalSymbol)+'\\d+)?\\s*$','i');return this.optional(el)||r.test(v)||$.isNumeric(v);};$.validator.methods.min=function(v,el,p) {var f=el.id.match(/_\d+$/),e;if(f)e=$.fbuilder['forms'][f[0]].getItem(el.name);if(e)v=e.val();return this.optional(el)||v>=p;};$.validator.methods.max=function(v,el,p) {var f=el.id.match(/_\d+$/),e;if(f)e=$.fbuilder['forms'][f[0]].getItem(el.name);if(e)v=e.val();return this.optional(el)||v<=p;};}},val:function() {var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length) {var v=$.trim(e.val());return $.fbuilder.parseVal(v,this.thousandSeparator,this.decimalSymbol);} return 0;}});$.fbuilder.controls['fslider']=function(){};$.extend($.fbuilder.controls['fslider'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Slider",ftype:"fslider",predefined:"",predefinedMin:"",predefinedMax:"",predefinedClick:false,size:"small",thousandSeparator:",",centSeparator:".",min:0,max:100,step:1,range:false,minCaption:"",maxCaption:"",caption:"{0}",init:function() {this.min=(/^\s*$/.test(this.min))?0:parseFloat($.trim(this.min));this.max=(/^\s*$/.test(this.max))?100:parseFloat($.trim(this.max));this.step=(/^\s*$/.test(this.step))?1:parseFloat($.trim(this.step));this.centSeparator=(/^\s*$/.test(this.centSeparator))?'.':$.trim(this.centSeparator);this.thousandSeparator=$.trim(this.thousandSeparator);this.predefinedMin=(/^\s*$/.test(this.predefinedMin))?this.min:Math.min(Math.max(parseFloat($.trim(this.predefinedMin)),this.min),this.max);this.predefinedMax=(/^\s*$/.test(this.predefinedMax))?this.max:Math.min(Math.max(parseFloat($.trim(this.predefinedMax)),this.min),this.max);this.predefined=(/^\s*$/.test(this.predefined))?this.min:parseFloat($.trim(this.predefined));},show:function() {return'
'+this.minCaption+''+this.maxCaption+'
'+this.userhelp+'
';},set_values:function() {var me=this;function setThousandsSeparator(v) {v=$.fbuilder.parseVal(v,me.thousandSeparator,me.centSeparator);if(!isNaN(v)) {v=v.toString();var parts=v.toString().split("."),counter=0,str='';if(!/^\s*$/.test(me.thousandSeparator)) {for(var i=parts[0].length-1;i>=0;i--) {counter++;str=parts[0][i]+str;if(counter%3==0&&i!=0)str=me.thousandSeparator+str;} parts[0]=str;} if(typeof parts[1]!='undefined'&&parts[1].length==1) {parts[1]+='0';} return parts.join(me.centSeparator);} else {return v;}};if(me.range) {var values=$('#'+me.name+'_slider').slider('values');$('#'+me.name).val('['+values[0]+','+values[1]+']');$('#'+me.name+'_caption').html(me.caption.replace(/\{\s*0\s*\}/,setThousandsSeparator(values[0])).replace(/\{\s*0\s*\}/,setThousandsSeparator(values[1])));} else {var value=$('#'+me.name+'_slider').slider('value');$('#'+me.name).val(value);$('#'+me.name+'_caption').html(me.caption.replace(/\{\s*0\s*\}/,setThousandsSeparator(value)));} $('#'+me.name).change();},after_show:function() {var me=this,opt={range:(me.range!=false)?me.range:"min",min:me.min,max:me.max,step:me.step};if(me.range)opt['values']=[me.predefinedMin,me.predefinedMax];else opt['value']=me.predefined;opt['slide']=opt['stop']=(function(e){return function(event,ui) {if(typeof ui.value!='undefined')$(this).slider('value',ui.value);if(typeof ui.values!='undefined')$(this).slider('values',ui.values);e.set_values();}})(me);$('#'+this.name+'_slider').slider(opt);me.set_values();$('#cp_calculatedfieldsf_pform'+me.form_identifier).bind('reset',function(){$('#'+me.name+'_slider').slider(opt);me.set_values();});},val:function() {var e=$('[id="'+this.name+'"]:not(.ignore)');return(e.length)?e.val():0;},setVal:function(v) {try{v=JSON.parse(v);} catch(err){} try{$('[name="'+this.name+'"]').val(v);if($.isArray(v)) {this.predefinedMin=v[0];this.predefinedMax=v[1];} else {this.predefined=v;} this.after_show();}catch(err){}}});$.fbuilder.controls['femail']=function(){};$.extend($.fbuilder.controls['femail'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Email",ftype:"femail",predefined:"",predefinedClick:false,required:false,readonly:false,size:"medium",equalTo:"",show:function() {return'
'+this.userhelp+'
';},val:function() {var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length)return $.fbuilder.parseValStr(e.val());return 0;}});$.fbuilder.controls['fdate']=function(){};$.extend($.fbuilder.controls['fdate'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Date",ftype:"fdate",predefined:"",predefinedClick:false,size:"medium",required:false,dformat:"mm/dd/yyyy",tformat:"24",showDropdown:false,dropdownRange:"-10:+10",minDate:"",maxDate:"",invalidDates:"",minHour:0,maxHour:23,minMinute:0,maxMinute:59,stepHour:1,stepMinute:1,showDatepicker:true,showTimepicker:false,defaultDate:"",defaultTime:"",working_dates:[true,true,true,true,true,true,true],formats:new Array("mm/dd/yyyy","dd/mm/yyyy"),init:function() {function checkValue(v,min,max) {v=parseInt(v);if(isNaN(v))v=max;else if(vmax)v=max;return v;} this.minHour=checkValue(this.minHour,0,23);this.maxHour=checkValue(this.maxHour,0,23);this.minMinute=checkValue(this.minMinute,0,59);this.maxMinute=checkValue(this.maxMinute,0,59);this.stepHour=checkValue(this.stepHour,1,Math.max(1,this.maxHour-this.minHour));this.stepMinute=checkValue(this.stepMinute,1,Math.max(1,this.maxMinute-this.minMinute));this.invalidDates=this.invalidDates.replace(/\s+/g,'');if(!/^\s*$/.test(this.invalidDates)) {var dateRegExp=new RegExp(/^\d{1,2}\/\d{1,2}\/\d{4}$/),counter=0,dates=this.invalidDates.split(',');this.invalidDates=[];for(var i=0,h=dates.length;i'+h+'';i++;} return':';},get_minutes:function() {var str='',i=0,m;while((m=this.minMinute+this.stepMinute*i)<=this.maxMinute) {if(m<10) {m='0'+''+m;} str+='';i++;} return'';},get_ampm:function() {var str='';if(this.tformat==12) {return'';} return str;},set_date_time:function() {var str=$('#'+this.name+'_date').val();if(this.showTimepicker) {var h=$('#'+this.name+'_hours').val()*1;str+=' ';if(this.tformat==12) {h=(h==12)?0:h;if($('#'+this.name+'_ampm').val()=='pm')str+=(h+12);else str+=h;} else str+=h;str+=':'+$('#'+this.name+'_minutes').val();} $('#'+this.name).val(str).change();},show:function() {var attr='value',format_label=[],date_tag_type='text',disabled='',date_tag_class='field date'+this.dformat.replace(/\//g,"")+' '+this.size+((this.required)?' required':'');if(this.predefinedClick)attr='placeholder';if(this.showDatepicker)format_label.push(this.dformat);else{date_tag_type='hidden';disabled='disabled';} if(this.showTimepicker)format_label.push('HH:mm');return'
'+((this.showTimepicker)?' '+this.get_hours()+this.get_minutes()+' '+this.get_ampm():'')+''+this.userhelp+'
';},setDefaultDate:function() {var me=this,p={dateFormat:me.dformat.replace(/yyyy/g,"yy"),minDate:me.minDate,maxDate:me.maxDate},dp=$("#"+me.name+"_date"),dd=(me.defaultDate!="")?me.defaultDate:((me.predefined!="")?me.predefined:new Date());dp.click(function(){$(document).click();$(this).focus();});if(me.showDropdown) {if(me.dropdownRange.indexOf(':')==-1)me.dropdownRange='-10:+10';p=$.extend(p,{changeMonth:true,changeYear:true,yearRange:me.dropdownRange});} p=$.extend(p,{beforeShowDay:(function(w,i){return function(d){return me.validateDate(d,w,i);};})(me.working_dates,me.invalidDates)});dp.datepicker(p);if(!me.predefinedClick)dp.datepicker("setDate",dd);if(!me.validateDate(dp.datepicker("getDate"),me.working_dates,me.invalidDates)[0]) {dp.datepicker("setDate",'');}},setDefaultTime:function() {function setValue(f,v,m) {v=Math.min(v*1,m*1);v=(v<10)?0+''+v:v;$('#'+f+' [value="'+v+'"]').prop('selected',true);};if(this.showTimepicker) {var parts,time={},tmp=0;if((parts=/(\d{1,2}):(\d{1,2})/g.exec(this.defaultTime))!=null) {time['hour']=parts[1];time['minute']=parts[2];} else {var d=new Date();time['hour']=d.getHours();time['minute']=d.getMinutes();} setValue(this.name+'_hours',(this.tformat==12)?((time['hour']>12)?time['hour']-12:((time['hour']==0)?12:time['hour'])):time['hour'],(this.tformat==12)?12:this.maxHour);setValue(this.name+'_minutes',time['minute'],this.maxMinute);$('#'+this.name+'_ampm'+' [value="'+((time['hour']<12)?'am':'pm')+'"]').prop('selected',true);}},setEvents:function() {var me=this,f=function(){$('#'+me.name+'_date').valid();me.set_date_time();};$(document).on('change','#'+me.name+'_date',function(){f();});$(document).on('change','#'+me.name+'_hours',function(){f();});$(document).on('change','#'+me.name+'_minutes',function(){f();});$(document).on('change','#'+me.name+'_ampm',function(){f();});$('#cp_calculatedfieldsf_pform'+me.form_identifier).bind('reset',function(){setTimeout(function(){me.setDefaultDate();me.setDefaultTime();me.set_date_time();},500);});},validateDate:function(d,w,i) {try{if(d===null)return[false,""];if(!w[d.getDay()])return[false,""];if(i!==null) {for(var j=0,h=i.length;ji.maxHour)return false;} return true;},after_show:function() {var me=this;var validator=function(v,e) {try {var _dp=$.datepicker,_fb=$.fbuilder,p=e.name.replace('_date','').split('_'),_index=(p.length>1)?'_'+p[1]:'',item=(typeof _fb['forms']!='undefined'&&typeof _fb['forms'][_index]!='undefined')?_fb['forms'][_index].getItem(p[0]+'_'+p[1]):null,inst=_dp._getInst(e),minDate=_dp._determineDate(inst,_dp._get(inst,'minDate'),null),maxDate=_dp._determineDate(inst,_dp._get(inst,'maxDate'),null),dateFormat=_dp._get(inst,'dateFormat'),date=_dp.parseDate(dateFormat,v,_dp._getFormatConfig(inst));if(item!=null) {return this.optional(e)||((minDate==null||date>=minDate)&&(maxDate==null||date<=maxDate)&&item.validateDate($(e).datepicker('getDate'),item.working_dates,item.invalidDates)[0]&&item.validateTime(e,item));} return true;} catch(er) {return false;}};if(!('dateddmmyyyy'in $.validator.methods))$.validator.addMethod("dateddmmyyyy",validator);if(!('datemmddyyyy'in $.validator.methods))$.validator.addMethod("datemmddyyyy",validator);me.setDefaultDate();me.setDefaultTime();me.setEvents();me.set_date_time();},val:function(raw) {raw=raw||false;var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length) {var v=e.val(),rt;if(raw)return $.fbuilder.parseValStr(v);if(this.dformat=='yyyy/mm/dd'||this.dformat=='yyyy/dd/mm') rt='(\\d{4})[\\/\\-\\.](\\d{1,2})[\\/\\-\\.](\\d{1,2})';else rt='(\\d{1,2})[\\/\\-\\.](\\d{1,2})[\\/\\-\\.](\\d{4})';v=$.trim(e.val());var re=new RegExp(rt+'(\\s(\\d{1,2})[:\\.](\\d{1,2}))?'),d=re.exec(v),h=0,m=0,date;if(d) {if(typeof d[5]!='undefined')h=d[5];if(typeof d[6]!='undefined')m=d[6];switch(this.dformat) {case'yyyy/dd/mm':date=new Date(d[1],(d[3]*1-1),d[2],h,m,0,0);break;case'yyyy/mm/dd':date=new Date(d[1],(d[2]*1-1),d[3],h,m,0,0);break;case'dd/mm/yyyy':date=new Date(d[3],(d[2]*1-1),d[1],h,m,0,0);break;case'mm/dd/yyyy':date=new Date(d[3],(d[1]*1-1),d[2],h,m,0,0);break;} if(this.showTimepicker) {return date.valueOf()/86400000;} else {return Math.ceil(date.valueOf()/86400000);}}} return 0;},setVal:function(v) {try {v=$.trim(v).replace(/\s+/g,' ').split(' ');this.defaultDate=v[0];this.setDefaultDate();if(v.length==2) {this.defaultTime=v[1];this.setDefaultTime();} this.set_date_time();} catch(err) {}}});$.fbuilder.controls['ftextarea']=function(){};$.extend($.fbuilder.controls['ftextarea'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Untitled",ftype:"ftextarea",predefined:"",predefinedClick:false,required:false,readonly:false,size:"medium",minlength:"",maxlength:"",rows:4,show:function() {return'
'+this.userhelp+'
';},val:function() {var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length)return $.fbuilder.parseValStr(e.val().replace(/[\n\r]+/g,' '));return 0;}});$.fbuilder.controls['fcheck']=function(){};$.extend($.fbuilder.controls['fcheck'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Check All That Apply",ftype:"fcheck",layout:"one_column",required:false,merge:1,max:-1,maxError:"Check no more than {0} boxes",toSubmit:"text",showDep:false,show:function() {this.choicesVal=((typeof(this.choicesVal)!="undefined"&&this.choicesVal!==null)?this.choicesVal:this.choices);var str="",classDep;if(typeof this.choicesDep=="undefined"||this.choicesDep==null) this.choicesDep=new Array();for(var i=0,h=this.choices.length;i';} return'
'+str+''+this.userhelp+'
';},after_show:function() {var m=this;$(document).on('click','[id*="'+m.name+'"]',function(){if(0';} return'
'+str+''+this.userhelp+'
';},after_show:function() {var me=this,n=me.name;if(me.untickAccepted) {$(document).off('click','[id*="'+n+'"]').on('click','[id*="'+n+'"]',function(){var m=this,e=$(m);$('[id*="'+n+'"]').each(function(){if(m!==this)$(this).data('previous-status',false);});if(e.data('previous-status')){m.checked=false;e.change();} e.data('previous-status',m.checked);});}},showHideDep:function(toShow,toHide,hiddenByContainer) {var me=this,item=$('[id*="'+me.name+'"]'),form_identifier=me.form_identifier,isHidden=(typeof toHide[me.name]!='undefined'||typeof hiddenByContainer[me.name]!='undefined'),result=[];try {item.each(function(i,e){if(typeof me.choicesDep[i]!='undefined'&&me.choicesDep[i].length) {var checked=e.checked;for(var j=0,k=me.choicesDep[i].length;j';op_o=true;} else {str+='';}} if(op_o)str+='';return'
'+'
'+this.userhelp+'
';},showHideDep:function(toShow,toHide,hiddenByContainer) {var me=this,item=$('#'+me.name+'.depItemSel'),form_identifier=me.form_identifier,isHidden=(typeof toHide[me.name]!='undefined'||typeof hiddenByContainer[me.name]!='undefined'),result=[];try {if(item.length) {var selected=[];$(item).find(':selected').each(function(){selected.push($(this).data('i'));});for(var i=0,h=me.choices.length;i
'+this.userhelp+'
';},after_show:function() {var me=this;if(!('accept'in $.validator.methods)) $.validator.addMethod("accept",function(value,element,param) {if(this.optional(element))return true;else{param=typeof param==="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";var regExpObj=new RegExp(".("+param+")$","i");for(var i=0,h=element.files.length;i1) {var filesList=[];for(var i=0,h=this.files.length;i'+filesList.join(', ')+'');}});}});$.fbuilder.controls['fpassword']=function(){};$.extend($.fbuilder.controls['fpassword'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Untitled",ftype:"fpassword",predefined:"",predefinedClick:false,required:false,size:"medium",minlength:"",maxlength:"",equalTo:"",show:function() {return'
'+this.userhelp+'
';},val:function() {var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length)return $.fbuilder.parseValStr(e.val());return 0;}});$.fbuilder.controls['fPhone']=function(){};$.extend($.fbuilder.controls['fPhone'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Phone",ftype:"fPhone",required:false,readonly:false,dformat:"### ### ####",predefined:"888 888 8888",show:function() {var me=this,str="",tmp=this.dformat.split(' '),tmpv=this.predefined.split(' '),attr=(typeof this.predefinedClick!='undefined'&&this.predefinedClick)?'placeholder':'value';for(var i=0;i
'+$.trim(tmp[i])+'
';}} return'
'+str+''+this.userhelp+'
';},after_show:function() {var me=this,tmp=me.dformat.split(' ');if(!('phone'in $.validator.methods)) $.validator.addMethod("phone",function(value,element) {if(this.optional(element))return true;else return /^\+{0,1}\d*$/.test(value);});for(var i=0,h=tmp.length;i'+this.userhelp+'
';}});$.fbuilder.controls['fhidden']=function(){};$.extend($.fbuilder.controls['fhidden'].prototype,$.fbuilder.controls['ffields'].prototype,{ftype:"fhidden",title:"",predefined:"",show:function() {return'
';}});$.fbuilder.controls['fSectionBreak']=function(){};$.extend($.fbuilder.controls['fSectionBreak'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Section Break",ftype:"fSectionBreak",userhelp:"A description of the section goes here.",show:function() {return'
'+this.userhelp+'
';}});$.fbuilder.controls['fPageBreak']=function(){};$.extend($.fbuilder.controls['fPageBreak'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Page Break",ftype:"fPageBreak",show:function() {return'
'+this.userhelp+'
';}});$.fbuilder.controls['fsummary']=function(){};$.extend($.fbuilder.controls['fsummary'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Summary",ftype:"fsummary",fields:"",titleClassname:"summary-field-title",valueClassname:"summary-field-value",fieldsArray:[],show:function() {var me=this;if('string'!=typeof me.fields)return;var p=$.trim(me.fields.replace(/\,+/g,',')).split(','),l=p.length;if(l) {var str='
'+((!/^\s*$/.test(me.title))?'

'+me.title+'

':'')+'
';for(var i=0;i
';}} str+='
';return str;}},after_show:function(){var me=this;if('string'!=typeof me.fields)return;var p=$.trim(me.fields.replace(/\,+/g,',')).split(','),l=p.length;if(l) {for(var i=0;i1) {f.addClass('column'+this.columns);if(i%this.columns==0)f.css('clear','left');} f.appendTo(e);}},showHideDep:function(toShow,toHide,hiddenByContainer) {var me=this,isHidden=(typeof toHide[me.name]!='undefined'||typeof hiddenByContainer[me.name]!='undefined'),fId,result=[];for(var i=0,h=me.fields.length;i
'+((!/^\s*$/.test(this.title))?''+this.title+'':'')+'
';},after_show:function() {$.fbuilder.controls['fcontainer'].prototype.after_show.call(this);},showHideDep:function(toShow,toHide,hiddenByContainer) {return $.fbuilder.controls['fcontainer'].prototype.showHideDep.call(this,toShow,toHide,hiddenByContainer);}});$.fbuilder.controls['fdiv']=function(){};$.extend($.fbuilder.controls['fdiv'].prototype,$.fbuilder.controls['ffields'].prototype,{ftype:"fdiv",fields:[],columns:1,show:function() {return'
';},after_show:function() {$.fbuilder.controls['fcontainer'].prototype.after_show.call(this);},showHideDep:function(toShow,toHide,hiddenByContainer) {return $.fbuilder.controls['fcontainer'].prototype.showHideDep.call(this,toShow,toHide,hiddenByContainer);}});$.fbuilder.controls['fMedia']=function(){};$.extend($.fbuilder.controls['fMedia'].prototype,$.fbuilder.controls['ffields'].prototype,{ftype:"fMedia",sMediaType:"image",data:{image:{sWidth:"",sHeight:"",sSrc:"",sAlt:"",sLink:"",sTarget:"",sFigcaption:""},audio:{sWidth:"",sSrc:"",sSrcAlt:"",sControls:1,sLoop:0,sAutoplay:0,sMuted:0,sPreload:"auto",sFallback:"",sFigcaption:""},video:{sWidth:"",sHeight:"",sSrc:"",sSrcAlt:"",sPoster:"",sControls:1,sLoop:0,sAutoplay:0,sMuted:0,sPreload:"auto",sFallback:"",sFigcaption:""}},_show_image:function() {var d=this.data.image,esc=$.fbuilder.htmlEncode,a=[],l=[],r='';if($.trim(d.sWidth))a.push('width="'+esc(d.sWidth)+'"');if($.trim(d.sHeight))a.push('height="'+esc(d.sHeight)+'"');if($.trim(d.sSrc))a.push('src="'+esc(d.sSrc)+'"');if($.trim(d.sAlt))a.push('alt="'+esc(d.sAlt)+'"');if($.trim(d.sLink)) {l.push('href="'+esc(d.sLink)+'"');if($.trim(d.sTarget))l.push('target="'+esc(d.sTarget)+'"');r='';} else {r='';} return r;},_show_audio_video:function(d,isV) {var esc=$.fbuilder.htmlEncode,a=[],t=(isV)?'video':'audio';if($.trim(d.sWidth))a.push('width="'+esc(d.sWidth)+'"');if(isV&&$.trim(d.sHeight))a.push('height="'+esc(d.sHeight)+'"');if(isV&&$.trim(d.sPoster))a.push('poster="'+esc(d.sPoster)+'"');if($.trim(d.sSrc))a.push('src="'+esc(d.sSrc)+'"');if(d.sAutoplay)a.push('autoplay');if(d.sControls)a.push('controls');if(d.sLoop)a.push('loop');if(d.sMuted)a.push('muted');a.push('preload="'+esc(d.sPreload)+'"');return'<'+t+' '+a.join(' ')+'>'+(($.trim(d.sSrcAlt))?'':'')+'

'+d.sFallback+'

';},_show_audio:function() {return this._show_audio_video(this.data.audio,false);},_show_video:function() {return this._show_audio_video(this.data.video,true);},show:function() {return'
'+this['_show_'+this.sMediaType]()+'
'+this.data[this.sMediaType].sFigcaption+'
';}});$.fbuilder.controls['fButton']=function(){};$.extend($.fbuilder.controls['fButton'].prototype,$.fbuilder.controls['ffields'].prototype,{ftype:"fButton",sType:"button",sValue:"button",sOnclick:"",userhelp:"A description of the section goes here.",show:function() {var esc=function(v){v=v.replace(/</g,'&').replace(/"/g,""").replace(/\n+/g,' ');return v;},type=this.sType,clss='';if(this.sType=='calculate') {type='button';clss='calculate-button';} else if(this.sType=='reset') {clss='reset-button';} return'
'+this.userhelp+'
';},after_show:function() {$('#'+this.name).click(function() {var e=$(this);if(e.hasClass('calculate-button')) {var suffix=e.attr('id').match(/_\d+$/)[0],items=$.fbuilder['forms'][suffix].getItems();$.fbuilder['calculator'].defaultCalc('#'+e.closest('form').attr('id'));for(var i=0,h=items.length;i0) {$("#fieldlist"+identifier+" .pb0").find(".field").removeClass("ignorepb");try {$("#fieldlist"+identifier+" .pb0").find(".field")[0].focus();} catch(e){}}}},50);}});}});$.fbuilder.controls['fhtml']=function(){};$.extend($.fbuilder.controls['fhtml'].prototype,$.fbuilder.controls['ffields'].prototype,{ftype:"fhtml",fcontent:"",show:function() {return'
'+$('
').html(this.fcontent).html()+'
';}});$.fbuilder.controls['facceptance']=function(){};$.extend($.fbuilder.controls['facceptance'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Accept terms and conditions",ftype:"facceptance",value:"I accept",required:true,url:"",message:"",show:function() {var me=this,dlg='',label=me.title;if(!/^\s*$/.test(me.url)) {label=''+label+'';} else if(!/^\s*$/.test(me.message)) {label=''+label+'';dlg+='
'+me.message+'
'} return'
'+'
'+ dlg+'
';},after_show:function() {$(document).on('click','.cff-open-dlg',function(){var dlg=$(this).closest('.fields').find('.cff-dialog'),w=dlg.data('width'),h=dlg.data('height');dlg.removeClass('hide');if('undefined'==typeof w)w=MIN($(this).closest('form').width(),$(window).width(),dlg.width());if('undefined'==typeof h)h=MIN($(this).closest('form').height(),$(window).height(),dlg.height());dlg.data('width',w);dlg.data('height',h);dlg.css({'width':w+'px','height':h+'px','margin-top':(-1*h/2)+'px','margin-left':(-1*w/2)+'px'});});$(document).on('click','.cff-close-dlg',function(){$(this).closest('.cff-dialog').addClass('hide');});},val:function() {var e=$('[id="'+this.name+'"]:checked:not(.ignore)');if(e.length) {var t=$.fbuilder.parseValStr(e[0].value);if(!$.isNumeric(t))t=t.replace(/^"/,'').replace(/"$/,'');} return(v)?(($.isNumeric(v))?v:'"'+v+'"'):0;}});$.fbuilder.controls['fCalculated']=function(){};$.extend($.fbuilder.controls['fCalculated'].prototype,$.fbuilder.controls['ffields'].prototype,{title:"Untitled",ftype:"fCalculated",predefined:"",required:false,size:"medium",eq:"",suffix:"",prefix:"",decimalsymbol:".",groupingsymbol:"",dependencies:[{'rule':'','complex':false,'fields':['']}],readonly:true,hidefield:false,show:function() {return'
'+((!this.hidefield)?''+this.userhelp+'':'')+'
';},after_show:function() {var me=this,configuration={"suffix":me.suffix,"prefix":me.prefix,"groupingsymbol":me.groupingsymbol,"decimalsymbol":me.decimalsymbol},dependencies=[];$.each(me.dependencies,function(i,d) {d.rule=d.rule.replace(/^\s+/,'').replace(/\s+$/,'');if(d.rule!=''&&d.fields.length){var fields=[];$.each(d.fields,function(j,f){if(f!='') {fields.push(f);}});if(fields.length){dependencies.push({'rule':d.rule,'fields':fields});}}});me.dependencies=dependencies;var eq=me.eq;eq=eq.replace(/\n/g,' ').replace(/fieldname(\d+)/g,"fieldname$1"+me.form_identifier).replace(/form_identifier/g,'\''+this['form_identifier']+'\'').replace(/;\s*\)/g,')').replace(/;\s*$/,'');if(!/^\s*$/.test(eq)) {$.fbuilder.calculator.addEquation(me.name,eq,configuration,dependencies,me.form_identifier);} var e=$('[id="'+me.name+'"]');e.bind('calcualtedfield_changed',{obj:me},function(evt){if($.fbuilder['calculator'].getDepList(evt.data.obj.name,evt.data.obj.val(),evt.data.obj.dependencies)) {$.fbuilder.showHideDep({'formIdentifier':evt.data.obj.form_identifier,'fieldIdentifier':evt.data.obj.name,'throwEvent':false});}});},showHideDep:function(toShow,toHide,hiddenByContainer) {var me=this,result=[];if($.fbuilder['calculator'].getDepList(me.name,me.val(),me.dependencies)) {var item=$('#'+me.name),identifier=me.form_identifier,isHidden=(typeof toHide[me.name]!='undefined'||typeof hiddenByContainer[me.name]!='undefined'),d,n,dep,clearRef=function(id){if(typeof toShow[id]!='undefined') {delete toShow[id]['ref'][me.name];if($.isEmptyObject(toShow[id]['ref'])) delete toShow[id];}},hideField=function(id){$('[id*="'+id+'"],.'+id).closest('.fields').hide();$('[id*="'+id+'"]:not(.ignore)').addClass('ignore');toHide[id]={};};try {d=item.attr('dep');if(typeof d!='undefined'&&!/^\s*$/.test(d))d=d.split(',');else d=[];n=item.attr('notdep');if(typeof n!='undefined'&&!/^\s*$/.test(n))n=n.split(',');else n=[];if(isHidden) {n=n.concat(d);d=[];} for(i=0;i=0;i--){counter++;str=parts[0][i]+str;if(counter%3==0&&i!=0)str=config.groupingsymbol+str;} parts[0]=str;} value=symbol+parts.join(config.decimalsymbol);} if(config.prefix) {value=config.prefix+value;} if(config.suffix) {value+=config.suffix;}} return value;},unformat:function(field) {var escape_symbol=$.fbuilder.escape_symbol;var eq=field[0].form.equations,v=field.val();for(var i=0,h=eq.length;i=33&&evt.keyCode<=40))return;_checkValueThrowingEquation(t);} else {if(t.hasClass('depItem')||(t.prop('tagName')=='INPUT'&&t.attr('type').toLowerCase()=='text'&&evt.type!='change')) {return;} obj.Calculate(t[0]);}});$(document).bind('showHideDepEvent',function(evt,form_identifier) {var fId='#'+form_identifier,evalequations=$(fId).attr('data-evalequations');if(typeof evalequations=='undefined'||evalequations*1==1)obj.defaultCalc(fId);});return obj;})();try{!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);}catch(err){}if(typeof $.fn['fbuilder_serializeObject']=='undefined') {$.fn.fbuilder_serializeObject=function() {var o={},a=this.serializeArray();$.each(a,function(){if(/^fieldname\d+_\d+(\[\])?$/.test(this.name))this.name=this.name.match(/fieldname\d+/)[0];else return;if(o[this.name]){if(!o[this.name].push){o[this.name]=[o[this.name]];} o[this.name].push(this.value||'');}else{o[this.name]=this.value||'';}});return o;};} $.fn.fbuilder_localstorage=function(){var form=this,id=form.attr('id'),sq=(typeof id=='undefined')?1:id.replace(/[^\d]/g,''),localStore_obj,fields;if(sq=='')sq=1;localStore_obj=new $.fbuilder_localstorage(form,true);$(document).on('change','#'+id+' *',function(evt){if(typeof this['id']!='undefined'&&/^fieldname\d+_\d+$/i.test(this.id)&&typeof this['value']!='undefined') {localStore_obj.set_fields();}});form.on('submit',function(){localStore_obj.clear_fields();});fields=localStore_obj.get_fields();if(!$.isEmptyObject(fields)) {if(typeof cpcff_default=='undefined')cpcff_default={};if(typeof cpcff_default[sq]=='undefined')cpcff_default[sq]={};cpcff_default[sq]=$.extend(cpcff_default[sq],fields);} return this;} $.fbuilder_localstorage=function(form,debug){this.form=form;this.id=form.attr('id')+'_'+form.find('[name="cp_calculatedfieldsf_id"]').val();this.debug=(typeof debug!='undefined'&&debug)?true:false;};$.fbuilder_localstorage.prototype=(function(){var is_available;function _log(mssg) {if(typeof console!='undefined')console.log(mssg);};return{is_available:function(){if(typeof is_available!='undefined')return is_available;try{var storage=window['localStorage'],x='__storage_test__';storage.setItem(x,x);storage.removeItem(x);is_available=true;return true;} catch(e){if(this.debug)_log('localStorage object is not available');is_available=false;return e instanceof DOMException&&(e.code===22||e.code===1014||e.name==='QuotaExceededError'||e.name==='NS_ERROR_DOM_QUOTA_REACHED')&&storage.length!==0;}},get_fields:function(){try{if(typeof this.fields=='undefined')this.fields=JSON.parse(localStorage.getItem(this.id));return this.fields;}catch(err){_log('Error reading the fields.');_log(err);}},set_fields:function(){try{this.fields=this.form.fbuilder_serializeObject();localStorage.setItem(this.id,JSON.stringify(this.fields));}catch(err){_log('Error saving the fields.');_log(err);}},clear_fields:function(){try{localStorage.removeItem(this.id);}catch(err){_log('Error deleting the fields.');_log(err);}}};})();var fcount=1;var fnum="_"+fcount;while(typeof window["cp_calculatedfieldsf_fbuilder_config"+fnum]!='undefined'||fcount<10) {try{var cp_calculatedfieldsf_fbuilder_config=window["cp_calculatedfieldsf_fbuilder_config"+fnum];var f=$("#fbuilder"+fnum).fbuilder((typeof cp_calculatedfieldsf_fbuilder_config.obj=='string')?$.parseJSON(cp_calculatedfieldsf_fbuilder_config.obj):cp_calculatedfieldsf_fbuilder_config.obj);$("#cp_calculatedfieldsf_pform"+fnum).validate({ignore:".ignore,.ignorepb",errorElement:"div",errorPlacement:function(e,element) {var _parent=element.closest('.dfield'),_uh=_parent.find('span.uh:visible');if(_uh.length) e.appendTo(_uh);else e.insertAfter(_parent);e.addClass('message').css('position','absolute');}});f.fBuild.loadData("form_structure"+fnum);}catch(e){} fcount++;fnum="_"+fcount;}})(fbuilderjQuery);fbuilderjQuery.fbuilderGeneratorFlag=1;};fbuilderjQuery(fbuilderjQuery.fbuilderjQueryGenerator);fbuilderjQuery(window).on('load',fbuilderjQuery.fbuilderjQueryGenerator);