function initMergeTagSupport(){"undefined"!=typeof form&&0<=jQuery(".merge-tag-support").length&&jQuery(".merge-tag-support").each(function(){new gfMergeTagsObj(form,jQuery(this))})}function FormatCurrency(e){var t;gf_vars.gf_currency_config&&(t=new Currency(gf_vars.gf_currency_config).toMoney(jQuery(e).val()),jQuery(e).val(t))}function ToggleConditionalLogic(e,t){jQuery("#"+t+"_conditional_logic").is(":checked")?(CreateConditionalLogic(t,GetConditionalObject(t)),SetConditionalProperty(t,"actionType",jQuery("#"+t+"_action_type").val()),SetConditionalProperty(t,"logicType",jQuery("#"+t+"_logic_type").val()),SetRule(t,0),jQuery("#"+t+"_conditional_logic_container").show()):jQuery("#"+t+"_conditional_logic_container").hide()}function GetConditionalObject(e){var t=!1;switch(e){case"page":case"field":t=GetSelectedField();break;case"next_button":var i=GetSelectedField();(t=i.nextButton).id=i.id;break;case"confirmation":t=confirmation;break;case"notification":t=current_notification;break;case"button":t=form.button;break;default:t="undefined"!=typeof form&&form.button}return t=gform.applyFilters("gform_conditional_object",t,e)}function CreateConditionalLogic(t,e){e.conditionalLogic&&0!=e.conditionalLogic.length||(e.conditionalLogic=new ConditionalLogic);var i,o="hide"==e.conditionalLogic.actionType?"selected='selected'":"",n="show"==e.conditionalLogic.actionType?"selected='selected'":"",r="all"==e.conditionalLogic.logicType?"selected='selected'":"",a="any"==e.conditionalLogic.logicType?"selected='selected'":"",s="section"==e.type?gf_vars.thisSectionIf:"field"==t?gf_vars.thisFieldIf:"page"==t?gf_vars.thisPage:"confirmation"==t?gf_vars.thisConfirmation:"notification"==t?gf_vars.thisNotification:gf_vars.thisFormButton,l="next_button"==t?(i=gf_vars.enable,gf_vars.disable):(i=gf_vars.show,gf_vars.hide),c={};c.actionType="",c.objectDescription=s,c.logicType="",c.ofTheFollowingMatch=gf_vars.ofTheFollowingMatch;for(var u,d=makeArray(c).join(" "),d=gform.applyFilters("gform_conditional_logic_description",d,c,t,e),g=0;g")+GetRuleFields(t,g,e.conditionalLogic.rules[g].fieldId))+GetRuleOperators(t,g,e.conditionalLogic.rules[g].fieldId,u.operator))+GetRuleValues(t,g,e.conditionalLogic.rules[g].fieldId,u.value))+"',1'),d+="";jQuery("#"+t+"_conditional_logic_container").html(d),Placeholders.enable(),jQuery("#"+t+"_conditional_logic",document).parents("form").on("submit",function(e){jQuery("#"+t+"_conditional_logic_object").val(JSON.stringify(GetConditionalObject(t).conditionalLogic))})}function GetRuleOperators(e,t,i,o){var n={is:"is",isnot:"isNot",">":"greaterThan","<":"lessThan",contains:"contains",starts_with:"startsWith",ends_with:"endsWith"},r=""}function GetOperatorsForMeta(e,i){var o={};return entry_meta[i]&&entry_meta[i].filter&&entry_meta[i].filter.operators?jQuery.each(e,function(e,t){0<=jQuery.inArray(e,entry_meta[i].filter.operators)&&(o[e]=t)}):o=e,o}function GetRuleFields(e,t,i){for(var e=""):a&&entry_meta&&entry_meta[e]&&entry_meta[e].filter&&void 0!==entry_meta[e].filter.choices?GetRuleValuesDropDown(entry_meta[e].filter.choices,t,i,o,n):(o=o?o.replace(/'/g,"'"):"","'),gform.applyFilters("gform_conditional_logic_values_input",u,t,i,e,o))}function IsAddressSelect(e,t){var i,o,n;return!(!t||"address"!=GetInputType(t)||(i=t.addressType||gf_vars.defaultAddressType,!gf_vars.addressTypes[i]))&&(o=gf_vars.addressTypes[i],n=e==t.id+".6",e=e==t.id+".4",n&&"international"==i||e&&"object"==typeof o.states)}function GetFirstRuleField(){for(var e=0;e",a=!1,s=0;s"+e[s].text+"").text())?l:e[s].text);r+=""}return!a&&o&&""!=o&&(r+=""),r+=""}function SetRuleProperty(e,t,i,o){e=GetConditionalObject(e);e.conditionalLogic.rules&&(e.conditionalLogic.rules[t][i]=o)}function GetFieldById(e){if("submit"===e)return GetSubmitField();e=parseInt(e);for(var t=0;t',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(e,t,i){i=i||jQuery("#"+e+"_variable_select").val();var o=document.getElementById(e),n=jQuery(o),r=(document.selection?(n[0].focus(),document.selection.createRange().text=i):"selectionStart"in o?(r=o.selectionStart,o.value=o.value.substr(0,r)+i+o.value.substr(o.selectionEnd,o.value.length),o.selectionStart=r+o.value.length,o.selectionEnd=r+o.value.length):n.val(i+messageElement.val()),jQuery("#"+e+"_variable_select"));0'),f.mergeTagListHover=!1,f.bindKeyDown(),f.initAutocomplete(),f.addMergeTagIcon(),f.mergeTagIcon.find(".open-list").on("click.gravityforms",function(e){e.preventDefault();var e=jQuery(this),t=f.getTargetElement(e);f.mergeTagList.html(""),f.mergeTagList.append(f.getMergeTagListItems(t)),f.mergeTagList.insertAfter(e).show()}),f.mergeTagList.hover(function(){f.mergeTagListHover=!0},function(){f.mergeTagListHover=!1}),jQuery("body").mouseup(function(){f.mergeTagListHover||f.mergeTagList.hide()}),f.elem.data("mergeTags",f))},f.destroy=function(e){(e=f.elem||e).next(".all-merge-tags").remove(),e.off("keydown.gravityforms"),e.autocomplete("destroy"),e.data("mergeTags",null)},f.bindKeyDown=function(){f.elem.on("keydown.gravityforms",function(e){var t=!(!f.elem.data("autocomplete")||!f.elem.data("autocomplete").menu)&&f.elem.data("autocomplete").menu.active;e.keyCode===jQuery.ui.keyCode.TAB&&t&&e.preventDefault()})},f.initAutocomplete=function(){f.elem.autocomplete({minLength:1,focus:function(){return!1},source:function(e,t){var i=f.extractLast(e.term);i.length"),f.mergeTagIcon.data("targetElement",f.elem.attr("id")),f.getClassProperty(f.elem,"manual_position")?(t=f.elem.attr("id").substring(1,f.elem.attr("id").length),jQuery("#"+t).find(".gform-tinymce-mergetag-button").append(f.mergeTagIcon)):f.elem.after(f.mergeTagIcon)},f.bindMergeTagListClick=function(e){f.mergeTagList.hide();var t=jQuery(e.target).data("value"),e=f.getTargetElement(e.target);f.isWpEditor(e)?InsertEditorVariable(e.attr("id"),t):InsertVariable(e.attr("id"),null,t),e.trigger("input").trigger("propertychange"),f.mergeTagList.hide()},this.getMergeTags=function(e,t,i,o,n,r){void 0===e&&(e=[]),void 0===o&&(o=[]);var a,s,l,c,u,d,g=[],f=[],p=[],m=[],h=[],y=[],_=[],v=[],b=[];if(i||m.push({tag:"{all_fields}",label:this.getMergeTagLabel("{all_fields}")}),!n){for(j in e)e.hasOwnProperty(j)&&((a=e[j]).displayOnly||(s=GetInputType(a),-1==jQuery.inArray(s,o)&&(a.isRequired?"name"===s?(s=Copy(a),"extended"==a.nameFormat?(l=GetInput(a,a.id+".2"),u=GetInput(a,a.id+".8"),(d=Copy(a)).inputs=[l,u],f.push(d),delete s.inputs[0],delete s.inputs[3]):"advanced"==a.nameFormat&&(l=GetInput(a,a.id+".2"),c=GetInput(a,a.id+".4"),u=GetInput(a,a.id+".8"),(d=Copy(a)).inputs=[l,c,u],f.push(d),delete s.inputs[0],delete s.inputs[2],delete s.inputs[4]),g.push(s)):g.push(a):f.push(a),IsPricingField(a.type))&&p.push(a)));if(0