­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ 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")){var d=GetConditionalObject(b);CreateConditionalLogic(b,d),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":var c=GetSelectedField();b=c.nextButton;break;case"confirmation":b=confirmation;break;case"notification":b=current_notification;break;default:b="undefined"!=typeof form?form.button:!1}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=""+n+""}else{var o=0==e?"gfield_ajax_placeholder_"+b:e+"_placeholder";jQuery.post(ajaxurl,{action:"gf_get_post_categories",objectType:a,ruleIndex:b,inputName:e,selectedValue:d},function(c){c&&(jQuery("#"+o).replaceWith(c.trim()),SetRuleProperty(a,b,"value",jQuery("#"+f).val()))}),l=""}}else if(g&&g.choices&&jQuery.inArray(k,["is","isnot"])>-1){var p=g.placeholder?[{text:g.placeholder,value:""}].concat(g.choices):g.choices;l=GetRuleValuesDropDown(p,a,b,d,e)}else IsAddressSelect(c,g)?(jQuery.post(ajaxurl,{action:"gf_get_address_rule_values_select",address_type:g.addressType?g.addressType:gf_vars.defaultAddressType,value:d,id:f,form_id:g.formId},function(c){c&&($select=jQuery(c.trim()),$placeholder=jQuery("#"+f),$placeholder.replaceWith($select),SetRuleProperty(a,b,"value",$select.val()))}),l=""):h&&entry_meta&&entry_meta[c]&&entry_meta[c].filter&&"undefined"!=typeof entry_meta[c].filter.choices?l=GetRuleValuesDropDown(entry_meta[c].filter.choices,a,b,d,e):(d=d?d.replace(/'/g,"'"):"",l="');return l=gform.applyFilters("gform_conditional_logic_values_input",l,a,b,c,d)}function IsAddressSelect(a,b){if(!b||"address"!=GetInputType(b))return!1;var c=b.addressType?b.addressType:gf_vars.defaultAddressType;if(!gf_vars.addressTypes[c])return!1;var d=gf_vars.addressTypes[c],e=a==b.id+".6",f=a==b.id+".4";return e&&"international"==c||f&&"object"==typeof d.states}function GetFirstRuleField(){for(var a=0;a",h=!1,i=0;i"+a[i].text+"").text())?j:a[i].text;g+=""}return!h&&d&&""!=d&&(g+=""),g+=""}function isEmpty(a){}function SetRuleProperty(a,b,c,d){var e=GetConditionalObject(a);e.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){if("feed_condition"!=c)return a;b.actionType=b.actionType.replace("0){var c=b.data("gf_dismissible_key"),d=b.data("gf_dismissible_nonce");c&&jQuery.ajax({url:ajaxurl,data:{action:"gf_dismiss_message",message_key:c,nonce:d}})}})}),function(a,b,c){function d(a){return"undefined"!=typeof a}a.init=function(){f=window.form;var a=0;d(f)&&(a=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){this.form=a,this.init=function(){var a=this;this.mergeTagList=jQuery('
    '),this.mergeTagListHover=!1,jQuery(".merge-tag-support").length<=0||(jQuery(".merge-tag-support").bind("keydown",function(a){var b=jQuery(this).data("autocomplete")&&jQuery(this).data("autocomplete").menu?jQuery(this).data("autocomplete").menu.active:!1;a.keyCode===jQuery.ui.keyCode.TAB&&b&&a.preventDefault()}).each(function(){var b=jQuery(this),c=b.is("input")?"input":"textarea";b.autocomplete({minLength:1,source:function(c,d){var e=a.extractLast(c.term);if(e.length');if(e.data("targetElement",b.attr("id")),a.getClassProperty(this,"manual_position")){var f=".mt-"+b.attr("id");jQuery(f).append(e)}else b.after(e)}),jQuery(".tooltip-merge-tag").tooltip({show:{delay:1250},content:function(){return jQuery(this).prop("title")}}),jQuery(".all-merge-tags a.open-list").click(function(){var b=jQuery(this),c=a.getTargetElement(b);a.mergeTagList.html(a.getMergeTagListItems(c)),a.mergeTagList.insertAfter(b).show(),jQuery("ul#gf_merge_tag_list a").click(function(){var b=jQuery(this).data("value"),c=a.getTargetElement(this);a.isWpEditor(c)?InsertEditorVariable(c.attr("id"),b):InsertVariable(c.attr("id"),null,b),c.trigger("input").trigger("propertychange"),a.mergeTagList.hide()})}),this.getTargetElement=function(a){var a=jQuery(a);return jQuery("#"+a.parents("span.all-merge-tags").data("targetElement"))},this.mergeTagList.hover(function(){a.mergeTagListHover=!0},function(){a.mergeTagListHover=!1}),jQuery("body").mouseup(function(){a.mergeTagListHover||a.mergeTagList.hide()}))},this.split=function(a){return a.split(" ")},this.extractLast=function(a){return this.split(a).pop()},this.startsWith=function(a,b){return 0===a.indexOf(b)},this.getMergeTags=function(a,b,c,d,e,f){"undefined"==typeof a&&(a=[]),"undefined"==typeof 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){"undefined"==typeof 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),"undefined"!=typeof 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},this.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,c=a.attr("id"),d=1==this.getClassProperty(a,"hide_all_fields"),e=this.getClassProperty(a,"exclude"),f=this.getClassProperty(a,"prepopulate"),g=this.getClassProperty(a,"option");f&&(d=!0);var h=this.getMergeTags(b,c,d,e,f,g),j=this.hasMultipleGroups(h),k="";for(group in h)if(h.hasOwnProperty(group)){var l=h[group].label,m=h[group].tags;if(!(m.length<=0)){l&&j&&(k+='
  • '+l+"
  • ");for(i in m)if(m.hasOwnProperty(i)){var n=m[i];k+='
  • '+n.label+"
  • "}}}return k},this.hasMultipleGroups=function(a){var b=0;for(group in a)a.hasOwnProperty(group)&&a[group].tags.length>0&&b++;return b>1},this.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?!0:e[2]}return""},this.isWpEditor=function(a){var a=jQuery(a);return 1==this.getClassProperty(a,"wp_editor")},this.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()};