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;var found_form=!1;(function($){$.fbuilder=$.fbuilder||{};$.fbuilder.objName='fbuilderjQuery';(function(root){var lib={};lib.cf_logical_version='0.1';lib.IF=function(condition,if_true,if_false){if(condition){return(typeof if_true==='undefined')?true:if_true}else{return(typeof if_false==='undefined')?false:if_false}};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.SUM==undefined){window.SUM=window.sum=function(){var r=0,t;for(var i in arguments){if(Array.isArray(arguments[i])) r+=SUM.apply(this,arguments[i]);else if(jQuery.isPlainObject(arguments[i])) r+=SUM.apply(this,Object.values(arguments[i]));else{t=arguments[i]*1;if(!isNaN(t))r+=t}} return r}} if(window.CONCATENATE==undefined){window.CONCATENATE=window.concatenate=function(){var r='';for(var i in arguments){if(Array.isArray(arguments[i])) r+=CONCATENATE.apply(this,arguments[i]);else if(jQuery.isPlainObject(arguments[i])) r+=CONCATENATE.apply(this,Object.values(arguments[i]));else r+=(new String(arguments[i]))} return r}} if(window.AVERAGE==undefined){window.AVERAGE=window.average=function(){return SUM.apply(this,arguments)/arguments.length}} if(window.GCD==undefined){window.GCD=window.gcd=function(a,b){if(!b)return a;return GCD(b,a%b)}} if(window.LCM==undefined){window.LCM=window.lcm=function(a,b){return(!a||!b)?0:ABS((a*b)/GCD(a,b))}} if(window.LOGAB==undefined){window.LOGAB=window.logab=function(a,b){return LOG(a)/LOG(b)}} if(window.MIN==undefined){window.MIN=window.min=function(){var l=[];for(var i in arguments) var l=l.concat(arguments[i]);return Math.min.apply(this,l)}} if(window.MAX==undefined){window.MAX=window.max=function(){var l=[];for(var i in arguments) var l=l.concat(arguments[i]);return Math.max.apply(this,l)}} if(window.RADIANS==undefined){window.RADIANS=window.radians=function(a){return a*PI/180}} if(window.DEGREES==undefined){window.DEGREES=window.degrees=function(a){return a*180/PI}} if(window.FACTORIAL==undefined){window.FACTORIAL=window.factorial=function(a){if(a<0||FLOOR(a)!=a)return null;var r=1;for(var i=1;i<=a;i++)r*=i return r}} if(window.SCIENTIFICTODECIMAL==undefined){window.SCIENTIFICTODECIMAL=window.scientifictodecimal=function(x){if(Math.abs(x)<1.0){var e=parseInt(x.toString().split('e-')[1]);if(e){x*=Math.pow(10,e-1);x='0.'+(new Array(e)).join('0')+x.toString().substring(2)}}else{var e=parseInt(x.toString().split('+')[1]);if(e>20){e-=20;x/=Math.pow(10,e);x+=(new Array(e+1)).join('0')}} return x}} if(window.FORMAT==undefined){window.FORMAT=window.format=function(x,o){return fbuilderjQuery.fbuilder.calculator.format(x,o)}} fbuilderjQuery.fbuilder.extend_window(fbuilderjQuery.fbuilder.modules['default'].prefix,CF_LOGICAL)},'validator':function(v){return(typeof v=='number')?isFinite(v):(typeof v!='undefined')}};(function(root){var lib={};lib.cf_processing_version='0.1';function _getForm(_form){if(typeof _form=='undefined'){if('currentFormId'in fbuilderjQuery.fbuilder)_form=fbuilderjQuery.fbuilder.currentFormId;else return'_1'} if(/^_\d*$/.test(_form))return _form;if(/^\d*$/.test(_form))return'_'+_form;return $((typeof _form=='object')?_form:'#'+_form).find('[name="cp_calculatedfieldsf_pform_psequence"]').val()} function _getField(_field,_form){return $.fbuilder.forms[_getForm(_form)].getItem(_field)} lib.activatefield=lib.ACTIVATEFIELD=function(_field,_form){var o=_getForm(_form),f=_getField(_field,_form),j;if(f){j=f.jQueryRef();if(j.find('[id*="'+f.name+'"]').hasClass('ignore')){j.add(j.find('.fields')).show();if(f.name in $.fbuilder.forms[o].toHide)delete $.fbuilder.forms[o].toHide[f.name];if(!(f.name in $.fbuilder.forms[o].toShow))$.fbuilder.forms[o].toShow[f.name]={'ref':{}};j.find('[id*="'+f.name+'"]').removeClass('ignore').change();$.fbuilder.showHideDep({'formIdentifier':o,'fieldIdentifier':f.name})}}};lib.ignorefield=lib.IGNOREFIELD=function(_field,_form){var o=_getForm(_form),f=_getField(_field,_form),j;if(f){j=f.jQueryRef();if(!j.find('[id*="'+f.name+'"]').hasClass('ignore')){j.add(j.find('.fields')).hide();if(!(f.name in $.fbuilder.forms[o].toHide))$.fbuilder.forms[o].toHide[f.name]={};if(f.name in $.fbuilder.forms[o].toShow)delete $.fbuilder.forms[o].toShow[f.name];j.find('[id*="'+f.name+'"]').addClass('ignore').change();$.fbuilder.showHideDep({'formIdentifier':o,'fieldIdentifier':f.name})}}};lib.disableequations=lib.DISABLEEQUATIONS=function(f){jQuery(f||'[id*="cp_calculatedfieldsf_pform_"]').attr('data-evalequations',0)};lib.enableequations=lib.ENABLEEQUATIONS=function(f){jQuery(f||'[id*="cp_calculatedfieldsf_pform_"]').attr('data-evalequations',1)};lib.EVALEQUATIONS=lib.evalequations=function(f){fbuilderjQuery.fbuilder.calculator.defaultCalc(f)};lib.EVALEQUATION=lib.evalequation=function(f,e){var c=fbuilderjQuery.fbuilder.calculator,eq,fi,i;if(typeof e=='undefined')c.defaultCalc(f);else{if(Number.isInteger(e))e='fieldname'+e;if('equations'in f){for(i in f.equations){eq=f.equations[i];fi=eq.identifier;if(eq.result==e+fi){c.enqueueEquation(fi,[eq]);c.processQueue(fi);return}}}}};root.CF_FIELDS_MANAGEMENT=lib})(this);fbuilderjQuery=(typeof fbuilderjQuery!='undefined')?fbuilderjQuery:jQuery;fbuilderjQuery.fbuilder=fbuilderjQuery.fbuilder||{};fbuilderjQuery.fbuilder.modules=fbuilderjQuery.fbuilder.modules||{};fbuilderjQuery.fbuilder.modules.processing={'prefix':'','callback':function(){fbuilderjQuery.fbuilder.extend_window(fbuilderjQuery.fbuilder.modules.processing.prefix,CF_FIELDS_MANAGEMENT)}};(function(root){var lib={records:{}};lib.cff_connector_version='0.1';lib.cffProxy=lib.cffproxy=lib.CFFPROXY=function(){if(typeof fbuilderjQuery=='undefined'||!arguments.length||typeof arguments[0]!='function')return;var $=fbuilderjQuery,args=Array.prototype.slice.call(arguments);index=args.toString();if(typeof lib.records[index]!='undefined')return lib.records[index];var form_id=(typeof $.fbuilder.currentFormId!='undefined')?$.fbuilder.currentFormId:'cp_calculatedfieldsf_pform_1',aux=(function(eq,index){return function(value){lib.records[index]=value;$.fbuilder.calculator.enqueueEquation(eq.identifier,[eq]);$.fbuilder.calculator.removePending(eq.identifier);if(!$.fbuilder.calculator.processing_queue){$.fbuilder.calculator.processQueue(eq.identifier)}}})($.fbuilder.currentEq,index),f=args[0];args.shift();args.push(aux);$.fbuilder.calculator.addPending($.fbuilder.currentEq.identifier);f.apply(null,args)};root.CF_CONNECTOR=lib})(this);fbuilderjQuery=(typeof fbuilderjQuery!='undefined')?fbuilderjQuery:jQuery;fbuilderjQuery.fbuilder=fbuilderjQuery.fbuilder||{};fbuilderjQuery.fbuilder.modules=fbuilderjQuery.fbuilder.modules||{};fbuilderjQuery.fbuilder.modules.connector={'prefix':'','callback':function(){fbuilderjQuery.fbuilder.extend_window(fbuilderjQuery.fbuilder.modules.connector.prefix,CF_CONNECTOR)}};(function(root){var lib={records:{}};lib.cff_url_version='0.1';lib.generateURL=lib.generateurl=lib.GENERATEURL=function(url,params,hash){var urlComponents=url.split('#'),queryString='',connector='';if(typeof params=='object'&¶ms){connector=(url.indexOf('?')==-1)?'?':'&';queryString=jQuery.param(params)} if(typeof hash=='string')urlComponents[1]=hash;urlComponents[0]+=connector+queryString;return urlComponents.join('#')};lib.redirectToURL=lib.redirecttourl=lib.REDIRECTTOURL=function(url,obj){document.location.href=url+(obj?(url.indexOf('?')===-1?'?':'&')+$.param(obj):'')};lib.getURL=lib.geturl=lib.GETURL=function(){return document.location.href};lib.getBaseURL=lib.getbaseurl=lib.GETBASEURL=function(){return window.location.protocol+'//'+window.location.host+'/'};lib.getURLHash=lib.geturlhash=lib.GETURLHASH=function(nohash){return window.location.hash.replace((nohash)?/^#/:'','')};lib.getURLPath=lib.geturlpath=lib.GETURLPATH=function(noslash){return window.location.pathname.replace((noslash)?new RegExp('^\/','g'):'','').replace((noslash)?new RegExp('\/$','g'):'','')};lib.getURLParameters=lib.geturlparameters=lib.GETURLPARAMETERS=function(url){var qs=url?url.split('?')[1]:window.location.search.slice(1),obj={};if(qs){qs=qs.split('#')[0];var arr=qs.split('&');for(var i=0;i').text(value).html().replace(/"/g,""").replace(/&lt;/g,'<').replace(/&gt;/g,'>')};$.fbuilder.htmlDecode=function(value){return(/&(?:#x[a-f0-9]+|#[0-9]+|[a-z0-9]+);?/ig.test(value))?$('
').html(value).text():value};$.fbuilder.escapeSymbol=function(value){return value.replace(/([\^\$\-\.\,\[\]\(\)\/\\\*\?\+\!\{\}])/g,"\\$1")};$.fbuilder.parseValStr=function(value,raw){raw=raw||!1;value=$.trim(value||'');value=value.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"');return($.isNumeric(value))?((raw)?value:value*1):'"'+value+'"'};$.fbuilder.parseVal=function(value,thousand,decimal){if(!!value==!1)return 0;if(/(\d{1,2}[\/\.\-]\d{1,2}[\/\.\-]\d{4})|(\d{4}[\/\.\-]\d{1,2}[\/\.\-]\d{1,2})/.test(value)) return $.fbuilder.parseValStr(value);thousand=$.fbuilder.escapeSymbol($.trim((typeof thousand!='undefined')?thousand:','));decimal=$.trim((!!!decimal||/^\s*$/.test(decimal))?'.':decimal);var t=(new String(value)).replace(new RegExp((/^\s*$/.test(thousand)?'\,':thousand)+'\(\\d{1,2}\)$'),decimal+'$1').replace(new RegExp(thousand,'g'),'').replace(new RegExp($.fbuilder.escapeSymbol(decimal),'g'),'.').replace(/\s/g,''),p=/[+\-]?((\d+(\.\d+)?)|(\.\d+))(?:[eE][+\-]?\d+)?/.exec(t);return(p)?((/^0\d/.test(p[0]))?p[0].substr(1):p[0])*1:$.fbuilder.parseValStr(value)};$.fbuilder.isMobile=function(){try{document.createEvent("TouchEvent");return!0}catch(e){return!1}};$.fbuilder.setBrowserHistory=function(r){if('history'in window){var b='#',s='';for(var id in $.fbuilder.forms){b+=s+'f'+id.replace(/[^\d]/g,'')+'p'+($.fbuilder.forms[id].currentPage||0);s='|'} history[(r)?'replaceState':'pushState']({},document.title,b)}};$.fbuilder.manageHistory=function(onload){var b=(document.URL.split('#')[1]||null),m,f,t,flag=!1;if(b){while(m=b.match(/f(\d+)p(\d+)\|?/)){f='_'+m[1];t=onload?0:m[2]*1;b=b.replace(m[0],'');flag=(!(f in $.fbuilder.forms)||t!=$.fbuilder.goToPage({'formIdentifier':f,'from':0,'to':t}))}}else{for(f in $.fbuilder.forms) if('currentPage'in $.fbuilder.forms[f]) $.fbuilder.goToPage({'formIdentifier':f,'from':0,'to':0})} if(flag)$.fbuilder.setBrowserHistory(!0)};$.fbuilder.goToPage=function(config){if(('formIdentifier'in config||'form'in config)&&'to'in config){var id=(config.form)?$('[name="cp_calculatedfieldsf_pform_psequence"]',config.form).val():config.formIdentifier,formObj=$.fbuilder.forms[id],_from=(config.from||formObj.currentPage||0)*1,_to=config.to*1,direction=(_from<_to)?1:-1,formDom=$(config.form||'[id="'+formObj.formId+'"]'),pageDom,i=_from;while(i!=_to){if(direction==1&&!formDom.valid())break;i+=direction} formObj.currentPage=i;$(".pbreak:not(.pb"+i+")",formDom).hide().find(".field").addClass("ignorepb");(pageDom=$(".pbreak.pb"+i,formDom)).show().find(".ignorepb").removeClass("ignorepb");if(i!=_from){try {if(!this.isMobile()){var ff=pageDom.find(":focusable:first");if(ff&&!ff.hasClass('hasDatepicker')&&ff.attr('type')!='radio'&&ff.attr('type')!='checkbox'&&ff.closest('[uh]').length==0)ff.focus()} var _wScrollTop=$(window).scrollTop(),_viewportHeight=$(window).height(),_scrollTop=formDom.offset().top;if(_scrollTop<_wScrollTop||(_wScrollTop+_viewportHeight)<_scrollTop) $('html, body').animate({scrollTop:_scrollTop},50)}catch(e){}}else{formDom.validate().focusInvalid()} $(document).trigger('cff-gotopage');return i}};$.fbuilder.showHideDep=function(config){var processItems=function(items,isNotFirstTime){for(var i=0,h=items.length;i
';captcha_tag.remove()} return html},getSubmitHTML=function(){var submit_tag=$("#cp_subbtn"+opt.identifier+':not(:empty)'),html='';if(submit_tag.length){html+='
'+submit_tag.html()+'
';submit_tag.remove()} return html};form_tag.addClass(theForm.formtemplate);if(!opt.cached){page_tag=$('
');fieldlist_tag.addClass(theForm.formlayout).html(theForm.show()).append(page_tag);for(i;i
');fieldlist_tag.append(page_tag)}else{page_tag.append(items[i].show());if(items[i].predefinedClick){page_tag.find("#"+items[i].name).attr({placeholder:items[i].predefined,value:""})} if(items[i].exclude){page_tag.find('.'+items[i].name).addClass('cff-exclude')} if(items[i].userhelpTooltip){var uh=items[i].jQueryRef();if(items[i].userhelp&&items[i].userhelp.length){if(items[i].tooltipIcon)$('').attr('uh',items[i].userhelp).appendTo($(uh.children('label')[0]||uh));else $(uh.find(".dfield")[0]||uh).attr('uh',items[i].userhelp)} uh.find(".uh").remove()}}}}else{page=fieldlist_tag.find('.pbreak').length;i=items.length} if(page>0){if(!opt.cached){$(".pb"+page,fieldlist_tag).addClass("pbEnd");$(".pbreak",fieldlist_tag).each(function(index){var code=$(this).html(),bSubmit='';if(index==page){code+=getCaptchaHTML();bSubmit=getSubmitHTML()} $(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_tag.find(".pbPrevious,.pbNext").bind("keyup",function(evt){if(evt.which==13||evt.which==32)$(this).click()}).bind("click",{'identifier':opt.identifier},function(evt){var _from=($.fbuilder.forms[evt.data.identifier].currentPage||0),_inc=($(this).hasClass("pbPrevious"))?-1:1,_p=$.fbuilder.goToPage({'formIdentifier':evt.data.identifier,'from':_from,'to':_from+_inc}),_pDom=$('.pb'+_p);if(_from!=_p)$.fbuilder.setBrowserHistory();if(_pDom.find('.fields:visible').length==0) if(_inc==-1&&0<_p)_pDom.find('.pbPrevious').click();else if(!_pDom.hasClass('pbEnd'))_pDom.find('.pbNext').click();return!1})}else{if(!opt.cached)$(".pb"+page,fieldlist_tag).append(getCaptchaHTML()+getSubmitHTML())} 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)})} jQuery(document).on('click','.cff-help-icon',function(evt){evt.stopPropagation();evt.preventDefault()});$(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){}});if(!this.autocomplete)form.find('input[name*="fieldname"]').attr('autocomplete','new-password')}});var theForm,ffunct={toShow:{},toHide:{},hiddenByContainer:{},getItem:function(name){if(name in fieldsIndex)return items[fieldsIndex[name]];var regExp=new RegExp((parseInt(name,10)==name)?'fieldname'+name+'_':name+'_',i);for(var i in items){if(items[i].name==name||regExp.test(items[i].name)){return items[i]}} return!1},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!0}});$('#'+this.name).rules('add',{'pattern':this.regExp,messages:{'pattern':this.regExpMssg}})}},val:function(raw){raw=raw||!1;var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length)return $.fbuilder.parseValStr(e.val(),raw);return 0}});$.fbuilder.controls.fcurrency=function(){};$.extend($.fbuilder.controls.fcurrency.prototype,$.fbuilder.controls.ffields.prototype,{title:"Currency",ftype:"fcurrency",predefined:"",predefinedClick:!1,required:!1,readonly:!1,size:"small",currencySymbol:"$",currencyText:"USD",thousandSeparator:",",centSeparator:".",noCents:!1,min:"",max:"",formatDynamically:!1,twoDecimals:!1,set_min:function(v,rmv){var e=$('[id="'+this.name+'"]');if(rmv)e.removeAttr('min');else e.attr('min',v);e.valid()},set_max:function(v,rmv){var e=$('[id="'+this.name+'"]');if(rmv)e.removeAttr('max');else e.attr('max',v);e.valid()},getFormattedValue:function(value){if(value=='')return value;var me=this,ts=me.thousandSeparator,cs=((cs=$.trim(me.centSeparator))!=='')?cs:'.',v=$.fbuilder.parseVal(value,ts,cs),parts=[],counter=0,str='',sign='';if(!isNaN(v)){if(v<0)sign='-';v=ABS(v);if(this.twoDecimals)v=v.toFixed(2);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 me.currencySymbol+sign+((me.noCents)?parts[0]:parts.join(cs))+me.currencyText}else{return value}},init:function(){if(!/^\s*$/.test(this.min))this._setHndl('min');if(!/^\s*$/.test(this.max))this._setHndl('max')},show:function(){this.predefined=this._getAttr('predefined');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.escapeSymbol,r;e=$.fbuilder.forms[f[0]].getItem(el.name);r=new RegExp('^\\s*('+esc(e.currencySymbol)+')?\\s*\\-?\\d+('+esc(e.thousandSeparator)+'\\d{3})*'+((e.noCents)?'':'('+e.centSeparator+'\\d+)?')+'\\s*('+esc(e.currencyText)+')?\\s*$','i');return this.optional(el)||r.test(v)||($.isNumeric(v)&&(!e.noCents||v===FLOOR(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();if('dformat'in e&&e.dformat=='percent')v*=100} 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();if('dformat'in e&&e.dformat=='percent')v*=100} return this.optional(el)||v<=p}}},val:function(raw){raw=raw||!1;var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length){var v=e.val();if(raw)return($.isNumeric(v))?v:$.fbuilder.parseValStr(v,raw);v=$.trim(v);v=v.replace(new RegExp($.fbuilder.escapeSymbol(this.currencySymbol),'g'),'').replace(new RegExp($.fbuilder.escapeSymbol(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:!1,required:!1,readonly:!1,size:"small",thousandSeparator:"",decimalSymbol:".",min:"",max:"",formatDynamically:!1,dformat:"digits",set_step:function(v,rmv){var e=$('[id="'+this.name+'"]');if(rmv)e.removeAttr('step');else{var vb=e.val();e.removeAttr('value');e.attr('step',v);e.val(vb)} e.valid()},set_min:function(v,rmv){var e=$('[id="'+this.name+'"]');if(rmv)e.removeAttr('min');else e.attr('min',v);e.valid()},set_max:function(v,rmv){var e=$('[id="'+this.name+'"]');if(rmv)e.removeAttr('max');else e.attr('max',v);e.valid()},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)+((this.dformat=='percent')?'%':'')}else{return value}},init:function(){if(!/^\s*$/.test(this.min))this._setHndl('min');if(!/^\s*$/.test(this.max))this._setHndl('max')},show:function(){var _type=(this.dformat=='digits'||(this.dformat!='percent'&&/^$/.test(this.thousandSeparator)&&/^\s*(\.\s*)?$/.test(this.decimalSymbol)))?'number':'text';this.predefined=this._getAttr('predefined');return'
'+this.userhelp+'
'},after_show:function(){var me=this;if((me.formatDynamically&&me.dformat!='digits')||me.dformat=='percent'){$(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.escapeSymbol,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*\\%?\\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();if('dformat'in e&&e.dformat=='percent')v*=100} 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();if('dformat'in e&&e.dformat=='percent')v*=100} return this.optional(el)||v<=p}}},val:function(raw){raw=raw||!1;var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length){var v=$.trim(e.val());if(raw)return($.isNumeric(v)&&this.thousandSeparator!='.')?v:$.fbuilder.parseValStr(v,raw);v=$.fbuilder.parseVal(v,this.thousandSeparator,this.decimalSymbol);return(this.dformat=='percent')?v/100:v} return 0}});$.fbuilder.controls.fslider=function(){};$.extend($.fbuilder.controls.fslider.prototype,$.fbuilder.controls.ffields.prototype,{title:"Slider",ftype:"fslider",exclude:!1,readonly:!1,predefined:"",predefinedMin:"",predefinedMax:"",predefinedClick:!1,size:"small",thousandSeparator:",",centSeparator:".",typeValues:!1,min:0,max:100,step:1,range:!1,minCaption:"",maxCaption:"",caption:"{0}",_setThousandsSeparator:function(v){v=$.fbuilder.parseVal(v,this.thousandSeparator,this.centSeparator);if(!isNaN(v)){v=v.toString();var parts=v.toString().split("."),counter=0,str='';for(var i=parts[0].length-1;i>=0;i--){counter++;str=parts[0][i]+str;if(counter%3==0&&i!=0)str=this.thousandSeparator+str} parts[0]=str;if(typeof parts[1]!='undefined'&&parts[1].length==1){parts[1]+='0'} return parts.join(this.centSeparator)}else{return v}},_setFieldValue:function(nochange){var me=this;if(me.range){var values=$('#'+me.name+'_slider').slider('values'),vl=values[0],vr=values[1],vlf=me._setThousandsSeparator(vl),vrf=me._setThousandsSeparator(vr);$('#'+me.name+'_component_left').val(vlf);$('#'+me.name+'_component_right').val(vrf);$('#'+me.name).val('['+vl+','+vr+']').attr('vt','['+vlf+','+vrf+']');$('#'+me.name+'_caption').html(me.caption.replace(/\{\s*0\s*\}/,vlf).replace(/\{\s*0\s*\}/,vrf))}else{var v=$('#'+me.name+'_slider').slider('value'),vf=me._setThousandsSeparator(v);$('#'+me.name).val(v).attr('vt',vf);$('#'+me.name+'_component_center').val(vf);$('#'+me.name+'_caption').html(me.caption.replace(/\{\s*0\s*\}/,vf))} if(!nochange)$('#'+me.name).change()},_toNumber:function(n){return(new String(n)).replace(/[^\d\.]/g,'')*1},init:function(){this.min=(/^\s*$/.test(this.min))?0:$.trim(this.min);this.max=(/^\s*$/.test(this.max))?100:$.trim(this.max);this.step=(/^\s*$/.test(this.step))?1:$.trim(this.step);this.predefinedMin=(/^\s*$/.test(this.predefinedMin))?this.min:this._toNumber(this.predefinedMin);this.predefinedMax=(/^\s*$/.test(this.predefinedMax))?this.max:this._toNumber(this.predefinedMax);this._setHndl('min');this._setHndl('max');this._setHndl('step');this.centSeparator=(/^\s*$/.test(this.centSeparator))?'.':$.trim(this.centSeparator)},show:function(){var me=this;function typeValuesComponents(){function component(c){var min=$.fbuilder.htmlEncode(me.min),max=$.fbuilder.htmlEncode(me.max),step=$.fbuilder.htmlEncode(me.step),predefined=$.fbuilder.htmlEncode((c=='left')?me.predefinedMin:((c=='right')?me.predefinedMax:me.predefined)),timeoutId;$(document).on('keyup change','#'+me.name+'_component_'+c,function(evt){var v=$('#'+me.name+'_component_center').val(),v1=$('#'+me.name+'_component_left').val(),v2=$('#'+me.name+'_component_right').val(),t=0;clearTimeout(timeoutId);if(evt.type=='keyup')t=2000;timeoutId=setTimeout(function(){if(v!=undefined){v=$.fbuilder.parseVal(v,this.thousandSeparator,this.centSeparator);if(isNaN(v))v=0} if(v1!=undefined){v1=$.fbuilder.parseVal(v1,this.thousandSeparator,this.centSeparator);if(isNaN(v1))v1=0} if(v2!=undefined){v2=$.fbuilder.parseVal(v2,this.thousandSeparator,this.centSeparator);if(isNaN(v2))v2=0} $('#'+me.name+'_slider').slider(((v!=undefined)?'value':'values'),((v!=undefined)?v*1:[Math.min(v1*1,v2*1),Math.max(v1*1,v2*1)]));me._setFieldValue()},t)});return'
'};var str='';if(me.typeValues) str+='
'+((me.range)?component('left')+component('right'):component('center'))+'
';return str};me.predefined=(/^\s*$/.test(me.predefined))?me.min:me._toNumber(me._getAttr('predefined'));return'
'+''+'
'+typeValuesComponents()+''+'
'+'
'+''+me.minCaption+''+''+me.maxCaption+''+'
'+'
'+'
'+''+me.userhelp+''+'
'+'
'+'
'},set_min:function(v,ignore){try{var e=$('[id="'+this.name+'_slider"]'),c=this.val(),r=!1;if(ignore)v=0;e.slider('option','min',v);if($.isArray(c)){if(c[0]
'+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!0}});$('#'+this.name).rules('add',{'pattern':this.regExp,messages:{'pattern':this.regExpMssg}})}},val:function(raw){raw=raw||!1;var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length)return $.fbuilder.parseValStr(e.val(),raw);return 0}});$.fbuilder.controls.fdate=function(){};$.extend($.fbuilder.controls.fdate.prototype,$.fbuilder.controls.ffields.prototype,{title:"Date",ftype:"fdate",predefined:"",predefinedClick:!1,size:"medium",required:!1,showDatepicker:!0,dformat:"mm/dd/yyyy",dseparator:"/",showDropdown:!1,dropdownRange:"-10:+10",invalidDates:"",working_dates:[!0,!0,!0,!0,!0,!0,!0],minDate:"",maxDate:"",defaultDate:"",showTimepicker:!1,tformat:"24",minHour:0,maxHour:23,minMinute:0,maxMinute:59,stepHour:1,stepMinute:1,defaultTime:"",ariaHourLabel:'hours',ariaMinuteLabel:'minutes',ariaAMPMLabel:'am or pm',_get_regexp:function(){var me=this,df=me.dformat.replace(new RegExp('\\'+me.dseparator,'g'),'/'),rt;if(/^y/i.test(df))rt='(\\d{4})[^\\d](\\d{1,2})[^\\d](\\d{1,2})';else rt='(\\d{1,2})[\\/\\-\\.](\\d{1,2})[\\/\\-\\.](\\d{4})';return{d:df,r:rt}},_set_Events:function(){var me=this,f=function(){$('#'+me.name+'_date').valid();me.set_dateTime()};$(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.set_DefaultDate(!0);me.set_DefaultTime();me.set_dateTime()},500)})},_validateDate:function(d){try{var e=this,w=e.working_dates,i=e.invalidDates,n=$('#'+e.name+'_date');d=d||n.datepicker('getDate');if(d===null||!w[d.getDay()])return!1;if(i!==null){for(var j=0,h=i.length;j'+h+'';i++} return':'},get_minutes:function(){var me=this,str='',i=0,m,n=(me.minHour==me.maxHour)?me.minMinute:0,x=(me.minHour==me.maxHour)?me.maxMinute:59;while((m=n+me.stepMinute*i)<=x){if(m<10)m='0'+''+m;str+='';i++} return''},get_ampm:function(){var str='';if(this.tformat==12){return''} return str},set_dateTime:function(nochange){var me=this,str=$('#'+me.name+'_date').val();if(me.showTimepicker){str+=' '+$('#'+me.name+'_hours').val();str+=':'+$('#'+me.name+'_minutes').val();if($('#'+me.name+'_ampm').length)str+=$('#'+me.name+'_ampm').val()} if(!nochange)$('#'+me.name).val(str).change()},set_minDate:function(v,ignore){var e=$('[id*="'+this.name+'"].hasDatepicker');if(e.length){e.datepicker('option','minDate',(ignore)?null:v);e.change()}},set_maxDate:function(v,ignore){var e=$('[id*="'+this.name+'"].hasDatepicker');if(e.length){e.datepicker('option','maxDate',(ignore)?null:v);e.change()}},set_DefaultDate:function(init){var me=this,p={dateFormat:me.dformat.replace(/yyyy/g,"yy"),minDate:me._getAttr('minDate'),maxDate:me._getAttr('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)p=$.extend(p,{changeMonth:!0,changeYear:!0,yearRange:me.dropdownRange});p=$.extend(p,{beforeShowDay:function(d){return[me._validateDate(d),""]}});if(me.defaultDate!="")p.defaultDate=me.defaultDate;dp.datepicker(p);if(!me.predefinedClick||!!init==!1)dp.datepicker("setDate",dd);if(!me._validateDate())dp.datepicker("setDate",'')},set_DefaultTime:function(){var me=this,_setValue=function(f,v,m){v=Math.min(v*1,m*1);v=(v<10)?0+''+v:v;$('#'+f+' [value="'+v+'"]').prop('selected',!0)};if(me.showTimepicker){var parts,time={},tmp=0,max_minutes=59;if((parts=/(\d{1,2}):(\d{1,2})\s*([ap]m)?/gi.exec(me.defaultTime))!=null){time.hour=parts[1]*1+((parts.length==4&&/pm/i.test(parts[3])&&parts[1]!=12)?12:0);time.minute=parts[2]}else{var d=new Date();time.hour=d.getHours();time.minute=d.getMinutes()} time.hour=Math.min(Math.max(time.hour,me.minHour),me.maxHour);if(time.hour<=me.minHour)time.minute=Math.max(time.minute,me.minMinute);if(me.maxHour<=time.hour)time.minute=Math.min(time.minute,me.maxMinute);_setValue(me.name+'_hours',(me.tformat==12)?((time.hour>12)?time.hour-12:((time.hour==0)?12:time.hour)):time.hour,(me.tformat==12)?12:me.maxHour);_setValue(me.name+'_minutes',time.minute,(time.hour==me.maxHour)?me.maxMinute:59);$('#'+me.name+'_ampm'+' [value="'+((time.hour<12)?'am':'pm')+'"]').prop('selected',!0)}},show:function(){var me=this,n=me.name,attr='value',format_label=[],date_tag_type='text',disabled='',date_tag_class='field date'+me.dformat.replace(/[^a-z]/ig,"")+' '+me.size+((me.required&&me.showDatepicker)?' required':'');if(me.predefinedClick)attr='placeholder';if(me.showDatepicker)format_label.push(me.dformat);else{date_tag_type='hidden';disabled='disabled'} if(me.showTimepicker)format_label.push('HH:mm');this.predefined=this._getAttr('predefined');return'
'+((me.showTimepicker)?' '+me.get_hours()+me.get_minutes()+' '+me.get_ampm():'')+''+me.userhelp+'
'},after_show:function(){var me=this,date_format='date'+me.dformat.replace(/[^a-z]/ig,""),validator=function(v,e){try {var p=e.name.replace('_date','').split('_'),i=$.fbuilder.forms['_'+p[1]].getItem(p[0]),o=me._get_regexp();if(i!=null)return this.optional(e)||(i._validateDate()&&(new RegExp(o.r)).test(v)&&i._validateTime());return!0}catch(er){return!1}};if(!(date_format in $.validator.methods))$.validator.addMethod(date_format,validator);me.set_DefaultDate(!0);me.set_DefaultTime();me._set_Events();me.set_dateTime()},val:function(raw){raw=raw||!1;var me=this,e=$('[id="'+me.name+'"]:not(.ignore)'),o=me._get_regexp();if(e.length){var v=e.val();if(raw)return $.fbuilder.parseValStr(v,raw);v=$.trim(e.val());var re=new RegExp('('+o.r+')?(\\s*(\\d{1,2})[:\\.](\\d{1,2})\\s*([amp]{2})?)?'),d=re.exec(v),h=0,m=0,date;if(d){if(typeof d[6]!='undefined')h=d[6]*1;if(typeof d[7]!='undefined')m=d[7]*1;if(typeof d[8]!='undefined'){var am=d[8].toLowerCase();if(am=='pm'&&h<12)h+=12;if(am=='am'&&h==12)h-=12} switch(o.d){case'yyyy/dd/mm':date=new Date(d[2],(d[4]*1-1),d[3],h,m,0,0);break;case'yyyy/mm/dd':date=new Date(d[2],(d[3]*1-1),d[4],h,m,0,0);break;case'dd/mm/yyyy':date=new Date(d[4],(d[3]*1-1),d[2],h,m,0,0);break;case'mm/dd/yyyy':date=new Date(d[4],(d[2]*1-1),d[3],h,m,0,0);break} if(isFinite(date)){if(me.showTimepicker)return date.valueOf()/86400000;else return Math.ceil(date.valueOf()/86400000)}else if(!me.showDatepicker&&me.showTimepicker) return(h*3600000+m*60000)/86400000}} return 0},setVal:function(v,nochange){try {v=$.trim(v).replace(/\s+/g,' ').split(' ');if(this.showDatepicker){this.defaultDate=v[0];this.set_DefaultDate()} if(this.showTimepicker){var t=(v.length==2)?v[1]:((!this.showDatepicker)?v[0]:!1);if(t!==!1){this.defaultTime=t;this.set_DefaultTime()}} this.set_dateTime(nochange)}catch(err){}}});$.fbuilder.controls.ftextarea=function(){};$.extend($.fbuilder.controls.ftextarea.prototype,$.fbuilder.controls.ffields.prototype,{title:"Untitled",ftype:"ftextarea",predefined:"",predefinedClick:!1,required:!1,readonly:!1,size:"medium",minlength:"",maxlength:"",rows:4,show:function(){this.minlength=$.fbuilder.htmlEncode($.trim(this.minlength));this.maxlength=$.fbuilder.htmlEncode($.trim(this.maxlength));this.predefined=this._getAttr('predefined');return'
'+this.userhelp+'
'},val:function(raw){raw=raw||!1;var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length)return $.fbuilder.parseValStr(e.val().replace(/[\n\r]+/g,' '),raw);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:!1,merge:1,max:-1,maxError:"Check no more than {0} boxes",toSubmit:"text",showDep:!1,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',!1)});if(e.data('previous-status')){m.checked=!1;e.change()} e.data('previous-status',m.checked)})}},showHideDep:function(toShow,toHide,hiddenByContainer){var me=this,item=$('input[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';str+='';op_o=!0}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._patch)?'':'')+''+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!0;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;i');for(var i=0;i');img.attr('src',e.target.result).css('maxWidth','100%');if(me.thumb_height!='')img.attr('height',me.thumb_height);if(me.thumb_width!='')img.attr('width',me.thumb_width);filesContainer.append($(''+(n?', ':'')+'').append(img));n++};reader.readAsDataURL(file)}else if(1').text((n?', ':'')+file.name));n++}})(i,this.files[i])} $(this).after(filesContainer)}})},val:function(){var e=$("[id='"+this.name+"']:not(.ignore)");if(e.length)return e[0].files;return''}});$.fbuilder.controls.fpassword=function(){};$.extend($.fbuilder.controls.fpassword.prototype,$.fbuilder.controls.ffields.prototype,{title:"Untitled",ftype:"fpassword",predefined:"",predefinedClick:!1,required:!1,size:"medium",minlength:"",maxlength:"",equalTo:"",regExp:"",regExpMssg:"",show:function(){this.minlength=$.fbuilder.htmlEncode($.trim(this.minlength));this.maxlength=$.fbuilder.htmlEncode($.trim(this.maxlength));this.equalTo=$.fbuilder.htmlEncode($.trim(this.equalTo));this.predefined=this._getAttr('predefined');return'
'+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!0}});$('#'+this.name).rules('add',{'pattern':this.regExp,messages:{'pattern':this.regExpMssg}})}},val:function(raw){raw=raw||!1;var e=$('[id="'+this.name+'"]:not(.ignore)');if(e.length)return $.fbuilder.parseValStr(e.val(),raw);return 0}});$.fbuilder.controls.fPhone=function(){};$.extend($.fbuilder.controls.fPhone.prototype,$.fbuilder.controls.ffields.prototype,{title:"Phone",ftype:"fPhone",required:!1,readonly:!1,dformat:"### ### ####",predefined:"888 888 8888",show:function(){this.predefined=new String(this._getAttr('predefined',!0));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!0;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(){this.predefined=this._getAttr('predefined');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:"",exclude_empty:!1,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&&!this.rearrange)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(){var me=this;$.fbuilder.controls.fcontainer.prototype.after_show.call(this);if(me.collapsible)$('.'+me.name+'>fieldset>legend').bind('click',function(){$(this).closest('.cff-collapsible').toggleClass('cff-collapsed')})},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,rearrange:0,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:"",sHideDownload:0},video:{sWidth:"",sHeight:"",sSrc:"",sSrcAlt:"",sPoster:"",sControls:1,sLoop:0,sAutoplay:0,sMuted:0,sPreload:"auto",sFallback:"",sFigcaption:"",sHideDownload:0}},_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=[],s=[],t=(isV)?'video':'audio';if($.trim(d.sWidth))s.push('width:'+esc(d.sWidth)+';');if(isV&&$.trim(d.sHeight))s.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');if(d.sHideDownload)a.push('controlsList="nodownload"');a.push('preload="'+esc(d.sPreload)+'"');return'<'+t+' '+a.join(' ')+' style="'+s.join(' ')+'">'+(($.trim(d.sSrcAlt))?'':'')+'

'+d.sFallback+'

'},_show_audio:function(){return this._show_audio_video(this.data.audio,!1)},_show_video:function(){return this._show_audio_video(this.data.video,!0)},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",sLoading:!1,sOnclick:"",sOnmousedown:"",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(){var me=this;$('#'+this.name).mousedown(function(){eval(me.sOnmousedown)});$('#'+this.name).click(function(){var e=$(this),f;if(e.hasClass('calculate-button')){var items=$.fbuilder.forms[me.form_identifier].getItems();if(me.sLoading){f=e.closest('#fbuilder');f.find('.cff-processing-form').remove();$('
').appendTo(f)} $(document).on('equationsQueueEmpty',function(evt,id){if(id==me.form_identifier){if(me.sLoading)e.closest('#fbuilder').find('.cff-processing-form').remove();$(document).off('equationsQueueEmpty');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)} eval(me.sOnclick)})}});$.fbuilder.controls.fhtml=function(){};$.extend($.fbuilder.controls.fhtml.prototype,$.fbuilder.controls.ffields.prototype,{ftype:"fhtml",fcontent:"",show:function(){var content=this.fcontent;content=content.replace(/\(\s*document\s*\)\.one\(\s*['"]showHideDepEvent['"]/ig,'(window).one("showHideDepEvent"');return'
'+content+'
'}});$.fbuilder.controls.facceptance=function(){};$.extend($.fbuilder.controls.facceptance.prototype,$.fbuilder.controls.ffields.prototype,{title:"Accept terms and conditions",ftype:"facceptance",value:"I accept",required:!0,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(raw){raw=raw||!1;var e=$('[id="'+this.name+'"]:checked:not(.ignore)');if(e.length){var t=$.fbuilder.parseValStr(e[0].value,raw);if(!$.isNumeric(t))t=t.replace(/^"/,'').replace(/"$/,'')} return(t)?(($.isNumeric(t))?t:'"'+t+'"'):0}});$.fbuilder.controls.fCalculated=function(){};$.extend($.fbuilder.controls.fCalculated.prototype,$.fbuilder.controls.ffields.prototype,{title:"Untitled",ftype:"fCalculated",predefined:"",required:!1,size:"medium",eq:"",suffix:"",prefix:"",decimalsymbol:".",groupingsymbol:"",dependencies:[{'rule':'','complex':!1,'fields':['']}],readonly:!0,currency:!1,noEvalIfManual:!0,formatDynamically:!1,hidefield:!1,show:function(){this.predefined=this._getAttr('predefined');return'
'+((!this.hidefield)?''+this.userhelp+'':'')+'
'},after_show:function(){var me=this,configuration={"suffix":me.suffix,"prefix":me.prefix,"groupingsymbol":me.groupingsymbol,"decimalsymbol":me.decimalsymbol,"currency":me.currency},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+'"]');if(me.readonly==!1&&me.noEvalIfManual)e.bind('keyup',function(){e.data('manually',1)});e.bind('calcualtedfield_changed',{obj:me},function(evt){if($.fbuilder.calculator.getDepList(evt.data.obj.name,{value:evt.data.obj.val(),raw:evt.data.obj.val(!0)},evt.data.obj.dependencies)){$.fbuilder.showHideDep({'formIdentifier':evt.data.obj.form_identifier,'fieldIdentifier':evt.data.obj.name})}}).on('keyup',function(){me.manual=!0}).on('change',function(){if('manual'in me&&me.manual&&me.formatDynamically){me.manual=!1;var v=me.val();this.value=$.fbuilder.calculator.format(v,configuration)}})},showHideDep:function(toShow,toHide,hiddenByContainer){var me=this,result=[];if($.fbuilder.calculator.getDepList(me.name,{value:me.val(),raw:me.val(!0)},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} if(!('decimalsymbol'in config))config.decimalsymbol='.';value=parts.join(config.decimalsymbol)} if(config.currency&&!isNumeric){delete config.prefix;delete config.suffix} if(config.prefix){if(!config.currency){value=symbol+value;symbol=''} value=config.prefix+value} if(config.suffix)value+=config.suffix;value=symbol+value} return value},unformat:function(field){var escapeSymbol=$.fbuilder.escapeSymbol;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.prop('tagName')=='INPUT'&&/(text|number|email|password)/.test(t.attr('type').toLowerCase())||t.prop('tagName')=='TEXTAREA')&&evt.type!='change')){return} obj.Calculate(t[0])}});$(document).on('showHideDepEvent',function(evt,form_identifier){var f,evalequations,first_time;if(form_identifier)f=$('#'+form_identifier);else f=$('[id*="cp_calculatedfieldsf_pform_"]:eq(0)');if(f.length){first_time=(typeof f.data('first_time')=='undefined');f.data('first_time',0);evalequations=f.data('evalequations');if(typeof evalequations=='undefined'||evalequations*1==1){if(first_time)obj.defaultCalc('#'+f.attr('id'));else obj.defaultCalc('#'+f.attr('id'),!0)}}});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,!0);$(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:!1};$.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=!0;return!0}catch(e){if(this.debug)_log('localStorage object is not available');is_available=!1;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];if(cp_calculatedfieldsf_fbuilder_config){var f=$("#fbuilder"+fnum).fbuilder((typeof cp_calculatedfieldsf_fbuilder_config.obj=='string')?$.parseJSON(cp_calculatedfieldsf_fbuilder_config.obj):cp_calculatedfieldsf_fbuilder_config.obj);f.fBuild.loadData("form_structure"+fnum);found_form=!0}}catch(e){if(typeof console!='undefined')console.log(e)} fcount++;fnum="_"+fcount}})(fbuilderjQuery);if(found_form)fbuilderjQuery.fbuilderGeneratorFlag=1};fbuilderjQuery(fbuilderjQuery.fbuilderjQueryGenerator);fbuilderjQuery(window).on('load',fbuilderjQuery.fbuilderjQueryGenerator)