function FormatCurrency(a){if(gf_vars.gf_currency_config){var b=new Currency(gf_vars.gf_currency_config),c=b.toMoney(jQuery(a).val());jQuery(a).val(c)}}function ToggleConditionalLogic(a,b){var c=a?"":"slow";if(jQuery("#"+b+"_conditional_logic").is(":checked")){CreateConditionalLogic(b,GetConditionalObject(b)),SetConditionalProperty(b,"actionType",jQuery("#"+b+"_action_type").val()),SetConditionalProperty(b,"logicType",jQuery("#"+b+"_logic_type").val()),SetRule(b,0),jQuery("#"+b+"_conditional_logic_container").show(c)}else jQuery("#"+b+"_conditional_logic_container").hide(c)}function GetConditionalObject(a){var b=!1;switch(a){case"page":case"field":b=GetSelectedField();break;case"next_button":b=GetSelectedField().nextButton;break;case"confirmation":b=confirmation;break;case"notification":b=current_notification;break;default:b="undefined"!=typeof form&&form.button}return b=gform.applyFilters("gform_conditional_object",b,a)}function CreateConditionalLogic(a,b){b.conditionalLogic||(b.conditionalLogic=new ConditionalLogic);var c,d="hide"==b.conditionalLogic.actionType?"selected='selected'":"",e="show"==b.conditionalLogic.actionType?"selected='selected'":"",f="all"==b.conditionalLogic.logicType?"selected='selected'":"",g="any"==b.conditionalLogic.logicType?"selected='selected'":"";c="section"==b.type?gf_vars.thisSectionIf:"field"==a?gf_vars.thisFieldIf:"page"==a?gf_vars.thisPage:"confirmation"==a?gf_vars.thisConfirmation:"notification"==a?gf_vars.thisNotification:gf_vars.thisFormButton;var h={};h.actionType="",h.objectDescription=c,h.logicType="",h.ofTheFollowingMatch=gf_vars.ofTheFollowingMatch;var i=makeArray(h),j=i.join(" ");j=gform.applyFilters("gform_conditional_logic_description",j,h,a,b);var k,l;for(k=0;k",j+=GetRuleFields(a,k,l.fieldId),j+=GetRuleOperators(a,k,l.fieldId,l.operator),j+=GetRuleValues(a,k,l.fieldId,l.value),j+="",b.conditionalLogic.rules.length>1&&(j+=""),j+="";jQuery("#"+a+"_conditional_logic_container").html(j),Placeholders.enable()}function GetRuleOperators(a,b,c,d){var e,f,g,h;return f={is:"is",isnot:"isNot",">":"greaterThan","<":"lessThan",contains:"contains",starts_with:"startsWith",ends_with:"endsWith"},e=""}function GetOperatorsForMeta(a,b){var c={};return entry_meta[b]&&entry_meta[b].filter&&entry_meta[b].filter.operators?jQuery.each(a,function(a,d){jQuery.inArray(a,entry_meta[b].filter.operators)>=0&&(c[a]=d)}):c=a,c}function GetRuleFields(a,b,c){for(var d=""}function isEmpty(a){}function SetRuleProperty(a,b,c,d){GetConditionalObject(a).conditionalLogic.rules[b][c]=d}function GetFieldById(a){a=parseInt(a);for(var b=0;b',this.init=function(){return this.spinner=jQuery(this.image),jQuery(this.elem).after(this.spinner),this},this.destroy=function(){jQuery(this.spinner).remove()},this.init()}function InsertVariable(a,b,c){c||(c=jQuery("#"+a+"_variable_select").val());var d=document.getElementById(a),e=jQuery(d);if(document.selection)e[0].focus(),document.selection.createRange().text=c;else if("selectionStart"in d){var f=d.selectionStart;d.value=d.value.substr(0,f)+c+d.value.substr(d.selectionEnd,d.value.length),d.selectionStart=f+d.value.length,d.selectionEnd=f+d.value.length}else e.val(c+messageElement.val());var g=jQuery("#"+a+"_variable_select");g.length>0&&(g[0].selectedIndex=0),b&&window[b]&&window[b].call(null,a,c)}function InsertEditorVariable(a,b){if(!b){var c=jQuery("#"+a+"_variable_select");c[0].selectedIndex=0,b=c.val()}wpActiveEditor=a,window.send_to_editor(b)}function GetInputType(a){return a.inputType?a.inputType:a.type}function HasPostField(){for(var a=0;a0?a.adminLabel:a.label,null!=d?c?d.label:e+" ("+d.label+")":e}function DeleteNotification(a){jQuery("#action_argument").val(a),jQuery("#action").val("delete"),jQuery("#notification_list_form")[0].submit()}function DuplicateNotification(a){jQuery("#action_argument").val(a),jQuery("#action").val("duplicate"),jQuery("#notification_list_form")[0].submit()}function DeleteConfirmation(a){jQuery("#action_argument").val(a),jQuery("#action").val("delete"),jQuery("#confirmation_list_form")[0].submit()}function DuplicateConfirmation(a){jQuery("#action_argument").val(a),jQuery("#action").val("duplicate"),jQuery("#confirmation_list_form")[0].submit()}function SetConfirmationConditionalLogic(){confirmation.conditionalLogic=jQuery("#conditional_logic").val()?jQuery.parseJSON(jQuery("#conditional_logic").val()):new ConditionalLogic}function ToggleConfirmation(){var a,b="",c=jQuery("#form_confirmation_redirect").is(":checked"),d=jQuery("#form_confirmation_show_page").is(":checked");c?(a=".form_confirmation_redirect_container",b="#form_confirmation_message_container, .form_confirmation_page_container",ClearConfirmationSettings(["text","page"])):d?(a=".form_confirmation_page_container",b="#form_confirmation_message_container, .form_confirmation_redirect_container",ClearConfirmationSettings(["text","redirect"])):(a="#form_confirmation_message_container",b=".form_confirmation_page_container, .form_confirmation_redirect_container",ClearConfirmationSettings(["page","redirect"])),ToggleQueryString(),TogglePageQueryString(),jQuery(b).hide(),jQuery(a).show()}function ToggleQueryString(){jQuery("#form_redirect_use_querystring").is(":checked")?jQuery("#form_redirect_querystring_container").show():(jQuery("#form_redirect_querystring_container").hide(),jQuery("#form_redirect_querystring").val(""),jQuery("#form_redirect_use_querystring").val(""))}function TogglePageQueryString(){jQuery("#form_page_use_querystring").is(":checked")?jQuery("#form_page_querystring_container").show():(jQuery("#form_page_querystring_container").hide(),jQuery("#form_page_querystring").val(""),jQuery("#form_page_use_querystring").val(""))}function ClearConfirmationSettings(a){var b=jQuery.isArray(a)?a:[a];for(i in b)if(b.hasOwnProperty(i))switch(b[i]){case"text":jQuery("#form_confirmation_message").val(""),jQuery("#form_disable_autoformatting").prop("checked",!1);break;case"page":jQuery("#form_confirmation_page").val(""),jQuery("#form_page_querystring").val(""),jQuery("#form_page_use_querystring").prop("checked",!1);break;case"redirect":jQuery("#form_confirmation_url").val(""),jQuery("#form_redirect_querystring").val(""),jQuery("#form_redirect_use_querystring").prop("checked",!1)}}function StashConditionalLogic(){var a=JSON.stringify(confirmation.conditionalLogic);jQuery("#conditional_logic").val(a)}function ConfirmationObj(){this.id=!1,this.name=gf_vars.confirmationDefaultName,this.type="message",this.message=gf_vars.confirmationDefaultMessage,this.isDefault=0}function Copy(a){if(!a)return a;if("object"!=typeof a)return a;a=jQuery.isArray(a)?a.slice():jQuery.extend({},a);for(i in a)a[i]=Copy(a[i]);return a}function SimpleConditionObject(a,b){if(b.indexOf("simple_condition")<0)return a;var c=b.substring(17)+"_object";return window[c]}function FeedConditionConditionalObject(a,b){return"feed_condition"!=b?a:feedCondition.logicObject}function FeedConditionConditionalDescription(a,b,c,d){return"feed_condition"!=c?a:(b.actionType=b.actionType.replace("=0&&jQuery(".merge-tag-support").each(function(){new gfMergeTagsObj(form,jQuery(this))}),window.form&&(window.gfMergeTags=new gfMergeTagsObj(form)),a(document).ready(function(){a(".gform_currency").bind("change",function(){FormatCurrency(this)}).each(function(){FormatCurrency(this)})})}),function(a,b,c){function d(a){return void 0!==a}a.init=function(){f=window.form;d(f)&&f.id},a.toggleFeedActive=function(a,b,c){var d=a.src.indexOf("active1.png")>=0?0:1;return a.src=a.src.replace("active1.png","spinner.gif"),a.src=a.src.replace("active0.png","spinner.gif"),jQuery.post(ajaxurl,{action:"gf_feed_is_active_"+b,feed_id:c,is_active:d},function(b){d?(a.src=a.src.replace("spinner.gif","active1.png"),jQuery(a).attr("title",gf_vars.inactive).attr("alt",gf_vars.inactive)):(a.src=a.src.replace("spinner.gif","active0.png"),jQuery(a).attr("title",gf_vars.active).attr("alt",gf_vars.active))}),!0},a.deleteFeed=function(a){b("#single_action").val("delete"),b("#single_action_argument").val(a),b("#gform-settings").submit()},a.duplicateFeed=function(a){b("#single_action").val("duplicate"),b("#single_action_argument").val(a),b("#gform-settings").submit()}}(window.gaddon=window.gaddon||{},jQuery);var gfMergeTagsObj=function(a,b){var c=this;c.form=a,c.elem=b,c.init=function(){c.elem.data("mergeTags")||(c.mergeTagList=jQuery(''),c.mergeTagListHover=!1,c.bindKeyDown(),c.initAutocomplete(),c.addMergeTagIcon(),c.mergeTagIcon.find("a.open-list").on("click.gravityforms",function(){var a=jQuery(this),b=c.getTargetElement(a);c.mergeTagList.html(""),c.mergeTagList.append(c.getMergeTagListItems(b)),c.mergeTagList.insertAfter(a).show()}),c.mergeTagList.hover(function(){c.mergeTagListHover=!0},function(){c.mergeTagListHover=!1}),jQuery("body").mouseup(function(){c.mergeTagListHover||c.mergeTagList.hide()}),c.elem.data("mergeTags",c))},c.destroy=function(a){a=c.elem?c.elem:a,a.next(".all-merge-tags").remove(),a.off("keydown.gravityforms"),a.autocomplete("destroy"),a.data("mergeTags",null)},c.bindKeyDown=function(){c.elem.on("keydown.gravityforms",function(a){var b=!(!c.elem.data("autocomplete")||!c.elem.data("autocomplete").menu)&&c.elem.data("autocomplete").menu.active;a.keyCode===jQuery.ui.keyCode.TAB&&b&&a.preventDefault()})},c.initAutocomplete=function(){c.elem.autocomplete({minLength:1,focus:function(){return!1},source:function(a,b){var d=c.extractLast(a.term);if(d.length'),c.mergeTagIcon.data("targetElement",c.elem.attr("id")),c.getClassProperty(c.elem,"manual_position")){var d=".mt-"+c.elem.attr("id");jQuery(d).append(c.mergeTagIcon)}else c.elem.after(c.mergeTagIcon);c.mergeTagIcon.find(".tooltip-merge-tag").tooltip({show:{delay:1250},content:function(){return jQuery(this).prop("title")}})},c.bindMergeTagListClick=function(a){c.mergeTagList.hide();var b=jQuery(a.target).data("value"),d=c.getTargetElement(a.target);c.isWpEditor(d)?InsertEditorVariable(d.attr("id"),b):InsertVariable(d.attr("id"),null,b),d.trigger("input").trigger("propertychange"),c.mergeTagList.hide()},this.getMergeTags=function(a,b,c,d,e,f){void 0===a&&(a=[]),void 0===d&&(d=[]);var g=[],h=[],j=[],k=[],l=[],m=[],n=[],o=[],p=[];if(c||k.push({tag:"{all_fields}",label:this.getMergeTagLabel("{all_fields}")}),!e){for(i in a)if(a.hasOwnProperty(i)){var q=a[i];if(!q.displayOnly){var r=GetInputType(q);if(-1==jQuery.inArray(r,d)){if(q.isRequired)switch(r){case"name":var s,t,u,v,w=Copy(q);"extended"==q.nameFormat?(s=GetInput(q,q.id+".2"),u=GetInput(q,q.id+".8"),v=Copy(q),v.inputs=[s,u],h.push(v),delete w.inputs[0],delete w.inputs[3]):"advanced"==q.nameFormat&&(s=GetInput(q,q.id+".2"),t=GetInput(q,q.id+".4"),u=GetInput(q,q.id+".8"),v=Copy(q),v.inputs=[s,t,u],h.push(v),delete w.inputs[0],delete w.inputs[2],delete w.inputs[4]),g.push(w);break;default:g.push(q)}else h.push(q);IsPricingField(q.type)&&j.push(q)}}}if(g.length>0)for(i in g)g.hasOwnProperty(i)&&(l=l.concat(this.getFieldMergeTags(g[i],f)));if(h.length>0)for(i in h)h.hasOwnProperty(i)&&(m=m.concat(this.getFieldMergeTags(h[i],f)));if(j.length>0){c||n.push({tag:"{pricing_fields}",label:this.getMergeTagLabel("{pricing_fields}")});for(i in j)j.hasOwnProperty(i)&&n.concat(this.getFieldMergeTags(j[i],f))}}o.push({tag:"{ip}",label:this.getMergeTagLabel("{ip}")}),o.push({tag:"{date_mdy}",label:this.getMergeTagLabel("{date_mdy}")}),o.push({tag:"{date_dmy}",label:this.getMergeTagLabel("{date_dmy}")}),o.push({tag:"{embed_post:ID}",label:this.getMergeTagLabel("{embed_post:ID}")}),o.push({tag:"{embed_post:post_title}",label:this.getMergeTagLabel("{embed_post:post_title}")}),o.push({tag:"{embed_url}",label:this.getMergeTagLabel("{embed_url}")}),e||(o.push({tag:"{entry_id}",label:this.getMergeTagLabel("{entry_id}")}),o.push({tag:"{entry_url}",label:this.getMergeTagLabel("{entry_url}")}),o.push({tag:"{form_id}",label:this.getMergeTagLabel("{form_id}")}),o.push({tag:"{form_title}",label:this.getMergeTagLabel("{form_title}")})),o.push({tag:"{user_agent}",label:this.getMergeTagLabel("{user_agent}")}),o.push({tag:"{referer}",label:this.getMergeTagLabel("{referer}")}),HasPostField()&&!e&&(o.push({tag:"{post_id}",label:this.getMergeTagLabel("{post_id}")}),o.push({tag:"{post_edit_url}",label:this.getMergeTagLabel("{post_edit_url}")})),o.push({tag:"{user:display_name}",label:this.getMergeTagLabel("{user:display_name}")}),o.push({tag:"{user:user_email}",label:this.getMergeTagLabel("{user:user_email}")}),o.push({tag:"{user:user_login}",label:this.getMergeTagLabel("{user:user_login}")});var x=this.getCustomMergeTags();if(x.tags.length>0)for(i in x.tags)if(x.tags.hasOwnProperty(i)){var y=x.tags[i];p.push({tag:y.tag,label:y.label})}var z={ungrouped:{label:this.getMergeGroupLabel("ungrouped"),tags:k},required:{label:this.getMergeGroupLabel("required"),tags:l},optional:{label:this.getMergeGroupLabel("optional"),tags:m},pricing:{label:this.getMergeGroupLabel("pricing"),tags:n},other:{label:this.getMergeGroupLabel("other"),tags:o},custom:{label:this.getMergeGroupLabel("custom"),tags:p}};return z=gform.applyFilters("gform_merge_tags",z,b,c,d,e,f,this)},this.getMergeTagLabel=function(a){for(groupName in gf_vars.mergeTags)if(gf_vars.mergeTags.hasOwnProperty(groupName)){var b=gf_vars.mergeTags[groupName].tags;for(i in b)if(b.hasOwnProperty(i)&&b[i].tag==a)return b[i].label}return""},this.getMergeGroupLabel=function(a){return gf_vars.mergeTags[a].label},this.getFieldMergeTags=function(a,b){void 0===b&&(b="");var c=[],d=GetInputType(a),e="list"==d?":"+b:"",f="",g="";if(jQuery.inArray(d,["date","email","time","password"])>-1&&(a.inputs=null),void 0!==a.inputs&&jQuery.isArray(a.inputs)){"checkbox"==d&&(g=GetLabel(a,a.id).replace("'","\\'"),f="{"+g+":"+a.id+e+"}",c.push({tag:f,label:g}));for(i in a.inputs)if(a.inputs.hasOwnProperty(i)){var h=a.inputs[i];"creditcard"==d&&jQuery.inArray(parseFloat(h.id),[parseFloat(a.id+".2"),parseFloat(a.id+".3"),parseFloat(a.id+".5")])>-1||(g=GetLabel(a,h.id).replace("'","\\'"),f="{"+g+":"+h.id+e+"}",c.push({tag:f,label:g}))}}else g=GetLabel(a).replace("'","\\'"),f="{"+g+":"+a.id+e+"}",c.push({tag:f,label:g});return c},c.getCustomMergeTags=function(){for(groupName in gf_vars.mergeTags)if(gf_vars.mergeTags.hasOwnProperty(groupName)&&"custom"==groupName)return gf_vars.mergeTags[groupName];return[]},this.getAutoCompleteMergeTags=function(a){var b=this.form.fields,c=a.attr("id"),d=1==this.getClassProperty(a,"hide_all_fields"),e=this.getClassProperty(a,"exclude"),f=this.getClassProperty(a,"option"),g=this.getClassProperty(a,"prepopulate");g&&(d=!0);var h=this.getMergeTags(b,c,d,e,g,f),j=[];for(group in h)if(h.hasOwnProperty(group)){var k=h[group].tags;for(i in k)k.hasOwnProperty(i)&&j.push(k[i].tag)}return j},this.getMergeTagListItems=function(a){var b=this.form.fields,d=a.attr("id"),e=1==this.getClassProperty(a,"hide_all_fields"),f=this.getClassProperty(a,"exclude"),g=this.getClassProperty(a,"prepopulate"),h=this.getClassProperty(a,"option");g&&(e=!0);var j=this.getMergeTags(b,d,e,f,g,h),k=this.hasMultipleGroups(j),l=[];for(group in j)if(j.hasOwnProperty(group)){var m=j[group].label,n=j[group].tags;if(!(n.length<=0)){m&&k&&l.push(jQuery('"));for(i in n)if(n.hasOwnProperty(i)){var o=n[i],p=jQuery(''+o.label+"");p.on("click.gravityforms",c.bindMergeTagListClick),l.push(jQuery("").html(p))}}}return l},this.hasMultipleGroups=function(a){var b=0;for(group in a)a.hasOwnProperty(group)&&a[group].tags.length>0&&b++;return b>1},c.getClassProperty=function(a,b){var a=jQuery(a),c=a.attr("class");if(!c)return"";var d=c.split(" ");for(i in d)if(d.hasOwnProperty(i)){var e=d[i].split("-");if("mt"==e[0]&&e[1]==b)return e.length>3?(delete e[0],delete e[1],e):2==e.length||e[2]}return""},c.getTargetElement=function(a){var a=jQuery(a),b=a.parents("span.all-merge-tags").data("targetElement");return jQuery("#"+b.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g,"\\$&"))},c.isWpEditor=function(a){var a=jQuery(a);return 1==this.getClassProperty(a,"wp_editor")},c.split=function(a){return a.split(" ")},c.extractLast=function(a){return this.split(a).pop()},c.startsWith=function(a,b){return 0===a.indexOf(b)},c.elem&&c.init()},FeedConditionObj=function(a){this.strings=isSet(a.strings)?a.strings:{},this.logicObject=a.logicObject,this.init=function(){var a=this;gform.addFilter("gform_conditional_object","FeedConditionConditionalObject"),gform.addFilter("gform_conditional_logic_description","FeedConditionConditionalDescription"),jQuery(document).ready(function(){ToggleConditionalLogic(!0,"feed_condition")}),jQuery("input#feed_condition_conditional_logic").parents("form").on("submit",function(){jQuery("input#feed_condition_conditional_logic_object").val(JSON.stringify(a.logicObject))})},this.init()};