function gformBindFormatPricingFields(){jQuery(".ginput_amount, .ginput_donation_amount").off("change.gform").on("change.gform",function(){gformFormatPricingField(this)}),jQuery(".ginput_amount, .ginput_donation_amount").each(function(){gformFormatPricingField(this)})}function Currency(e){this.currency=e,this.toNumber=function(e){return this.isNumeric(e)?parseFloat(e):gformCleanNumber(e,this.currency.symbol_right,this.currency.symbol_left,this.currency.decimal_separator)},this.toMoney=function(e,r){if((r=r||!1)||(e=gformCleanNumber(e,this.currency.symbol_right,this.currency.symbol_left,this.currency.decimal_separator)),!1===e)return"";"-"==(e+=negative="")[0]&&(e=parseFloat(e.substr(1)),negative="-"),money=this.numberFormat(e,this.currency.decimals,this.currency.decimal_separator,this.currency.thousand_separator),"0.00"==money&&(negative="");var t=this.currency.symbol_left?this.currency.symbol_left+this.currency.symbol_padding:"",i=this.currency.symbol_right?this.currency.symbol_padding+this.currency.symbol_right:"";return money=negative+this.htmlDecode(t)+money+this.htmlDecode(i),money},this.numberFormat=function(e,r,t,i,n){n=void 0===n||n,e=(e+"").replace(",","").replace(" ","");var a,o,l,f=isFinite(+e)?+e:0,s=isFinite(+r)?Math.abs(r):0,d=void 0===i?",":i,c=void 0===t?".":t,u="";return 3<(u="0"==r?(f+=1e-10,(""+Math.round(f)).split(".")):-1==r?(""+f).split("."):(a=f+=1e-10,o=s,l=Math.pow(10,o),(""+Math.round(a*l)/l).split(".")))[0].length&&(u[0]=u[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,d)),n&&(u[1]||"").length<s&&(u[1]=u[1]||"",u[1]+=new Array(s-u[1].length+1).join("0")),u.join(c)},this.isNumeric=function(e){return gformIsNumber(e)},this.htmlDecode=function(e){var r,t,i=e,n=i.match(/&#[0-9]{1,5};/g);if(null!=n)for(var a=0;a<n.length;a++)i=-32768<=(r=(t=n[a]).substring(2,t.length-1))&&r<=65535?i.replace(t,String.fromCharCode(r)):i.replace(t,"");return i}}function gformCleanNumber(e,r,t,i){var n="",a="",o="",l=!1;e=(e=(e=(e+=" ").replace(/&.*?;/g,"")).replace(r,"")).replace(t,"");for(var f=0;f<e.length;f++)o=e.substr(f,1),0<=parseInt(o,10)&&parseInt(o,10)<=9||o==i?n+=o:"-"==o&&(l=!0);for(f=0;f<n.length;f++)"0"<=(o=n.substr(f,1))&&o<="9"?a+=o:o==i&&(a+=".");return l&&(a="-"+a),!!gformIsNumber(a)&&parseFloat(a)}function gformGetDecimalSeparator(e){var r;switch(e){case"currency":r=new Currency(gf_global.gf_currency_config).currency.decimal_separator;break;case"decimal_comma":r=",";break;default:r="."}return r}function gformIsNumber(e){return!isNaN(parseFloat(e))&&isFinite(e)}function gformIsNumeric(e,r){switch(r){case"decimal_dot":return new RegExp("^(-?[0-9]{1,3}(?:,?[0-9]{3})*(?:.[0-9]+)?)$").test(e);case"decimal_comma":return new RegExp("^(-?[0-9]{1,3}(?:.?[0-9]{3})*(?:,[0-9]+)?)$").test(e)}return!1}function gformDeleteUploadedFile(e,r,t){var i=jQuery("#field_"+e+"_"+r),n=jQuery(t).parent().index();i.find(".ginput_preview").eq(n).remove(),i.find('input[type="file"],.validation_message,#extensions_message_'+e+"_"+r).removeClass("gform_hidden"),i.find(".ginput_post_image_file").show(),i.find('input[type="text"]').val("");var a=jQuery("#gform_uploaded_files_"+e).val();if(a){var o=jQuery.secureEvalJSON(a);if(o){var l="input_"+r,f=i.find("#gform_multifile_upload_"+e+"_"+r);if(0<f.length){o[l].splice(n,1);var s=f.data("settings"),d=s.gf_vars.max_files;jQuery("#"+s.gf_vars.message_id).html(""),o[l].length<d&&gfMultiFileUploader.toggleDisabled(s,!1)}else o[l]=null;jQuery("#gform_uploaded_files_"+e).val(jQuery.toJSON(o))}}}void 0===jQuery.fn.prop&&(jQuery.fn.prop=jQuery.fn.attr),jQuery(document).ready(function(){jQuery(document).bind("gform_post_render",gformBindFormatPricingFields)});var _gformPriceFields=new Array,_anyProductSelected;function gformIsHidden(e){return"none"==e.parents(".gfield").not(".gfield_hidden_product").css("display")}function gformCalculateTotalPrice(e){if(_gformPriceFields[e]){var r=0;_anyProductSelected=!1;for(var t=0;t<_gformPriceFields[e].length;t++)r+=gformCalculateProductPrice(e,_gformPriceFields[e][t]);if(_anyProductSelected)r+=gformGetShippingPrice(e);window.gform_product_total&&(r=window.gform_product_total(e,r)),r=gform.applyFilters("gform_product_total",r,e);var i=jQuery(".ginput_total_"+e);if(0<i.length){var n=i.next().val(),a=gformFormatMoney(r,!0);n!=r&&i.next().val(r).change(),a!=i.first().text()&&i.html(a)}}}function gformGetShippingPrice(e){var r=jQuery(".gfield_shipping_"+e+' input[type="hidden"], .gfield_shipping_'+e+" select, .gfield_shipping_"+e+" input:checked"),t=0;return 1!=r.length||gformIsHidden(r)||(t=r.attr("type")&&"hidden"==r.attr("type").toLowerCase()?r.val():gformGetPrice(r.val())),gformToNumber(t)}function gformGetFieldId(e){var r=jQuery(e).attr("id").split("_");return r.length<=0?0:r[r.length-1]}function gformCalculateProductPrice(o,e){var r="_"+o+"_"+e;jQuery(".gfield_option"+r+", .gfield_shipping_"+o).find("select").each(function(){var e=jQuery(this),t=gformGetPrice(e.val()),i=e.attr("id").split("_")[2];e.children("option").each(function(){var e=jQuery(this),r=gformGetOptionLabel(e,e.val(),t,o,i);e.html(r)})}),jQuery(".gfield_option"+r).find(".gfield_checkbox").find("input:checkbox").each(function(){var e=jQuery(this),r=e.attr("id"),t=r.split("_")[2],i=r.replace("choice_","#label_"),n=jQuery(i),a=gformGetOptionLabel(n,e.val(),0,o,t);n.html(a)}),jQuery(".gfield_option"+r+", .gfield_shipping_"+o).find(".gfield_radio").each(function(){var n=0,e=jQuery(this),a=e.attr("id").split("_")[2],r=e.find("input:radio:checked").val();r&&(n=gformGetPrice(r)),e.find("input:radio").each(function(){var e=jQuery(this),r=e.attr("id").replace("choice_","#label_"),t=jQuery(r);if(t){var i=gformGetOptionLabel(t,e.val(),n,o,a);t.html(i)}})});var t=gformGetBasePrice(o,e),i=gformGetProductQuantity(o,e);return 0<i&&(jQuery(".gfield_option"+r).find("input:checked, select").each(function(){gformIsHidden(jQuery(this))||(t+=gformGetPrice(jQuery(this).val()))}),_anyProductSelected=!0),t=gformRoundPrice(t*=i)}function gformGetProductQuantity(e,r){if(!gformIsProductSelected(e,r))return 0;var t,i,n=jQuery("#ginput_quantity_"+e+"_"+r);if(gformIsHidden(n))return 0;0<n.length?t=n.val():(t=1,0<(n=jQuery(".gfield_quantity_"+e+"_"+r+" :input")).length&&(t=n.val(),i=gf_get_field_number_format(gf_get_input_id_by_html_id(n.attr("id")),e,"value")));return t=(t=gformCleanNumber(t,"","",gformGetDecimalSeparator(i=i||"currency")))||0}function gformIsProductSelected(e,r){var t="_"+e+"_"+r,i=jQuery("#ginput_base_price"+t+", .gfield_donation"+t+' input[type="text"], .gfield_product'+t+" .ginput_amount");return!(!i.val()||gformIsHidden(i))||!(!(i=jQuery(".gfield_product"+t+" select, .gfield_product"+t+" input:checked, .gfield_donation"+t+" select, .gfield_donation"+t+" input:checked")).val()||gformIsHidden(i))}function gformGetBasePrice(e,r){var t="_"+e+"_"+r,i=0,n=jQuery("#ginput_base_price"+t+", .gfield_donation"+t+' input[type="text"], .gfield_product'+t+" .ginput_amount");if(0<n.length)i=n.val(),gformIsHidden(n)&&(i=0);else{var a=(n=jQuery(".gfield_product"+t+" select, .gfield_product"+t+" input:checked, .gfield_donation"+t+" select, .gfield_donation"+t+" input:checked")).val();a&&(i=1<(a=a.split("|")).length?a[1]:0),gformIsHidden(n)&&(i=0)}return!1===(i=new Currency(gf_global.gf_currency_config).toNumber(i))?0:i}function gformFormatMoney(e,r){return gf_global.gf_currency_config?new Currency(gf_global.gf_currency_config).toMoney(e,r):e}function gformFormatPricingField(e){if(gf_global.gf_currency_config){var r=new Currency(gf_global.gf_currency_config).toMoney(jQuery(e).val());jQuery(e).val(r)}}function gformToNumber(e){return new Currency(gf_global.gf_currency_config).toNumber(e)}function gformGetPriceDifference(e,r){var t=parseFloat(r)-parseFloat(e);return price=gformFormatMoney(t,!0),0<t&&(price="+"+price),price}function gformGetOptionLabel(e,r,t,i,n){e=jQuery(e);var a=gformGetPrice(r),o=e.attr("price"),l=e.html().replace(/<span(.*)<\/span>/i,"").replace(o,""),f=gformGetPriceDifference(t,a);f=0==gformToNumber(f)?"":" "+f,e.attr("price",f);var s="option"==e[0].tagName.toLowerCase()?" "+f:"<span class='ginput_price'>"+f+"</span>",d=l+s;return window.gform_format_option_label&&(d=gform_format_option_label(d,l,s,t,a,i,n)),d}function gformGetProductIds(e,r){for(var t=jQuery(r).hasClass(e)?jQuery(r).attr("class").split(" "):jQuery(r).parents("."+e).attr("class").split(" "),i=0;i<t.length;i++)if(t[i].substr(0,e.length)==e&&t[i]!=e)return{formId:t[i].split("_")[2],productFieldId:t[i].split("_")[3]};return{formId:0,fieldId:0}}function gformGetPrice(e){var r=e.split("|"),t=new Currency(gf_global.gf_currency_config);return 1<r.length&&!1!==t.toNumber(r[1])?t.toNumber(r[1]):0}function gformRoundPrice(e){var r=new Currency(gf_global.gf_currency_config),t=r.numberFormat(e,r.currency.decimals,".","");return parseFloat(t)}function gformRegisterPriceField(e){_gformPriceFields[e.formId]||(_gformPriceFields[e.formId]=new Array);for(var r=0;r<_gformPriceFields[e.formId].length;r++)if(_gformPriceFields[e.formId][r]==e.productFieldId)return;_gformPriceFields[e.formId].push(e.productFieldId)}function gformInitPriceFields(){for(formId in jQuery(".gfield_price").each(function(){gformRegisterPriceField(gformGetProductIds("gfield_price",this)),jQuery(this).on("change",'input[type="text"], input[type="number"], select',function(){var e=gformGetProductIds("gfield_price",this);0==e.formId&&(e=gformGetProductIds("gfield_shipping",this)),jQuery(document).trigger("gform_price_change",[e,this]),gformCalculateTotalPrice(e.formId)}),jQuery(this).on("click",'input[type="radio"], input[type="checkbox"]',function(){var e=gformGetProductIds("gfield_price",this);0==e.formId&&(e=gformGetProductIds("gfield_shipping",this)),jQuery(document).trigger("gform_price_change",[e,this]),gformCalculateTotalPrice(e.formId)})}),_gformPriceFields)_gformPriceFields.hasOwnProperty(formId)&&gformCalculateTotalPrice(formId)}function gformShowPasswordStrength(e){var r=gformPasswordStrength(document.getElementById(e).value,document.getElementById(e+"_2")?document.getElementById(e+"_2").value:""),t=window.gf_text["password_"+r],i="unknown"===r?"blank":r;jQuery("#"+e+"_strength").val(r),jQuery("#"+e+"_strength_indicator").removeClass("blank mismatch short good bad strong").addClass(i).html(t)}function gformPasswordStrength(e,r){if(e.length<=0)return"blank";switch(wp.passwordStrength.meter(e,wp.passwordStrength.userInputBlacklist(),r)){case-1:return"unknown";case 2:return"bad";case 3:return"good";case 4:return"strong";case 5:return"mismatch";default:return"short"}}function gformToggleShowPassword(e){var r=jQuery("#"+e),t=r.parent().find("button"),i=t.find("span");switch(r.attr("type")){case"password":r.attr("type","text"),t.attr("label",t.attr("data-label-hide")),i.removeClass("dashicons-hidden").addClass("dashicons-visibility");break;case"text":r.attr("type","password"),t.attr("label",t.attr("data-label-show")),i.removeClass("dashicons-visibility").addClass("dashicons-hidden")}}function gformToggleCheckboxes(e){var r=jQuery(e).parent(),t=r.find("label"),i=r.parent().find("li:not( .gchoice_select_all )"),n=gf_get_form_id_by_html_id(r.parents(".gfield").attr("id")),a=rgars(window,"gf_global/gfcalc/"+n);i.each(function(){jQuery('input[type="checkbox"]',this).prop("checked",e.checked).trigger("change"),"function"==typeof jQuery('input[type="checkbox"]',this)[0].onclick&&jQuery('input[type="checkbox"]',this)[0].onclick()}),e.checked?t.html(t.data("label-deselect")):t.html(t.data("label-select")),a&&a.runCalcs(n,a.formulaFields)}function gformAddListItem(e,r){var t=jQuery(e);if(!t.hasClass("gfield_icon_disabled")){var i=t.parents(".gfield_list_group"),n=i.clone(),a=i.parents(".gfield_list_container"),o=n.find(":input:last").attr("tabindex");n.find("input, select, textarea").attr("tabindex",o).not(":checkbox, :radio").val(""),n.find(":checkbox, :radio").prop("checked",!1),n=gform.applyFilters("gform_list_item_pre_add",n,i),i.after(n),gformToggleIcons(a,r),gformAdjustClasses(a),gform.doAction("gform_list_post_item_add",n,a)}}function gformDeleteListItem(e,r){var t=jQuery(e).parents(".gfield_list_group"),i=t.parents(".gfield_list_container");t.remove(),gformToggleIcons(i,r),gformAdjustClasses(i),gform.doAction("gform_list_post_item_delete",i)}function gformAdjustClasses(e){e.find(".gfield_list_group").each(function(e){var r=(e+1)%2==0?"gfield_list_row_even":"gfield_list_row_odd";jQuery(this).removeClass("gfield_list_row_odd gfield_list_row_even").addClass(r)})}function gformToggleIcons(e,r){var t=e.find(".gfield_list_group").length,i=e.find(".add_list_item");e.find(".delete_list_item").css("visibility",1==t?"hidden":"visible"),0<r&&r<=t?(i.data("title",e.find(".add_list_item").attr("title")),i.addClass("gfield_icon_disabled").attr("title","")):0<r&&(i.removeClass("gfield_icon_disabled"),i.data("title")&&i.attr("title",i.data("title")))}function gformAddRepeaterItem(e,r){var t=jQuery(e);if(!t.hasClass("gfield_icon_disabled")){var i=t.closest(".gfield_repeater_item"),n=i.clone(),a=i.closest(".gfield_repeater_container"),o=n.find(":input:last").attr("tabindex");n.find('input[type!="hidden"], select, textarea').attr("tabindex",o).not(":checkbox, :radio").val(""),n.find(":checkbox, :radio").prop("checked",!1),n.find(".validation_message").remove(),n=gform.applyFilters("gform_repeater_item_pre_add",n,i),i.after(n),n.children(".gfield_repeater_cell").each(function(){var e=jQuery(this).find(".gfield_repeater_container").first();0<e.length&&(resetContainerItems=function(e){e.children(".gfield_repeater_items").children(".gfield_repeater_item").each(function(e){jQuery(this).children(".gfield_repeater_cell").each(function(){var e=jQuery(this).find(".gfield_repeater_container").first();0<e.length&&resetContainerItems(e)})}),e.children(".gfield_repeater_items").children(".gfield_repeater_item").not(":first").remove()},resetContainerItems(e))}),gformResetRepeaterAttributes(a),"function"==typeof gformInitDatepicker&&(a.find(".ui-datepicker-trigger").remove(),a.find(".hasDatepicker").removeClass("hasDatepicker"),gformInitDatepicker()),gformBindFormatPricingFields(),gformToggleRepeaterButtons(a,r),gform.doAction("gform_repeater_post_item_add",n,a)}}function gformDeleteRepeaterItem(e,r){var t=jQuery(e).closest(".gfield_repeater_item"),i=t.closest(".gfield_repeater_container");t.remove(),gformResetRepeaterAttributes(i),gformToggleRepeaterButtons(i,r),gform.doAction("gform_repeater_post_item_delete",i)}function gformResetRepeaterAttributes(e,p,h){var y=null;void 0===p&&(p=0),void 0===h&&(h=0),e.children(".gfield_repeater_items").children(".gfield_repeater_item").each(function(){jQuery(this).children(".gfield_repeater_cell").each(function(){var m=jQuery(this),e=jQuery(this).find(".gfield_repeater_container").first();0<e.length?gformResetRepeaterAttributes(e,p+1,h):jQuery(this).find("input, select, textarea, :checkbox, :radio").each(function(){var e=jQuery(this),r=e.attr("name");if(void 0!==r){var t=/^(input_[^\[]*)((\[[0-9]+\])+)/.exec(r);if(t){t[1];for(var i=t[2],n=/\[([0-9]+)\]/g,a=[],o=n.exec(i);null!=o;)a.push(o[1]),o=n.exec(i);for(var l=t[1],f="",s=(a=a.reverse()).length-1;0<=s;s--)s==p?(l+="["+h+"]",f+="-"+h):(l+="["+a[s]+"]",f+="-"+a[s]);var d=e.attr("id"),c=m.find("label[for='"+d+"']");if(d){var u=d.match(/((choice|input)_[0-9|_]*)-/);u&&u[2]&&(f=u[1]+f,c.attr("for",f),e.attr("id",f))}var g=r.replace(t[0],l),_=jQuery('input[name="'+g+'"]').is(":checked");e.is(":radio")&&e.is(":checked")&&r!==g&&_&&(null!==y&&y.prop("checked",!0),e.prop("checked",!1),y=e),e.attr("name",g)}}})}),0===p&&h++}),null!==y&&(y.prop("checked",!0),y=null)}function gformToggleRepeaterButtons(e){var r=e.closest(".gfield_repeater_wrapper").data("max_items"),t=e.children(".gfield_repeater_items").children(".gfield_repeater_item").length,i=e.children(".gfield_repeater_items").children(".gfield_repeater_item").children(".gfield_repeater_buttons"),n=i.children(".add_repeater_item");i.children(".remove_repeater_item").css("visibility",1==t?"hidden":"visible"),0<r&&r<=t?(n.data("title",i.children(".add_repeater_item").attr("title")),n.addClass("gfield_icon_disabled").attr("title","")):0<r&&(n.removeClass("gfield_icon_disabled"),n.data("title")&&n.attr("title",n.data("title"))),e.children(".gfield_repeater_items").children(".gfield_repeater_item").children(".gfield_repeater_cell").each(function(e){var r=jQuery(this).find(".gfield_repeater_container").first();0<r.length&&gformToggleRepeaterButtons(r)})}function gformMatchCard(e){var r=gformFindCardType(jQuery("#"+e).val()),t=jQuery("#"+e).parents(".gfield").find(".gform_card_icon_container");r?(jQuery(t).find(".gform_card_icon").removeClass("gform_card_icon_selected").addClass("gform_card_icon_inactive"),jQuery(t).find(".gform_card_icon_"+r).removeClass("gform_card_icon_inactive").addClass("gform_card_icon_selected")):jQuery(t).find(".gform_card_icon").removeClass("gform_card_icon_selected gform_card_icon_inactive")}function gformFindCardType(e){if(e.length<4)return!1;var r=window.gf_cc_rules,t=new Array;for(type in r)if(r.hasOwnProperty(type))for(i in r[type])if(r[type].hasOwnProperty(i)&&0===r[type][i].indexOf(e.substring(0,r[type][i].length))){t[t.length]=type;break}return 1==t.length&&t[0].toLowerCase()}function gformToggleCreditCard(){jQuery("#gform_payment_method_creditcard").is(":checked")?jQuery(".gform_card_fields_container").slideDown():jQuery(".gform_card_fields_container").slideUp()}function gformInitChosenFields(e,t){return jQuery(e).each(function(){var e=jQuery(this);if("rtl"==jQuery("html").attr("dir")&&e.addClass("chosen-rtl chzn-rtl"),e.is(":visible")&&0==e.siblings(".chosen-container").length){var r=gform.applyFilters("gform_chosen_options",{no_results_text:t},e);e.chosen(r)}})}function gformInitCurrencyFormatFields(e){jQuery(e).each(function(){jQuery(this).val(gformFormatMoney(jQuery(this).val()))}).change(function(e){jQuery(this).val(gformFormatMoney(jQuery(this).val()))})}var GFMergeTag=function(){GFMergeTag.getMergeTagValue=function(e,r,t){void 0===t&&(t=""),t=t.replace(":","");var i,n=parseInt(r,10),a=jQuery("#field_"+e+"_"+n),o=n==r?'input[name^="input_'+n+'"]':'input[name="input_'+r+'"]',l=a.find(o+', select[name^="input_'+r+'"], textarea[name="input_'+r+'"]');if(!(!window.gf_check_field_rule||"show"==gf_check_field_rule(e,n,!0,"")))return"";a.find(".ginput_container_email").hasClass("ginput_complex")&&(l=l.first());var f=gform.applyFilters("gform_value_merge_tag_"+e+"_"+n,!1,l,t);if(!1!==f)return f;switch(f="",t){case"label":return a.find(".gfield_label").text();case"qty":if(a.hasClass("gfield_price"))return!1===(i=gformGetProductQuantity(e,n))||""===i?0:i}if("checkbox"!==l.prop("type")&&"radio"!==l.prop("type")||(l=l.filter(":checked")),1===l.length){if(!l.is("select")&&"radio"!==l.prop("type")&&"checkbox"!==l.prop("type")||""!==t)void 0===i&&(i=l.val());else if((i=l.is("select")?l.find("option:selected"):l.next("label").clone()).find("span").remove(),1===i.length)i=i.text();else{for(var s=[],d=0;d<i.length;d++)s[d]=jQuery(i[d]).text();i=s}f=jQuery.isArray(i)?i.join(", "):"string"==typeof i?GFMergeTag.formatValue(i,t):""}else if(1<l.length){i=[];for(d=0;d<l.length;d++)if("checkbox"===l.prop("type")&&""===t){var c=jQuery(l[d]).next("label").clone();c.find("span").remove(),i[d]=GFMergeTag.formatValue(c.text(),t),c.remove()}else i[d]=GFMergeTag.formatValue(jQuery(l[d]).val(),t);f=i.join(", ")}return f},GFMergeTag.replaceMergeTags=function(e,r){var t=GFMergeTag.parseMergeTags(r);for(i in t)if(t.hasOwnProperty(i)){var n=t[i][1],a=(parseInt(n,10),null==t[i][3]?"":t[i][3].replace(":","")),o=GFMergeTag.getMergeTagValue(e,n,a);r=r.replace(t[i][0],o)}return r},GFMergeTag.formatValue=function(e,r){var t="";switch(t=1<(e=e.split("|")).length&&("price"===r||"currency"===r)?gformToNumber(e[1]):e[0],r){case"price":t=!1===(t=gformToNumber(t))?"":t;break;case"currency":t=!1===(t=gformFormatMoney(t,!1))?"":t;break;case"numeric":return!1===(t=gformToNumber(t))?0:t}return t},GFMergeTag.parseMergeTags=function(e,r){void 0===r&&(r=/{[^{]*?:(\d+(\.\d+)?)(:(.*?))?}/i);for(var t=[];r.test(e);){var i=t.length;t[i]=r.exec(e),e=e.replace(""+t[i][0],"")}return t}};new GFMergeTag;var GFCalc=function(formId,formulaFields){this.formId=formId,this.formulaFields=formulaFields,this.exprPatt=/^[0-9 -/*\(\)]+$/i,this.isCalculating={},this.init=function(e,r){var t=this;jQuery(document).bind("gform_post_conditional_logic",function(){t.runCalcs(e,r)});for(var i=0;i<r.length;i++){var n=jQuery.extend({},r[i]);this.runCalc(n,e),this.bindCalcEvents(n,e)}},this.runCalc=function(formulaField,formId){var calcObj=this,field=jQuery("#field_"+formId+"_"+formulaField.field_id),formulaInput=field.hasClass("gfield_price")?jQuery("#ginput_base_price_"+formId+"_"+formulaField.field_id):jQuery("#input_"+formId+"_"+formulaField.field_id),previous_val=formulaInput.val(),formula=gform.applyFilters("gform_calculation_formula",formulaField.formula,formulaField,formId,calcObj),expr=calcObj.replaceFieldTags(formId,formula,formulaField).replace(/(\r\n|\n|\r)/gm,""),result="";if(calcObj.exprPatt.test(expr))try{result=eval(expr)}catch(e){}isFinite(result)||(result=0),window.gform_calculation_result&&(result=window.gform_calculation_result(result,formulaField,formId,calcObj),window.console&&console.log('"gform_calculation_result" function is deprecated since version 1.8! Use "gform_calculation_result" JS hook instead.')),result=gform.applyFilters("gform_calculation_result",result,formulaField,formId,calcObj);var formattedResult=gform.applyFilters("gform_calculation_format_result",!1,result,formulaField,formId,calcObj),numberFormat=gf_get_field_number_format(formulaField.field_id,formId);if(!1!==formattedResult)result=formattedResult;else if(field.hasClass("gfield_price")||"currency"==numberFormat)result=gformFormatMoney(result||0,!0);else{var decimalSeparator=".",thousandSeparator=",";"decimal_comma"==numberFormat&&(decimalSeparator=",",thousandSeparator="."),result=gformFormatNumber(result,gformIsNumber(formulaField.rounding)?formulaField.rounding:-1,decimalSeparator,thousandSeparator)}result!=previous_val&&(field.hasClass("gfield_price")?(jQuery("#input_"+formId+"_"+formulaField.field_id).text(result),formulaInput.val(result).trigger("change"),gformCalculateTotalPrice(formId)):formulaInput.val(result).trigger("change"))},this.runCalcs=function(e,r){for(var t=0;t<r.length;t++){var i=jQuery.extend({},r[t]);this.runCalc(i,e)}},this.bindCalcEvents=function(e,r){var t=this,i=e.field_id,n=GFMergeTag.parseMergeTags(e.formula);for(var a in t.isCalculating[i]=!1,n)if(n.hasOwnProperty(a)){var o=n[a][1],l=parseInt(o,10),f=jQuery("#field_"+r+"_"+l).find('input[name="input_'+o+'"], select[name="input_'+o+'"]');"checkbox"==f.prop("type")||"radio"==f.prop("type")?jQuery(f).click(function(){t.bindCalcEvent(o,e,r,0)}):f.is("select")||"hidden"==f.prop("type")?jQuery(f).change(function(){t.bindCalcEvent(o,e,r,0)}):jQuery(f).keydown(function(){t.bindCalcEvent(o,e,r)}).change(function(){t.bindCalcEvent(o,e,r,0)}),gform.doAction("gform_post_calculation_events",n[a],e,r,t)}},this.bindCalcEvent=function(e,r,t,i){var n=this,a=r.field_id;i=null==i?345:i,n.isCalculating[a][e]&&clearTimeout(n.isCalculating[a][e]),n.isCalculating[a][e]=window.setTimeout(function(){n.runCalc(r,t)},i)},this.replaceFieldTags=function(e,r,t){var n=GFMergeTag.parseMergeTags(r);for(i in n)if(n.hasOwnProperty(i)){var a=n[i][1],o=parseInt(a,10),l="value";if(n[i][3])l=n[i][3];else{var f=jQuery(".gfield_price input[name=input_"+o+"]").is("input[type=radio]"),s=0<jQuery(".gfield_price select[name=input_"+o+"]").length,d=jQuery('.gfield_price input[name="input_'+a+'"]').is("input[type=checkbox]");(s||f||d)&&(l="price")}var c=!window.gf_check_field_rule||"show"==gf_check_field_rule(e,o,!0,""),u=c?GFMergeTag.getMergeTagValue(e,a,l):0;u=gform.applyFilters("gform_merge_tag_value_pre_calculation",u,n[i],c,t,e),u=this.cleanNumber(u,e,o,t),r=r.replace(n[i][0],u)}return r},this.cleanNumber=function(e,r,t,i){var n=gf_get_field_number_format(t,r);return e=(e=gformCleanNumber(e,"","",gformGetDecimalSeparator(n=n||gf_get_field_number_format(i.field_id,r))))||0},this.init(formId,formulaFields)};function gformFormatNumber(e,r,t,i){void 0===t&&(t=window.gf_global?new Currency(gf_global.gf_currency_config).currency.decimal_separator:".");void 0===i&&(i=window.gf_global?new Currency(gf_global.gf_currency_config).currency.thousand_separator:",");return(new Currency).numberFormat(e,r,t,i,!1)}function getMatchGroups(e,r){for(var t=new Array;r.test(e);){var i=t.length;t[i]=r.exec(e),e=e.replace(""+t[i][0],"")}return t}function gf_get_field_number_format(e,r,t){var i=rgars(window,"gf_global/number_formats/{0}/{1}".format(r,e)),n=!1;return""===i?n:n=void 0===t?!1!==i.price?i.price:i.value:i[t]}var gform={hooks:{action:{},filter:{}},addAction:function(e,r,t,i){gform.addHook("action",e,r,t,i)},addFilter:function(e,r,t,i){gform.addHook("filter",e,r,t,i)},doAction:function(e){gform.doHook("action",e,arguments)},applyFilters:function(e){return gform.doHook("filter",e,arguments)},removeAction:function(e,r){gform.removeHook("action",e,r)},removeFilter:function(e,r,t){gform.removeHook("filter",e,r,t)},addHook:function(e,r,t,i,n){null==gform.hooks[e][r]&&(gform.hooks[e][r]=[]);var a=gform.hooks[e][r];null==n&&(n=r+"_"+a.length),null==i&&(i=10),gform.hooks[e][r].push({tag:n,callable:t,priority:i})},doHook:function(e,r,t){if(t=Array.prototype.slice.call(t,1),null!=gform.hooks[e][r]){var i,n=gform.hooks[e][r];n.sort(function(e,r){return e.priority-r.priority});for(var a=0;a<n.length;a++)"function"!=typeof(i=n[a].callable)&&(i=window[i]),"action"==e?i.apply(null,t):t[0]=i.apply(null,t)}if("filter"==e)return t[0]},removeHook:function(e,r,t,i){if(null!=gform.hooks[e][r])for(var n=gform.hooks[e][r],a=n.length-1;0<=a;a--)null!=i&&i!=n[a].tag||null!=t&&t!=n[a].priority||n.splice(a,1)}},__gf_keyup_timeout;function renderRecaptcha(){jQuery(".ginput_recaptcha").each(function(){var r=jQuery(this),e={sitekey:r.data("sitekey"),theme:r.data("theme"),tabindex:r.data("tabindex")};if(r.is(":empty")){r.data("stoken")&&(e.stoken=r.data("stoken"));var t=!1;"invisible"==r.data("size")&&(t=function(e){e&&r.closest("form").submit()}),(t=gform.applyFilters("gform_recaptcha_callback",t,r))&&(e.callback=t),r.data("widget-id",grecaptcha.render(this.id,e)),e.tabindex&&r.find("iframe").attr("tabindex",e.tabindex),gform.doAction("gform_post_recaptcha_render",r)}})}function gformIsRecaptchaPending(e){var r,t=e.find(".ginput_recaptcha");return!(!t.length||"invisible"!==t.data("size"))&&!((r=t.find(".g-recaptcha-response")).length&&r.val())}function gformValidateFileSize(e,r){var t;if(t=0<jQuery(e).closest("div").siblings(".validation_message").length?jQuery(e).closest("div").siblings(".validation_message"):jQuery(e).siblings(".validation_message"),window.FileReader&&window.File&&window.FileList&&window.Blob){var i=e.files[0];i&&i.size>r?t.text(i.name+" - "+gform_gravityforms.strings.file_exceeds_limit):t.text("")}}function gformInitSpinner(e,r){jQuery("#gform_"+e).submit(function(){gformAddSpinner(e,r)})}function gformAddSpinner(e,r){void 0!==r&&r||(r=gform.applyFilters("gform_spinner_url",gf_global.spinnerUrl,e)),0==jQuery("#gform_ajax_spinner_"+e).length&&gform.applyFilters("gform_spinner_target_elem",jQuery("#gform_submit_button_"+e+", #gform_wrapper_"+e+" .gform_next_button, #gform_send_resume_link_button_"+e),e).after('<img id="gform_ajax_spinner_'+e+'"  class="gform_ajax_spinner" src="'+r+'" alt="" />')}function gf_raw_input_change(e,r){clearTimeout(__gf_keyup_timeout);var t=jQuery(r),i=t.attr("id"),n=gf_get_input_id_by_html_id(i),a=gf_get_form_id_by_html_id(i),o=gform.applyFilters("gform_field_meta_raw_input_change",{fieldId:n,formId:a},t,e);if(n=o.fieldId,a=o.formId,n){var l=t.is(":checkbox")||t.is(":radio")||t.is("select"),f=!l||t.is("textarea");"keyup"==e.type&&!f||"change"==e.type&&!l&&!f||("keyup"==e.type?__gf_keyup_timeout=setTimeout(function(){gf_input_change(r,a,n)},300):gf_input_change(r,a,n))}}function gf_get_input_id_by_html_id(e){var r=gf_get_ids_by_html_id(e),t=r[r.length-1];return 3==r.length&&(r.shift(),t=r.join(".")),t}function gf_get_form_id_by_html_id(e){return gf_get_ids_by_html_id(e)[0]}function gf_get_ids_by_html_id(e){for(var r=e?e.split("_"):[],t=r.length-1;0<=t;t--)gformIsNumber(r[t])||r.splice(t,1);return r}function gf_input_change(e,r,t){gform.doAction("gform_input_change",e,r,t)}function gformExtractFieldId(e){var r=parseInt(e.toString().split(".")[0],10);return r||e}function gformExtractInputIndex(e){var r=parseInt(e.toString().split(".")[1],10);return r||!1}if(!function(h,y){h.uploaders={};var v="undefined"!=typeof gform_gravityforms?gform_gravityforms.strings:{},b="undefined"!=typeof gform_gravityforms?gform_gravityforms.vars.images_url:"";function i(e){var d,i,r=y(e).data("settings"),t=new plupload.Uploader(r);function c(e,r){y("#"+e).prepend("<li>"+F(r)+"</li>")}function u(e){var r,t,i=parseInt(e.gf_vars.max_files,10);if(0<i){var n=i<=m(e.multipart_params.field_id);h.toggleDisabled(e,n),n||(r=e.gf_vars.message_id,t=v.max_reached,y("#"+r+" li:contains('"+t+"')").remove())}}function g(){var e;return e=void 0===(e=y("#gform_uploaded_files_"+d).val())||""===e?{}:y.parseJSON(e)}function _(e){var r=g(),t=p(e);return void 0===r[t]&&(r[t]=[]),r[t]}function m(e){return _(e).length}function p(e){return"input_"+e}function n(e){e.preventDefault()}d=t.settings.multipart_params.form_id,(h.uploaders[r.container]=t).bind("Init",function(e,r){e.features.dragdrop||y(".gform_drop_instructions").hide(),u(e.settings)}),h.toggleDisabled=function(e,r){("string"==typeof e.browse_button?y("#"+e.browse_button):y(e.browse_button)).prop("disabled",r)},t.init(),t.bind("BeforeUpload",function(e,r){e.settings.multipart_params.original_filename=r.name}),t.bind("FilesAdded",function(a,e){var o,l=parseInt(a.settings.gf_vars.max_files,10),f=m(a.settings.multipart_params.field_id),s=a.settings.gf_vars.disallowed_extensions;if(0<l&&l<=f)y.each(e,function(e,r){a.removeFile(r)});else{y.each(e,function(e,r){if(o=r.name.split(".").pop(),-1<y.inArray(o,s))return c(a.settings.gf_vars.message_id,r.name+" - "+v.illegal_extension),void a.removeFile(r);if(r.status==plupload.FAILED||0<l&&l<=f)a.removeFile(r);else{var t=void 0!==r.size?plupload.formatSize(r.size):v.in_progress,i="$this=jQuery(this); var uploader = gfMultiFileUploader.uploaders."+a.settings.container.id+";uploader.stop();uploader.removeFile(uploader.getFile('"+r.id+"'));$this.after('"+v.cancelled+"'); uploader.start();$this.remove();",n='<div id="{0}" class="ginput_preview">{1} ({2}) <b></b> <a href="javascript:void(0)" title="{3}" onclick="{4}" onkeypress="{4}">{5}</a></div>';n=gform.applyFilters("gform_file_upload_status_markup",n,r,t,v,i,a).format(r.id,F(r.name),t,v.cancel_upload,i,v.cancel),y("#"+a.settings.filelist).prepend(n),f++}}),a.refresh();var r="input:hidden[name='gform_unique_id']",t=y("form#gform_"+d+" "+r);0==t.length&&(t=y(r)),""===(i=t.val())&&(i="xxxxxxxx".replace(/[xy]/g,function(e){var r=16*Math.random()|0;return("x"==e?r:3&r|8).toString(16)}),t.val(i)),0<l&&l<=f&&(h.toggleDisabled(a.settings,!0),c(a.settings.gf_vars.message_id,v.max_reached)),a.settings.multipart_params.gform_unique_id=i,a.start()}}),t.bind("UploadProgress",function(e,r){var t=r.percent+"%";y("#"+r.id+" b").html(t)}),t.bind("Error",function(e,r){if(r.code===plupload.FILE_EXTENSION_ERROR){var t=void 0!==e.settings.filters.mime_types?e.settings.filters.mime_types[0].extensions:e.settings.filters[0].extensions;c(e.settings.gf_vars.message_id,r.file.name+" - "+v.invalid_file_extension+" "+t)}else if(r.code===plupload.FILE_SIZE_ERROR)c(e.settings.gf_vars.message_id,r.file.name+" - "+v.file_exceeds_limit);else{var i="Error: "+r.code+", Message: "+r.message+(r.file?", File: "+r.file.name:"");c(e.settings.gf_vars.message_id,i)}y("#"+r.file.id).html(""),e.refresh()}),t.bind("ChunkUploaded",function(e,r,t){var i=y.secureEvalJSON(t.response);"error"==i.status&&(e.removeFile(r),c(e.settings.gf_vars.message_id,r.name+" - "+i.error.message),y("#"+r.id).html(""))}),t.bind("FileUploaded",function(e,r,t){if(e.getFile(r.id)){var i=y.secureEvalJSON(t.response);if("error"==i.status)return c(e.settings.gf_vars.message_id,r.name+" - "+i.error.message),y("#"+r.id).html(""),void u(e.settings);var n,a,o,l="<strong>"+F(r.name)+"</strong>",f=e.settings.multipart_params.form_id,s=e.settings.multipart_params.field_id;l="<img class='gform_delete' src='"+b+"/delete.png' onclick='gformDeleteUploadedFile("+f+","+s+", this);' onkeypress='gformDeleteUploadedFile("+f+","+s+", this);' alt='"+v.delete_file+"' title='"+v.delete_file+"' /> "+l,l=gform.applyFilters("gform_file_upload_markup",l,r,e,v,b,i),y("#"+r.id).html(l),100==r.percent&&(i.status&&"ok"==i.status?(n=s,a=i.data,(o=_(n)).unshift(a),function(e,r){var t=g(),i=y("#gform_uploaded_files_"+d),n=p(e);t[n]=r,i.val(y.toJSON(t))}(n,o)):c(e.settings.gf_vars.message_id,v.unknown_error+": "+r.name))}}),t.bind("FilesRemoved",function(e,r){u(e.settings)}),y("#"+r.drop_element).on({dragenter:n,dragover:n})}function F(e){return y("<div/>").text(e).html()}y(document).bind("gform_post_render",function(e,r){y("form#gform_"+r+" .gform_fileupload_multifile").each(function(){i(this)});var t=y("form#gform_"+r);0<t.length&&t.submit(function(){var t=!1;if(y.each(h.uploaders,function(e,r){if(0<r.total.queued)return!(t=!0)}),t)return alert(v.currently_uploading),window["gf_submitting_"+r]=!1,y("#gform_ajax_spinner_"+r).remove(),!1})}),y(document).bind("gform_post_conditional_logic",function(e,r,t,i){i||y.each(h.uploaders,function(e,r){r.refresh()})}),y(document).ready(function(){"undefined"!=typeof adminpage&&"toplevel_page_gf_edit_forms"===adminpage||"undefined"==typeof plupload?y(".gform_button_select_files").prop("disabled",!0):"undefined"!=typeof adminpage&&-1<adminpage.indexOf("_page_gf_entries")&&y(".gform_fileupload_multifile").each(function(){i(this)})}),h.setup=function(e){i(e)}}(window.gfMultiFileUploader=window.gfMultiFileUploader||{},jQuery),jQuery(document).on("change keyup",".gfield input, .gfield select, .gfield textarea",function(e){gf_raw_input_change(e,this)}),jQuery(document).on("submit.gravityforms",".gform_wrapper form",function(e){var r,t=jQuery(this).closest(".gform_wrapper"),i=t.attr("id").split("_")[2],n=0<t.find(".gform_page").length,a=parseInt(t.find('input[name^="gform_source_page_number_"]').val(),10),o=parseInt(t.find('input[name^="gform_target_page_number_"]').val(),10),l=0===o,f=!l&&a<o,s="1"===jQuery("#gform_save_"+i).val();if(n){var d=f?"next":"submit";r=t.find(".gform_page:visible").find('.gform_page_footer [id^="gform_'+d+'_button_"]')}else r=t.find("#gform_submit_button_"+i);var c=!r.is(":visible");if(!s&&(l||f)&&c)window["gf_submitting_"+i]=!1,t.find(".gform_ajax_spinner").remove(),e.preventDefault();else if(l||l){var u=t.find(".ginput_recaptcha");if(0!==u.length&&"invisible"===u.data("size")){var g=t.find('input[name="g-recaptcha-response"]');0===g.length&&(g=u.find(".g-recaptcha-response")),g.val()||(grecaptcha.execute(u.data("widget-id")),window["gf_submitting_"+i]=!1,e.preventDefault())}}}),!window.rgars)function rgars(e,r){for(var t=r.split("/"),i=e,n=0;n<t.length;n++)i=rgar(i,t[n]);return i}if(!window.rgar)function rgar(e,r){return void 0!==e[r]?e[r]:""}String.prototype.format=function(){var t=arguments;return this.replace(/{(\d+)}/g,function(e,r){return void 0!==t[r]?t[r]:e})};