website/wp-content/plugins/gravityforms/js/form_editor.min.js

1 line
84 KiB
JavaScript

function MakeNoFieldsDroppable(){jQuery("#no-fields").droppable({over:function(e,t){jQuery("#gform_fields").height(jQuery(this).height()),jQuery(this).hide()},out:function(e,t){jQuery(this).show()}})}function CloseStatus(){jQuery(".updated_base, .error_base").slideUp()}function InitializeFieldSettings(){jQuery("#field_max_file_size").on("input propertychange",function(){var e=jQuery(this),t=parseInt(e.val());SetFieldProperty("maxFileSize",t||"")}).on("change",function(){var e=GetSelectedField(),t=e.maxFileSize?e.maxFileSize:"",i=""===t?"":t+"MB";this.value=i}),jQuery(document).on("input propertychange",".field_default_value",function(){SetFieldDefaultValue(this.value)}),jQuery(document).on("input propertychange",".field_placeholder, .field_placeholder_textarea",function(){SetFieldPlaceholder(this.value)}),jQuery("#field_choices").on("change",".field-choice-price",function(){var e=GetSelectedField(),t=jQuery(this).parent("li").index(),i=e.choices[t].price;this.value=i}),jQuery(".field_input_choices").on("input propertychange","input",function(){var e=jQuery(this).closest("li"),t=e.data("index");SetInputChoice(e.data("input_id"),t,e.find(".field-choice-value").val(),e.find(".field-choice-text").val())}).on("click keypress","input:radio, input:checkbox",function(){var e=jQuery(this).closest("li"),t=e.data("index");SetInputChoice(e.data("input_id"),t,e.find(".field-choice-value").val(),e.find(".field-choice-text").val())}).on("click keypress",".field-input-insert-choice",function(){var e=jQuery(this).closest("li"),t=e.closest("ul"),i=e.data("index");InsertInputChoice(t,e.data("input_id"),i+1)}).on("click keypress",".field-input-delete-choice",function(){var e=jQuery(this).closest("li"),t=e.closest("ul"),i=e.data("index");DeleteInputChoice(t,e.data("input_id"),i)}),jQuery(".field_input_choice_values_enabled").on("click keypress",function(){var e=jQuery(this).parent().siblings(".gfield_settings_input_choices_container");ToggleInputChoiceValue(e,this.checked),SetInputChoices(e.find("ul"))}),jQuery(".input_placeholders_setting").on("input propertychange",".input_placeholder",function(){var e=jQuery(this).closest(".input_placeholder_row").data("input_id");SetInputPlaceholder(this.value,e)}).on("input propertychange","#field_single_placeholder",function(){SetFieldPlaceholder(this.value)}),jQuery("#field_rich_text_editor").on("click keypress",function(){var e=GetSelectedField();if(this.checked){var t=!0;HasConditionalLogicDependency(e.id,e.value)&&(confirm(gf_vars.conditionalLogicRichTextEditorWarning)||(jQuery("#field_rich_text_editor").prop("checked",!1),t=!1)),t&&(jQuery("#field_placeholder, #field_placeholder_textarea").prop("disabled",!0),jQuery("span#placeholder_warning").css("display","block"))}else jQuery("#field_placeholder, #field_placeholder_textarea").prop("disabled",!1),jQuery("span#placeholder_warning").css("display","none")}),jQuery(".prepopulate_field_setting").on("input propertychange",".field_input_name",function(){var e=jQuery(this).closest(".field_input_name_row").data("input_id");SetInputName(this.value,e)}).on("input propertychange","#field_input_name",function(){SetInputName(this.value)}),jQuery(".custom_inputs_setting, .custom_inputs_sub_setting, .sub_labels_setting").on("click keypress",".input_active_icon",function(){var e=jQuery(this).closest(".field_custom_input_row").data("input_id");ToggleInputHidden(this,e)}).on("input propertychange",".field_custom_input_default_label",function(){var e=jQuery(this).closest(".field_custom_input_row").data("input_id");SetInputCustomLabel(this.value,e)}).on("input propertychange","#field_single_custom_label",function(){SetInputCustomLabel(this.value)}),jQuery(".default_input_values_setting").on("input propertychange",".default_input_value",function(){var e=jQuery(this).closest(".default_input_value_row").data("input_id");SetInputDefaultValue(this.value,e)}).on("input","#field_single_default_value",function(){SetFieldDefaultValue(this.value)}),jQuery(".choices_setting, .columns_setting").on("input propertychange",".field-choice-input",function(e){var t=jQuery(this),i=t.closest("li.field-choice-row");SetFieldChoice(i.data("input_type"),i.data("index")),(t.hasClass("field-choice-text")||t.hasClass("field-choice-value"))&&(CheckChoiceConditionalLogicDependency(this),e.stopPropagation())}),jQuery("#field_enable_copy_values_option").on("click keypress",function(){SetCopyValuesOptionProperties(this.checked),ToggleCopyValuesOption(!1),0==this.checked&&ToggleCopyValuesActivated(!1)}),jQuery("#field_copy_values_option_label").on("input propertychange",function(){SetCopyValuesOptionLabel(this.value)}),jQuery("#field_copy_values_option_field").on("change",function(){SetFieldProperty("copyValuesOptionField",jQuery(this).val())}),jQuery("#field_copy_values_option_default").on("change",function(){SetFieldProperty("copyValuesOptionDefault",1==this.checked?1:0),ToggleCopyValuesActivated(this.checked)}),jQuery("#field_label").on("input propertychange",function(){SetFieldLabel(this.value)}),jQuery("#field_description").on("blur",function(){GetSelectedField().description!=this.value&&(SetFieldDescription(this.value),RefreshSelectedFieldPreview())}),jQuery("#field_checkbox_label").on("input propertychange",function(){GetSelectedField().checkboxLabel!=this.value&&(SetFieldCheckboxLabel(this.value),RefreshSelectedFieldPreview())}),jQuery("#field_content").on("input propertychange",function(){SetFieldProperty("content",this.value)}),jQuery("#next_button_text_input, #next_button_image_url").on("input propertychange",function(){SetPageButton("next")}),jQuery("#previous_button_image_url, #previous_button_text_input").on("input propertychange",function(){SetPageButton("previous")}),jQuery("#field_custom_field_name_text").on("input propertychange",function(){SetFieldProperty("postCustomFieldName",this.value)}),jQuery("#field_customfield_content_template").on("input propertychange",function(){SetCustomFieldTemplate()}),jQuery("#gfield_calendar_icon_url").on("input propertychange",function(){SetFieldProperty("calendarIconUrl",this.value)}),jQuery("#field_max_files").on("input propertychange",function(){SetFieldProperty("maxFiles",this.value)}),jQuery("#field_maxrows").on("input propertychange",function(){SetFieldProperty("maxRows",this.value)}),jQuery("#field_mask_text").on("input propertychange",function(){SetFieldProperty("inputMaskValue",this.value)}),jQuery("#field_file_extension").on("input propertychange",function(){SetFieldProperty("allowedExtensions",this.value)}),jQuery("#field_maxlen").on("keypress",function(e){return ValidateKeyPress(e,GetMaxLengthPattern(),!1)}).on("change keyup",function(){SetMaxLength(this)}),jQuery("#field_range_min").on("input propertychange",function(){SetFieldProperty("rangeMin",this.value)}),jQuery("#field_range_max").on("input propertychange",function(){SetFieldProperty("rangeMax",this.value)}),jQuery("#field_calculation_formula").on("input propertychange",function(){SetFieldProperty("calculationFormula",this.value.trim())}),jQuery("#field_error_message").on("input propertychange",function(){SetFieldProperty("errorMessage",this.value)}),jQuery("#field_css_class").on("input propertychange",function(){SetFieldProperty("cssClass",this.value)}),jQuery("#field_admin_label").on("input propertychange",function(){SetFieldProperty("adminLabel",this.value)}),jQuery("#field_add_icon_url").on("input propertychange",function(){SetFieldProperty("addIconUrl",this.value)}),jQuery("#field_delete_icon_url").on("input propertychange",function(){SetFieldProperty("deleteIconUrl",this.value)})}function InitializeForm(e){0<e.fields.length&&jQuery("#no-fields").detach().appendTo("#no-fields-stash"),e.lastPageButton&&"image"===e.lastPageButton.type?jQuery("#last_page_button_image").prop("checked",!0):e.lastPageButton&&"image"===e.lastPageButton.type||jQuery("#last_page_button_text").prop("checked",!0),jQuery("#last_page_button_text_input").val(e.lastPageButton?e.lastPageButton.text:gf_vars.previousLabel),jQuery("#last_page_button_image_url").val(e.lastPageButton?e.lastPageButton.imageUrl:""),TogglePageButton("last_page",!0),e.postStatus&&jQuery("#field_post_status").val(e.postStatus),e.postAuthor&&jQuery("#field_post_author").val(e.postAuthor),void 0===e.useCurrentUserAsAuthor&&(e.useCurrentUserAsAuthor=!0),jQuery("#gfield_current_user_as_author").prop("checked",!!e.useCurrentUserAsAuthor),e.postCategory&&jQuery("#field_post_category").val(e.postCategory),e.postFormat&&jQuery("#field_post_format").val(e.postFormat),e.postContentTemplateEnabled?(jQuery("#gfield_post_content_enabled").prop("checked",!0),jQuery("#field_post_content_template").val(e.postContentTemplate)):(jQuery("#gfield_post_content_enabled").prop("checked",!1),jQuery("#field_post_content_template").val("")),TogglePostContentTemplate(!0),e.postTitleTemplateEnabled?(jQuery("#gfield_post_title_enabled").prop("checked",!0),jQuery("#field_post_title_template").val(e.postTitleTemplate)):(jQuery("#gfield_post_title_enabled").prop("checked",!1),jQuery("#field_post_title_template").val("")),TogglePostTitleTemplate(!0),jQuery("#gform_last_page_settings").click(function(){FieldClick(this)}),jQuery("#gform_pagination").click(function(){FieldClick(this)}),jQuery("#gform_fields").on("click",".gfield",function(){FieldClick(this)});var t=e.pagination&&e.pagination.type?e.pagination.type:"percentage",i="percentage"===t,l="none"===t;"steps"===t?jQuery("#pagination_type_steps").prop("checked",!0):i?jQuery("#pagination_type_percentage").prop("checked",!0):l&&jQuery("#pagination_type_none").prop("checked",!0),jQuery("#first_page_css_class").val(e.firstPageCssClass),jQuery("#field_settings, #last_page_settings, #pagination_settings").tabs({selected:0}),TogglePageBreakSettings(),InitPaginationOptions(!0),InitializeFields()}function LoadFieldSettings(){field=GetSelectedField();var e=GetInputType(field);jQuery("#field_label").val(field.label),"html"==field.type?(jQuery(".tooltip_form_field_label_html").show(),jQuery(".tooltip_form_field_label").hide()):(jQuery(".tooltip_form_field_label_html").hide(),jQuery(".tooltip_form_field_label").show()),jQuery("#field_admin_label").val(field.adminLabel),jQuery("#field_content").val(null==field.content?"":field.content),jQuery("#post_custom_field_type").val(field.inputType),jQuery("#post_tag_type").val(field.inputType),jQuery("#field_size").val(field.size),jQuery("#field_required").prop("checked",1==field.isRequired),jQuery("#field_margins").prop("checked",1==field.disableMargins),jQuery("#field_no_duplicates").prop("checked",1==field.noDuplicates),jQuery("#field_default_value").val(null==field.defaultValue?"":field.defaultValue),jQuery("#field_default_value_textarea").val(null==field.defaultValue?"":field.defaultValue),jQuery("#field_description").val(null==field.description?"":field.description),jQuery("#field_description").attr("placeholder",null==field.descriptionPlaceholder?"":field.descriptionPlaceholder),jQuery("#field_checkbox_label").val(null==field.checkboxLabel?"":field.checkboxLabel),jQuery("#field_css_class").val(null==field.cssClass?"":field.cssClass),jQuery("#field_range_min").val(null==field.rangeMin||!1===field.rangeMin?"":field.rangeMin),jQuery("#field_range_max").val(null==field.rangeMax||!1===field.rangeMax?"":field.rangeMax),jQuery("#field_name_format").val(field.nameFormat),jQuery("#field_force_ssl").prop("checked",!!field.forceSSL),jQuery("#credit_card_style").val(field.creditCardStyle?field.creditCardStyle:"style1"),field.useRichTextEditor?(jQuery("#field_placeholder, #field_placeholder_textarea").prop("disabled",!0),jQuery("span#placeholder_warning").css("display","block")):(jQuery("#field_placeholder, #field_placeholder_textarea").prop("disabled",!1),jQuery("span#placeholder_warning").css("display","none")),void 0===field.labelPlacement&&(field.labelPlacement=""),void 0===field.descriptionPlacement&&(field.descriptionPlacement=""),void 0===field.subLabelPlacement&&(field.subLabelPlacement=""),jQuery("#field_label_placement").val(field.labelPlacement),jQuery("#field_description_placement").val(field.descriptionPlacement),jQuery("#field_sub_label_placement").val(field.subLabelPlacement),"left_label"==field.labelPlacement||"right_label"==field.labelPlacement||""==field.labelPlacement&&"top_label"!=form.labelPlacement?jQuery("#field_description_placement_container").hide():jQuery("#field_description_placement_container").show(),SetFieldVisibility(field.visibility,!0),void 0===field.placeholder&&(field.placeholder=""),jQuery("#field_placeholder, #field_placeholder_textarea").val(field.placeholder),jQuery("#field_file_extension").val(null==field.allowedExtensions?"":field.allowedExtensions),jQuery("#field_multiple_files").prop("checked",!!field.multipleFiles),jQuery("#field_max_files").val(field.maxFiles?field.maxFiles:""),jQuery("#field_max_file_size").val(field.maxFileSize?field.maxFileSize+"MB":""),ToggleMultiFile(!0),jQuery("#field_phone_format").val(field.phoneFormat),jQuery("#field_error_message").val(field.errorMessage),jQuery("#field_select_all_choices").prop("checked",!!field.enableSelectAll),jQuery("#field_other_choice").prop("checked",!!field.enableOtherChoice),jQuery("#field_add_icon_url").val(field.addIconUrl?field.addIconUrl:""),jQuery("#field_delete_icon_url").val(field.deleteIconUrl?field.deleteIconUrl:""),jQuery("#gfield_enable_enhanced_ui").prop("checked",!!field.enableEnhancedUI),jQuery("#gfield_password_strength_enabled").prop("checked",1==field.passwordStrengthEnabled),jQuery("#gfield_password_visibility_enabled").prop("checked",1==field.passwordVisibilityEnabled),TogglePasswordVisibility(!0),jQuery("#gfield_min_strength").val(null==field.minPasswordStrength?"":field.minPasswordStrength),TogglePasswordStrength(!0),jQuery("#gfield_email_confirm_enabled").prop("checked",1==field.emailConfirmEnabled),field.numberFormat?jQuery("#field_number_format_blank").remove():0==jQuery("#field_number_format #field_number_format_blank").length&&jQuery("#field_number_format").prepend("<option id='field_number_format_blank' value=''>"+gf_vars.selectFormat+"</option>"),jQuery("#field_number_format").val(field.numberFormat?field.numberFormat:""),"product"==field.type&&"calculation"==field.inputType?(field.enableCalculation=!0,jQuery(".field_calculation_rounding").hide(),jQuery(".field_enable_calculation").hide()):(jQuery(".field_enable_calculation").show(),"number"==field.type&&"currency"==field.numberFormat?jQuery(".field_calculation_rounding").hide():jQuery(".field_calculation_rounding").show()),jQuery("#field_enable_calculation").prop("checked",!!field.enableCalculation),ToggleCalculationOptions(field.enableCalculation,field),jQuery("#field_calculation_formula").val(field.calculationFormula);var t=gformIsNumber(field.calculationRounding)?field.calculationRounding:"norounding";jQuery("#field_calculation_rounding").val(t),jQuery("#option_field_type").val(field.inputType);var i=jQuery("#product_field_type");if(i.val(field.inputType),has_entry(field.id)?i.prop("disabled",!0):i.prop("disabled",!1),jQuery("#donation_field_type").val(field.inputType),jQuery("#quantity_field_type").val(field.inputType),"hiddenproduct"==field.inputType||"singleproduct"==field.inputType||"singleshipping"==field.inputType||"calculation"==field.inputType){var l=null==field.basePrice?"":field.basePrice;jQuery("#field_base_price").val(null==field.basePrice?"":field.basePrice),SetBasePrice(l)}jQuery("#shipping_field_type").val(field.inputType),jQuery("#field_disable_quantity").prop("checked",1==field.disableQuantity),SetDisableQuantity(1==field.disableQuantity);var d=!!field.enablePasswordInput;jQuery("#field_password").prop("checked",d),jQuery("#field_maxlen").val(void 0===field.maxLength?"":field.maxLength),jQuery("#field_maxrows").val(void 0===field.maxRows?"":field.maxRows);var a=null==field.addressType?"international":field.addressType;jQuery("#field_address_type").val(a),"address"==field.type&&(field=UpgradeAddressField(field)),"email"!=field.type&&"email"!=field.inputType||(field=UpgradeEmailField(field)),"consent"===field.type&&(field=UpgradeConsentField(field));var r=null==field.defaultState?"":field.defaultState,n=null==field.defaultProvince?"":field.defaultProvince,o="canadian"==a&&""==r?n:r;jQuery("#field_address_default_state_"+a).val(o),jQuery("#field_address_default_country_"+a).val(null==field.defaultCountry?"":field.defaultCountry),SetAddressType(!0),jQuery("#gfield_display_title").prop("checked",1==field.displayTitle),jQuery("#gfield_display_caption").prop("checked",1==field.displayCaption),jQuery("#gfield_display_description").prop("checked",1==field.displayDescription);var s=CustomFieldExists(field.postCustomFieldName);jQuery("#field_custom_field_name_select")[0].selectedIndex=0,jQuery("#field_custom_field_name_text").val(""),s?jQuery("#field_custom_field_name_select").val(field.postCustomFieldName):jQuery("#field_custom_field_name_text").val(field.postCustomFieldName),s?jQuery("#field_custom_existing").prop("checked",!0):jQuery("#field_custom_new").prop("checked",!0),ToggleCustomField(!0),jQuery("#gfield_customfield_content_enabled").prop("checked",!!field.customFieldTemplateEnabled),jQuery("#field_customfield_content_template").val(field.customFieldTemplateEnabled?field.customFieldTemplate:""),ToggleCustomFieldTemplate(!0),field.displayAllCategories?jQuery("#gfield_category_all").prop("checked",!0):jQuery("#gfield_category_select").prop("checked",!0),ToggleCategory(!0),jQuery("#gfield_post_category_initial_item_enabled").prop("checked",!!field.categoryInitialItemEnabled),jQuery("#field_post_category_initial_item").val(field.categoryInitialItemEnabled?field.categoryInitialItem:""),TogglePostCategoryInitialItem(!0);var c=!!field.postFeaturedImage;jQuery("#gfield_featured_image").prop("checked",c),"boolean"!=typeof field.inputMaskIsCustom&&(field.inputMaskIsCustom=!IsStandardMask(field.inputMaskValue));var u=!field.inputMaskIsCustom;if(jQuery("#field_input_mask").prop("checked",!!field.inputMask),u?(jQuery("#field_mask_standard").prop("checked",!0),jQuery("#field_mask_select").val(field.inputMaskValue)):(jQuery("#field_mask_custom").prop("checked",!0),jQuery("#field_mask_text").val(field.inputMaskValue)),ToggleInputMask(!0),ToggleInputMaskOptions(!0),"creditcard"==e)for(y in field=UpgradeCreditCardField(field),(!field.creditCards||field.creditCards.length<=0)&&(field.creditCards=["amex","visa","discover","mastercard"]),field.creditCards)field.creditCards.hasOwnProperty(y)&&jQuery("#field_credit_card_"+field.creditCards[y]).prop("checked",!0);"date"==e&&(field=UpgradeDateField(field)),"time"==e&&(field=UpgradeTimeField(field)),CreateDefaultValuesUI(field),CreatePlaceholdersUI(field),CreateCustomizeInputsUI(field),CreateInputLabelsUI(field),field.dateType||"date"!=e||(field.dateType="datepicker"),jQuery("#field_date_input_type").val(field.dateType),jQuery("#gfield_calendar_icon_url").val(null==field.calendarIconUrl?"":field.calendarIconUrl),jQuery("#field_date_format").val("dmy"==field.dateFormat?"dmy":field.dateFormat),jQuery("#field_time_format").val("24"==field.timeFormat?"24":"12"),SetCalendarIconType(field.calendarIconType,!0),ToggleDateCalendar(!0),LoadDateInputs(),LoadTimeInputs(),field.allowsPrepopulate=!!field.allowsPrepopulate,field.useRichTextEditor=!!field.useRichTextEditor,jQuery("#field_prepopulate").prop("checked",!!field.allowsPrepopulate),jQuery("#field_rich_text_editor").prop("checked",!!field.useRichTextEditor),has_entry(field.id)?jQuery("#field_rich_text_editor").prop("disabled",!0):jQuery("#field_rich_text_editor").prop("disabled",!1),CreateInputNames(field),ToggleInputName(!0);var f=0<GetFirstRuleField();"page"==field.type?(LoadFieldConditionalLogic(f,"next_button"),LoadFieldConditionalLogic(f,"page")):LoadFieldConditionalLogic(f,"field"),jQuery("#field_enable_copy_values_option").prop("checked",1==field.enableCopyValuesOption),jQuery("#field_copy_values_option_default").prop("checked",1==field.copyValuesOptionDefault);var _=GetCopyValuesFieldsOptions(field.copyValuesOptionField,field);0<_.length?(jQuery("#field_enable_copy_values_option").prop("disabled",!1),jQuery("#field_copy_values_disabled").hide(),jQuery("#field_copy_values_option_field").html(_)):(jQuery("#field_enable_copy_values_option").prop("disabled",!0),jQuery("#field_copy_values_disabled").show()),ToggleCopyValuesOption(field.enableCopyValuesOption,!0),field.nextButton&&("image"==field.nextButton.type?jQuery("#next_button_image").prop("checked",!0):jQuery("#next_button_text").prop("checked",!0),jQuery("#next_button_text_input").val(field.nextButton.text),jQuery("#next_button_image_url").val(field.nextButton.imageUrl)),field.previousButton&&("image"==field.previousButton.type?jQuery("#previous_button_image").prop("checked",!0):jQuery("#previous_button_text").prop("checked",!0),jQuery("#previous_button_text_input").val(field.previousButton.text),jQuery("#previous_button_image_url").val(field.previousButton.imageUrl)),TogglePageButton("next",!0),TogglePageButton("previous",!0),jQuery(".gfield_category_checkbox").each(function(){if(field.choices)for(var e=0;e<field.choices.length;e++)if(this.value==field.choices[e].value)return void(this.checked=!0);this.checked=!1}),has_entry(field.id)?jQuery("#field_type, #field_multiple_files").prop("disabled",!0):jQuery("#field_type, #field_multiple_files").prop("disabled",!1),jQuery("#field_custom_field_name").val(field.postCustomFieldName),jQuery("#field_columns_enabled").prop("checked",Boolean(field.enableColumns)).prop("disabled",has_entry(field.id)),LoadFieldChoices(field),jQuery(".field_setting").hide();var p=fieldSettings[field.type];field.inputType&&"post_category"!=field.type&&(p+=","+fieldSettings[field.inputType]),jQuery(p).show();for(var y=0;y<form.fields.length;y++)if("post_category"==form.fields[y].type){jQuery(".post_category_setting").hide();break}"post_category"==field.type&&"select"!=e&&(jQuery(".post_category_initial_item_setting").hide(),jQuery("#gfield_post_category_initial_item_enabled").prop("checked",!1),SetCategoryInitialItem()),"quantity"==field.type&&jQuery(".calculation_setting").hide(),jQuery("#post_category_field_type").val(field.inputType);var g=null==field.simpleCaptchaFontColor?"":field.simpleCaptchaFontColor;jQuery("#field_captcha_fg").val(g),SetColorPickerColor("field_captcha_fg",g);var h=null==field.simpleCaptchaBackgroundColor?"":field.simpleCaptchaBackgroundColor;if(jQuery("#field_captcha_bg").val(h),SetColorPickerColor("field_captcha_bg",h),jQuery("#field_captcha_type").val(null==field.captchaType?"captcha":field.captchaType),jQuery("#field_captcha_badge").val(null==field.captchaBadge?"bottomright":field.captchaBadge),jQuery("#field_captcha_size").val(null==field.simpleCaptchaSize?"medium":field.simpleCaptchaSize),"captcha"==field.type){var m=".captcha_language_setting, .captcha_theme_setting",j=".captcha_size_setting, .captcha_fg_setting, .captcha_bg_setting";"simple_captcha"==field.captchaType||"math"==field.captchaType?(jQuery(j).show(),jQuery(m).hide()):(jQuery(j).hide(),jQuery(m).show());var v=null==field.captchaTheme||["blackglass","dark"].indexOf(field.captchaTheme)<0?"light":"dark";jQuery("#field_captcha_theme").val(v).show();var Q=null==field.captchaLanguage?"en":field.captchaLanguage;jQuery("#field_captcha_language").val(Q).show(),jQuery('#field_captcha_type option[value="captcha"]').length<1&&jQuery("#field_captcha_type").prepend('<option value="captcha">reCAPTCHA</option>')}if("post_custom_field"!=field.type||"textarea"!=field.inputType&&"text"!=field.inputType||jQuery(".customfield_content_template_setting").show(),"name"==field.type&&(void 0===field.nameFormat||"advanced"!=field.nameFormat?field=MaybeUpgradeNameField(field):SetUpAdvancedNameField(),"simple"==field.nameFormat?(jQuery(".default_value_setting").show(),jQuery(".size_setting").show(),jQuery("#field_name_fields_container").html("").hide(),jQuery(".sub_label_placement_setting").hide(),jQuery(".name_prefix_choices_setting").hide(),jQuery(".name_format_setting").hide(),jQuery(".name_setting").hide(),jQuery(".default_input_values_setting").hide(),jQuery(".default_value_setting").show()):"extended"==field.nameFormat&&(jQuery(".name_format_setting").show(),jQuery(".name_prefix_choices_setting").hide(),jQuery(".name_setting").hide(),jQuery(".default_input_values_setting").hide(),jQuery(".input_placeholders_setting").hide())),-1!=jQuery.inArray(field.type,["product","option","shipping"])&&jQuery(".other_choice_setting").hide(),field.enableCalculation&&jQuery("li.range_setting").hide(),"text"==field.type&&(field.inputMask?jQuery(".maxlen_setting").hide():jQuery(".maxlen_setting").show()),"date"==e&&ToggleDateSettings(field),"email"==e&&ToggleEmailSettings(field),"password"===field.type||"password"===field.inputType){field=UpgradePasswordField(field);var b=GetCustomizeInputsUI(field);jQuery("#field_password_fields_container").html(b),jQuery("#field_password_fields_container table tr:eq(1) td:eq(0) img").remove(),"undefined"!=field.inputs[1].isHidden&&field.inputs[1].isHidden||jQuery(".size_setting").hide(),jQuery(".password_setting .custom_inputs_setting ").on("click keypress",".input_active_icon",function(){var e=GetSelectedField(),t=!e.inputs[1].isHidden,i=jQuery('label[for="input_'+e.id+'"]');t?(i.show(),jQuery(".size_setting").hide()):(i.hide(),jQuery(".size_setting").show())})}jQuery(document).trigger("gform_load_field_settings",[field,form]),jQuery("#field_settings").appendTo(".field_selected"),jQuery("#field_settings").tabs("option","active",0),ShowSettings("field_settings"),gform.doAction("gform_post_load_field_settings",[field,form]),SetProductField(field);var k=[];0==jQuery("#gform_tab_3 li.field_setting").filter(function(){return jQuery(this).is(":hidden")&&"none"!=jQuery(this).css("display")}).length&&k.push(1),0==jQuery("#gform_tab_2 li.field_setting").filter(function(){return jQuery(this).is(":hidden")&&"none"!=jQuery(this).css("display")}).length&&k.push(2),0<k.length?jQuery("#field_settings").tabs({disabled:k}):jQuery("#field_settings").tabs({disabled:[]}),Placeholders.enable()}function ToggleDateSettings(e){var t="datefield"==e.dateType,i="datepicker"==e.dateType,l="datedropdown"==e.dateType;jQuery(".placeholder_setting").toggle(i),jQuery(".default_value_setting").toggle(i),jQuery(".sub_label_placement_setting").toggle(t),jQuery(".sub_labels_setting").toggle(t),jQuery(".default_input_values_setting").toggle(l||t),jQuery(".input_placeholders_setting").toggle(l||t)}function SetUpAdvancedNameField(){field=GetSelectedField(),jQuery(".name_format_setting").hide(),jQuery(".name_setting").show(),jQuery(".name_prefix_choices_setting").show();var e=GetCustomizeInputsUI(field);jQuery("#field_name_fields_container").html(e).show();var t=GetInput(field,field.id+".2"),i=GetInputChoices(t);jQuery("#field_prefix_choices").html(i),ToggleNamePrefixUI(!t.isHidden),jQuery(".name_setting .custom_inputs_setting").on("click",".input_active_icon",function(){0<=jQuery(this).data("input_id").toString().indexOf(".2")&&ToggleNamePrefixUI(0<=this.src.indexOf("active1.png"))}),jQuery(".default_value_setting").hide(),jQuery(".default_input_values_setting").show(),jQuery(".input_placeholders_setting").show(),CreateDefaultValuesUI(field),CreatePlaceholdersUI(field),CreateInputNames(field)}function GetCopyValuesFieldsOptions(e,t){for(var i,l,d,a,r=[],n=GetInputType(t),o=0;o<form.fields.length;o++)(l=form.fields[o]).id==t.id||GetInputType(l)!=n||l.enableCopyValuesOption||(i=GetLabel(l),a=e==l.id?'selected="selected"':"",d='<option value="'+l.id+'" '+a+">"+i+"</option>",r.push(d));return r.join("")}function ToggleNamePrefixUI(e){jQuery(".name_prefix_choices_setting").toggle(e)}function TogglePageBreakSettings(){HasPageBreak()?(jQuery("#gform_last_page_settings").show(),jQuery("#gform_pagination").show()):(jQuery("#gform_last_page_settings").hide(),jQuery("#gform_pagination").hide())}function SetDisableQuantity(e){SetFieldProperty("disableQuantity",e),e?jQuery(".field_selected .ginput_quantity_label, .field_selected .ginput_quantity").hide():jQuery(".field_selected .ginput_quantity_label, .field_selected .ginput_quantity").show()}function SetBasePrice(e){e=e||0;var t=GetCurrentCurrency().toMoney(e);0==t&&(t=0),jQuery("#field_base_price").val(t),SetFieldProperty("basePrice",t),jQuery(".field_selected .ginput_product_price, .field_selected .ginput_shipping_price").html(t),jQuery(".field_selected .ginput_amount").val(t)}function ChangeAddressType(){if(field=GetSelectedField(),"address"==field.type){var e=jQuery("#field_address_type").val(),t=GetInput(field,field.id+".6"),i=jQuery("#field_address_country_"+e).val();t.isHidden=""!=i,SetAddressType(!1)}}function SetAddressType(e){if(field=GetSelectedField(),"address"==field.type){SetAddressProperties(),jQuery(".gfield_address_type_container").hide();var t=e?"":"slow";jQuery("#address_type_container_"+jQuery("#field_address_type").val()).show(t),CreatePlaceholdersUI(field)}}function UpdateAddressFields(){var e=jQuery("#field_address_type").val();field=GetSelectedField();var t=GetCustomizeInputsUI(field);jQuery("#field_address_fields_container").html(t);var i=GetInput(field,field.id+".5"),l=jQuery("#field_address_zip_label_"+e).val();jQuery("#field_custom_input_default_label_"+field.id+"_5").text(l),jQuery("#field_custom_input_label_"+field.id+"\\.5").attr("placeholder",l),i.customLabel||jQuery(".field_selected #input_"+field.id+"_5_label").html(l);var d=GetInput(field,field.id+".4"),a=jQuery("#field_address_state_label_"+e).val();if(jQuery("#field_custom_input_default_label_"+field.id+"_4").text(a),jQuery("#field_custom_input_label_"+field.id+"\\.4").attr("placeholder",a),d.customLabel||jQuery(".field_selected #input_"+field.id+"_4_label").html(a),""!=jQuery("#field_address_country_"+e).val()?(jQuery(".field_selected #input_"+field.id+"_6_container").hide(),jQuery(".field_custom_input_row_input_"+field.id+"_6").hide()):(jQuery(".field_selected #input_"+field.id+"_6").val(jQuery("#field_address_default_country_"+e).val()),jQuery(".field_selected #input_"+field.id+"_6_container").show(),jQuery(".field_selected .field_custom_input_row_input_"+field.id+"_6").show()),""!=jQuery("#field_address_has_states_"+e).val()){jQuery(".field_selected .state_text").hide();var r=jQuery("#field_address_default_state_"+e).val(),n=jQuery(".field_selected .state_dropdown");n.append(jQuery("<option></option>").val(r).html(r)),n.val(r).show()}else jQuery(".field_selected .state_dropdown").hide(),jQuery(".field_selected .state_text").show()}function SetAddressProperties(){field=GetSelectedField();var e=jQuery("#field_address_type").val();SetFieldProperty("addressType",e),SetFieldProperty("defaultState",jQuery("#field_address_default_state_"+e).val()),SetFieldProperty("defaultProvince","");var t=jQuery("#field_address_country_"+e).val();""==t&&(t=jQuery("#field_address_default_country_"+e).val()),SetFieldProperty("defaultCountry",t),UpdateAddressFields()}function MaybeUpgradeNameField(e){return void 0!==e.nameFormat&&""!=e.nameFormat&&"normal"!=e.nameFormat&&("simple"!=e.nameFormat||has_entry(e.id))||(e=UpgradeNameField(e,!0,!0,!0)),e}function UpgradeNameField(e,t,i,l){return e.nameFormat="advanced",e.inputs=MergeInputArrays(GetAdvancedNameFieldInputs(e,t,i,l),e.inputs),RefreshSelectedFieldPreview(function(){SetUpAdvancedNameField()}),e}function UpgradeDateField(e){return"date"!=e.type&&"date"!=e.inputType||void 0===e.dateType||"datepicker"==e.dateType||e.inputs||(e.inputs=GetDateFieldInputs(e)),e}function UpgradeTimeField(e){return"time"!=e.type&&"time"!=e.inputType||e.inputs||(e.inputs=GetTimeFieldInputs(e)),e}function UpgradeEmailField(e){return"email"!=e.type&&"email"!=e.inputType||e.emailConfirmEnabled&&!e.inputs&&(e.inputs=GetEmailFieldInputs(e),e.inputs[0].placeholder=e.placeholder),e}function UpgradePasswordField(e){return"password"!=e.type&&"password"!=e.inputType||e.inputs||(e.inputs=GetPasswordFieldInputs(e),e.inputs[0].placeholder=e.placeholder),e}function UpgradeAddressField(e){e.hideCountry&&(GetInput(e,e.id+".6").isHidden=!0);delete e.hideCountry,e.hideAddress2&&(GetInput(e,e.id+".2").isHidden=!0);delete e.hideAddress2,e.hideState&&(GetInput(e,e.id+".4").isHidden=!0);return delete e.hideState,e}function UpgradeConsentField(e){return"consent"!==e.type||e.choices[1]&&"0"===e.choices[1].value&&e.choices.pop(),e}function TogglePasswordVisibility(e){jQuery("#gfield_password_visibility_enabled").is(":checked")?jQuery(".gfield.field_selected .ginput_container_password span button").show():jQuery(".gfield.field_selected .ginput_container_password span button").hide()}function TogglePasswordStrength(e){var t=e?"":"slow";jQuery("#gfield_password_strength_enabled").is(":checked")?jQuery("#gfield_min_strength_container").show(t):jQuery("#gfield_min_strength_container").hide(t)}function ToggleCategory(e){var t=e?"":"slow";jQuery("#gfield_category_all").is(":checked")?(jQuery("#gfield_settings_category_container").hide(t),SetFieldProperty("displayAllCategories",!0),SetFieldProperty("choices",new Array)):(jQuery("#gfield_settings_category_container").show(t),SetFieldProperty("displayAllCategories",!1))}function SetCopyValuesOptionLabel(e){SetFieldProperty("copyValuesOptionLabel",e),jQuery(".field_selected .copy_values_option_label").html(e)}function SetCustomFieldTemplate(){var e=jQuery("#gfield_customfield_content_enabled").is(":checked");SetFieldProperty("customFieldTemplate",e?jQuery("#field_customfield_content_template").val():null),SetFieldProperty("customFieldTemplateEnabled",e)}function SetCategoryInitialItem(){var e=jQuery("#gfield_post_category_initial_item_enabled").is(":checked");SetFieldProperty("categoryInitialItem",e?jQuery("#field_post_category_initial_item").val():null),SetFieldProperty("categoryInitialItemEnabled",e)}function PopulateContentTemplate(e){if(0==jQuery("#"+e).val().length){var t=GetSelectedField();jQuery("#"+e).val("{"+t.label+":"+t.id+"}")}}function TogglePostContentTemplate(e){var t=e?"":"slow";jQuery("#gfield_post_content_enabled").is(":checked")?(jQuery("#gfield_post_content_container").show(t),e||PopulateContentTemplate("field_post_content_template")):jQuery("#gfield_post_content_container").hide(t)}function TogglePostTitleTemplate(e){var t=e?"":"slow";jQuery("#gfield_post_title_enabled").is(":checked")?(jQuery("#gfield_post_title_container").show(t),e||PopulateContentTemplate("field_post_title_template")):jQuery("#gfield_post_title_container").hide(t)}function ToggleCustomFieldTemplate(e){var t=e?"":"slow";jQuery("#gfield_customfield_content_enabled").is(":checked")?(jQuery("#gfield_customfield_content_container").show(t),e||PopulateContentTemplate("field_customfield_content_template")):jQuery("#gfield_customfield_content_container").hide(t)}function ToggleInputName(e){var t=e?"":"slow";jQuery("#field_prepopulate").is(":checked")?jQuery("#field_input_name_container").show(t):(jQuery("#field_input_name_container").hide(t),jQuery("#field_input_name").val(""))}function SetFieldColumns(){SetFieldChoices()}function ToggleChoiceValue(e){var t=GetSelectedField(),i=t.enablePrice?"_and_price":"",l=jQuery("#gfield_settings_choices_container");l.removeClass("choice_with_price choice_with_value choice_with_value_and_price"),jQuery("#field_choice_values_enabled").is(":checked")?l.addClass("choice_with_value"+i):t.enablePrice&&l.addClass("choice_with_price")}function ToggleInputChoiceValue(e,t){void 0===t&&(t=!1);var i=GetSelectedField(),l=e.find("li").data("input_id");GetInput(i,l).enableChoiceValue=t,e.removeClass("choice_with_value"),t&&e.addClass("choice_with_value")}function ToggleCopyValuesActivated(e){jQuery(".field_selected .copy_values_activated").prop("checked",e);var t=GetSelectedField();jQuery("#input_"+t.id).toggle(!e)}function TogglePageButton(e,t){var i=jQuery("#"+e+"_button_text").is(":checked");show_element=i?"#"+e+"_button_text_container":"#"+e+"_button_image_container",hide_element=i?"#"+e+"_button_image_container":"#"+e+"_button_text_container",t?(jQuery(hide_element).hide(),jQuery(show_element).show()):(jQuery(hide_element).hide(),jQuery(show_element).fadeIn(800))}function SetPageButton(e){field=GetSelectedField();var t=jQuery("#"+e+"_button_image").is(":checked")?"image":"text";"image"==(field[e+"Button"].type=t)?(field[e+"Button"].text="",field[e+"Button"].imageUrl=jQuery("#"+e+"_button_image_url").val()):(field[e+"Button"].text=jQuery("#"+e+"_button_text_input").val(),field[e+"Button"].imageUrl="")}function ToggleCustomField(e){var t=jQuery("#field_custom_existing").is(":checked");show_element=t?"#field_custom_field_name_select":"#field_custom_field_name_text",hide_element=t?"#field_custom_field_name_text":"#field_custom_field_name_select";jQuery(hide_element).hide(""),jQuery(show_element).show("")}function ToggleInputMask(e){var t=e?"":"slow";jQuery("#field_input_mask").is(":checked")?(jQuery("#gform_input_mask").show(t),jQuery(".maxlen_setting").hide(),SetFieldProperty("inputMask",!0),jQuery("#field_maxlen").val(""),SetFieldProperty("maxLength","")):(jQuery("#gform_input_mask").hide(t),jQuery(".maxlen_setting").show(),SetFieldProperty("inputMask",!1),SetFieldProperty("inputMaskValue",""),SetFieldProperty("inputMaskIsCustom",!1))}function ToggleInputMaskOptions(e){var t=jQuery("#field_mask_standard").is(":checked"),i=t?"#field_mask_select":"#field_mask_text, .mask_text_description";jQuery(t?"#field_mask_text, .mask_text_description":"#field_mask_select").val("").hide(""),jQuery(i).show(""),e||(SetFieldProperty("inputMaskValue",""),SetFieldProperty("inputMaskIsCustom",!t))}function ToggleAutoresponder(){jQuery("#form_autoresponder_enabled").is(":checked")?jQuery("#form_autoresponder_container").show("slow"):jQuery("#form_autoresponder_container").hide("slow")}function ToggleMultiFile(e){var t=e?"":"slow";if(jQuery("#field_multiple_files").prop("checked")){jQuery("#gform_multiple_files_options").show(t);var i=jQuery(".gform_fileupload_multifile").data("settings");i&&void 0!==i.chunk_size&&jQuery("#gform_server_max_file_size_notice").hide(),SetFieldProperty("multipleFiles",!0)}else jQuery("#gform_multiple_files_options").hide(t),SetFieldProperty("multipleFiles",!1),jQuery("#field_max_files").val(""),SetFieldProperty("maxFiles","");if(!e){var l=GetSelectedField();jQuery("#field_settings").slideUp(function(){StartChangeInputType("fileupload",l)})}}function HasPostContentField(){for(var e=0;e<form.fields.length;e++){if("post_content"==form.fields[e].type)return!0}return!1}function HasPostTitleField(){for(var e=0;e<form.fields.length;e++){if("post_title"==form.fields[e].type)return!0}return!1}function HasCustomField(){for(var e=0;e<form.fields.length;e++){if("post_custom_field"==form.fields[e].type)return!0}return!1}function HasPageBreak(){for(var e=0;e<form.fields.length;e++){if("page"==form.fields[e].type)return!0}return!1}function SetNextButtonConditionalLogic(e){GetSelectedField().nextButton.conditionalLogic=e?new ConditionalLogic:null}function UpdateFormObject(){if(form.postContentTemplateEnabled=!1,form.postTitleTemplateEnabled=!1,form.postTitleTemplate="",form.postContentTemplate="",HasPostField()&&(form.postAuthor=jQuery("#field_post_author").val()?jQuery("#field_post_author").val():"",form.useCurrentUserAsAuthor=jQuery("#gfield_current_user_as_author").is(":checked"),form.postCategory=jQuery("#field_post_category").val(),form.postFormat=0!=jQuery("#field_post_format").length?jQuery("#field_post_format").val():0,form.postStatus=jQuery("#field_post_status").val()),jQuery("#gfield_post_content_enabled").is(":checked")&&HasPostContentField()&&(form.postContentTemplateEnabled=!0,form.postContentTemplate=jQuery("#field_post_content_template").val()),jQuery("#gfield_post_title_enabled").is(":checked")&&HasPostTitleField()&&(form.postTitleTemplateEnabled=!0,form.postTitleTemplate=jQuery("#field_post_title_template").val()),jQuery("#gform_last_page_settings").is(":visible")?(form.lastPageButton=new Button,form.lastPageButton.type=jQuery("#last_page_button_text").is(":checked")?"text":"image","image"==form.lastPageButton.type?(form.lastPageButton.text="",form.lastPageButton.imageUrl=jQuery("#last_page_button_image_url").val()):(form.lastPageButton.text=jQuery("#last_page_button_text_input").val(),form.lastPageButton.imageUrl="")):form.lastPageButton=null,jQuery("#gform_pagination").is(":visible")){form.pagination=new Object;var e=jQuery('input[name="pagination_type"]:checked').val();form.pagination.type=e;var t=jQuery(".gform_page_names input");form.pagination.pages=new Array;for(var i=0;i<t.length;i++)form.pagination.pages.push(jQuery(t[i]).val());"percentage"==e?(form.pagination.style=jQuery("#percentage_style").val(),form.pagination.backgroundColor="custom"==form.pagination.style?jQuery("#percentage_style_custom_bgcolor").val():null,form.pagination.color="custom"==form.pagination.style?jQuery("#percentage_style_custom_color").val():null,form.pagination.display_progressbar_on_confirmation=jQuery("#percentage_confirmation_display").is(":checked"),form.pagination.progressbar_completion_text=jQuery("#percentage_confirmation_display").is(":checked")?jQuery("#percentage_confirmation_page_name").val():null):(form.pagination.backgroundColor=null,form.pagination.color=null,form.pagination.display_progressbar_on_confirmation=null,form.pagination.progressbar_completion_text=null),form.firstPageCssClass=jQuery("#first_page_css_class").val()}else form.pagination=null,form.firstPageCssClass=null;SortFields(),window.gform_before_update&&(form=window.gform_before_update(form),window.console&&console.log('"gform_before_update" is deprecated since version 1.7! Use the "gform_pre_form_editor_save" filter instead.')),form=gform.applyFilters("gform_pre_form_editor_save",form)}function EndUpdateForm(e){jQuery("#please_wait_container").hide(),jQuery("#after_update_dialog").hide(),jQuery("#after_update_error_dialog").hide(),e?jQuery("#after_update_dialog").slideDown():jQuery("#after_update_error_dialog").slideDown(),setTimeout(function(){jQuery("#after_update_dialog").slideUp()},5e3)}function SortFields(){var e=new Array;jQuery(".gfield").each(function(){id=this.id.substr(6),e.push(GetFieldById(id))}),form.fields=e}function DeleteField(e){var t=jQuery(e)[0].id.split("_")[2];if((HasConditionalLogicDependency(t)||confirm(gf_vars.confirmationDeleteField))&&(!HasConditionalLogicDependency(t)||confirm(gf_vars.conditionalLogicDependency))){form.deletedFields||(form.deletedFields=[]),form.deletedFields.push(t);for(var i=0;i<form.fields.length;i++)if(form.fields[i].id==t){form.fields.splice(i,1),jQuery("#field_settings").insertBefore("#gform_fields"),jQuery("#field_"+t).fadeOut("slow",function(){jQuery("#field_"+t).remove(),0===form.fields.length&&jQuery("#no-fields").detach().appendTo("#gform_fields").show()}),HideSettings("field_settings");break}TogglePageBreakSettings(),jQuery(document).trigger("gform_field_deleted",[form,t])}}function HasConditionalLogicDependencyLegwork(e,t){if(form.button&&ObjectHasConditionalLogicDependency(form.button,e,t))return!0;for(i in form.confirmations)if(form.confirmations.hasOwnProperty(i)&&ObjectHasConditionalLogicDependency(form.confirmations[i],e,t))return!0;for(i in form.notifications)if(form.notifications.hasOwnProperty(i)&&ObjectHasConditionalLogicDependency(form.notifications[i],e,t))return!0;for(i in form.fields)if(form.fields.hasOwnProperty(i)){var l=form.fields[i];if(ObjectHasConditionalLogicDependency(l,e,t))return!0;if("page"==GetInputType(l)&&ObjectHasConditionalLogicDependency(l.nextButton,e,t))return!0}return!1}function HasConditionalLogicDependency(e,t){var i=HasConditionalLogicDependencyLegwork(e,t);return gform.applyFilters("gform_has_conditional_logic_dependency",i,e,t)}function ObjectHasConditionalLogicDependency(e,t,l){if(!e.conditionalLogic)return!1;if(void 0===l)l=!1;var d=e.conditionalLogic.rules;for(i in d)if(d.hasOwnProperty(i)){var a=d[i];if(a.fieldId==t&&(!1===l||a.value==l)){if(!l&&!a.value){var r=GetFieldById(t);if(r&&r.choices&&r.placeholder)continue}return!0}}return!1}function HasDependentRule(e,t,l){for(i in void 0===l&&(l=!1),e)if(e.hasOwnProperty(i)){var d=e[i];if(d.fieldId==t&&(!1===l||d.value==l))return!0}return!1}function CheckChoiceConditionalLogicDependency(e){var t=GetSelectedField(),i=jQuery(e).data("previousValue");if(null==i&&(i=""),HasConditionalLogicDependency(t.id,i)){if(confirm(gf_vars.conditionalLogicDependencyChoiceEdit))return;jQuery(e).val(i).trigger("keyup"),jQuery(e).data("previousValue",i)}}function StartDuplicateField(e){var t=jQuery(e)[0].id.split("_")[2];for(fieldIndex in form.fields)if(form.fields.hasOwnProperty(fieldIndex)&&form.fields[fieldIndex].id==t){var i=Copy(form.fields[fieldIndex]);if(i.id=GetNextFieldId(),null!=i.inputs)for(inputIndex in i.inputs)if(i.inputs.hasOwnProperty(inputIndex)){var l=i.inputs[inputIndex].id+"",d=l==t?i.id:l.replace(/(\d+\.)/,i.id+".");i.inputs[inputIndex].id=d}return i=gform.applyFilters("gform_duplicate_field",i,form),i=gform.applyFilters("gform_duplicate_field_{0}".format(GetInputType(i)),i,form),form.fields.splice(fieldIndex,0,i),void DuplicateField(i,t)}}function EndDuplicateField(e,t,i){jQuery("#gform_fields li#field_"+i).after(t),jQuery("#field_"+e.id).animate({backgroundColor:"#FFFBCC"},"fast",function(){jQuery(this).animate({backgroundColor:"#FFF"},"fast",function(){jQuery(this).css("background-color","")})}),HideSettings("field_settings"),HideSettings("form_settings"),HideSettings("last_page_settings"),TogglePageBreakSettings(),InitializeFields()}function GetFieldsByType(e){for(var t=new Array,i=0;i<form.fields.length;i++)0<=IndexOf(e,form.fields[i].type)&&t.push(form.fields[i]);return t}function GetNextFieldId(){var e;if(void 0===form.nextFieldId){for(var t=0,i=0;i<form.fields.length;i++)parseFloat(form.fields[i].id)>t&&(t=parseFloat(form.fields[i].id));if(form.deletedFields)for(i=0;i<form.deletedFields.length;i++)parseFloat(form.deletedFields[i])>t&&(t=parseFloat(form.deletedFields[i]));e=parseFloat(t)+1}else e=parseInt(form.nextFieldId);return form.nextFieldId=e+1,e}function EndAddField(e,t,i){gf_vars.currentlyAddingField=!1,jQuery("#gform_adding_field_spinner").remove(),void 0!==i?(form.fields.splice(i,0,e),0===i?jQuery("#gform_fields").prepend(t):jQuery("#gform_fields").children().eq(i-1).after(t)):(jQuery("#gform_fields").append(t),form.fields.push(e));var l=jQuery("#field_"+e.id);l.animate({backgroundColor:"#FFFBCC"},"fast",function(){jQuery(this).animate({backgroundColor:"#FFF"},"fast",function(){jQuery(this).css("background-color","")})}),0===jQuery("#no-fields-stash li").length&&jQuery("#no-fields").detach().appendTo("#no-fields-stash"),jQuery(".selectable").removeClass("field_selected"),HideSettings("field_settings"),HideSettings("form_settings"),HideSettings("last_page_settings"),l.addClass("field_selected"),SetFieldSize(e.size),TogglePageBreakSettings(),InitializeFields(),l.removeClass("field_selected"),jQuery(document).trigger("gform_field_added",[form,e])}function StartChangeNameFormat(e){field=GetSelectedField(),UpgradeNameField(field,!1,!0,!1)}function StartChangeCaptchaType(e){field=GetSelectedField(),SetFieldProperty("captchaType",field.captchaType=e),jQuery("#field_settings").slideUp(function(){StartChangeInputType(field.type,field)}),ResetRecaptcha()}function ResetRecaptcha(){field=GetSelectedField(),field.captchaLanguage="en",field.captchaTheme="light"}function StartChangeProductType(e){return field=GetSelectedField(),"radio"===e||"select"===e?field.enablePrice=!0:(field.enablePrice=null,field.choices=null),"calculation"!==e&&(field.enableCalculation=!1,field.calculationFormula=""),StartChangeInputType(e,field)}function StartChangeDonationType(e){return field=GetSelectedField(),field.enablePrice="donation"!=e||null,StartChangeInputType(e,field)}function StartChangeShippingType(e){return field=GetSelectedField(),"singleshipping"!==e?field.enablePrice=!0:(field.enablePrice=null,field.choices=null),StartChangeInputType(e,field)}function StartChangePostCategoryType(e){return"dropdown"==e?jQuery(".post_category_initial_item_setting").hide():jQuery(".post_category_initial_item_setting").show(),field=GetSelectedField(),StartChangeInputType(e,field)}function StartChangePostCustomFieldType(e){return-1===jQuery.inArray(e,["radio","select","checkbox","multiselect"])&&(field.choices=null),StartChangeInputType(e,field)}function EndChangeInputType(e){var t=e.id,i=e.type,l=e.fieldString;jQuery("#field_"+t).html(l);var d=GetFieldById(t);d.inputType=d.type!=i?i:"",SetDefaultValues(d),SetFieldLabel(d.label),SetFieldSize(d.size),SetFieldDefaultValue(d.defaultValue),SetFieldDescription(d.description),SetFieldCheckboxLabel(d.checkboxLabel),SetFieldRequired(d.isRequired),InitializeFields(),LoadFieldSettings()}function InitializeFields(){jQuery(".selectable").hover(function(){jQuery(this).addClass("field_hover")},function(){jQuery(this).removeClass("field_hover")}).focus(function(){jQuery(".field_hover").removeClass("field_hover"),jQuery(this).addClass("field_hover")}),jQuery(".field_delete_icon, .field_duplicate_icon").click(function(e){e.stopPropagation()}),jQuery("#field_settings, #form_settings, #last_page_settings, #pagination_settings, .captcha_message, .form_delete_icon, .all-merge-tags").click(function(e){e.stopPropagation()})}function FieldClick(e){if(gforms_dragging!=e.id)if(jQuery("input#gform_force_focus").focus(),jQuery(e).hasClass("field_selected")){var t="";switch(e.id){case"gform_heading":t="#form_settings",jQuery(".gf_form_toolbar_settings a").removeClass("gf_toolbar_active");break;case"gform_last_page_settings":t="#last_page_settings";break;case"gform_pagination":t="#pagination_settings";break;default:t="#field_settings"}jQuery(t).slideUp(function(){jQuery(e).removeClass("field_selected").addClass("field_hover"),HideSettings("field_settings")})}else jQuery(".selectable").removeClass("field_selected"),jQuery(e).removeClass("field_hover").addClass("field_selected"),"gform_heading"==e.id?(HideSettings("field_settings"),HideSettings("last_page_settings"),HideSettings("pagination_settings"),InitializeFormConditionalLogic(),ShowSettings("form_settings"),jQuery(".gf_form_toolbar_settings a").addClass("gf_toolbar_active")):"gform_last_page_settings"==e.id?(HideSettings("field_settings"),HideSettings("form_settings"),HideSettings("pagination_settings"),ShowSettings("last_page_settings")):"gform_pagination"==e.id?(HideSettings("field_settings"),HideSettings("form_settings"),HideSettings("last_page_settings"),InitPaginationOptions(),ShowSettings("pagination_settings")):(HideSettings("form_settings"),HideSettings("last_page_settings"),HideSettings("pagination_settings"),LoadFieldSettings());else gforms_dragging=0}function TogglePercentageStyle(e){var t=e?"":"slow";"custom"==jQuery("#percentage_style").val()?jQuery(".percentage_custom_container").show(t):jQuery(".percentage_custom_container").hide(t)}function TogglePercentageConfirmationText(e){var t=e?"":"slow";jQuery("#percentage_confirmation_display").is(":checked")?jQuery(".percentage_confirmation_page_name_setting").show(t):jQuery(".percentage_confirmation_page_name_setting").hide(t)}function CustomFieldExists(e){if(!e)return!0;for(var t=jQuery("#field_custom_field_name_select option"),i=0;i<t.length;i++)if(t[i].value==e)return!0;return!1}function IsStandardMask(e){if(!e)return!0;for(var t=jQuery("#field_mask_select option"),i=0;i<t.length;i++)if(t[i].value==e)return!0;return!1}function LoadFieldChoices(e){jQuery("#field_choice_values_enabled").prop("checked",!!e.enableChoiceValue),ToggleChoiceValue();var t="list"==GetInputType(e)?"field_columns":"field_choices";jQuery("#"+t).html(GetFieldChoices(e)),LoadBulkChoices(e),jQuery(document).trigger("gform_load_field_choices",[e]),gform.doAction("gform_load_field_choices",[e])}function LoadInputChoices(e,t){var i=e.parent();i.find(".field_input_choice_values_enabled").prop("checked",!!t.enableChoiceValue),ToggleInputChoiceValue(i,t.enableChoiceValue),jQuery(e).html(GetInputChoices(t))}function LoadBulkChoices(e){if(LoadCustomChoices(),e.choices){for(var t,i=new Array,l=0;l<e.choices.length;l++)t=e.choices[l].text==e.choices[l].value?e.choices[l].text:e.choices[l].text+"|"+e.choices[l].value,e.enablePrice&&""!=e.choices[l].price&&(t+="|:"+e.choices[l].price),i.push(t);i=gform.applyFilters("gform_choices_post_bulk_load",i,e.choices),jQuery("#gfield_bulk_add_input").val(i.join("\n"))}}function DisplayCustomMessage(e){jQuery("#bulk_custom_message").html(e).slideDown(),setTimeout(function(){jQuery("#bulk_custom_message").slideUp()},2e3)}function LoadCustomChoices(){if(jQuery(".choice_section_header, .bulk_custom_choice").remove(),!IsEmpty(gform_custom_choices)){var e="<li class='choice_section_header'>"+gf_vars.customChoices+"</li>";for(key in gform_custom_choices)if(gform_custom_choices.hasOwnProperty(key)){var t='SelectCustomChoice( jQuery(this).data("key") );';e+="<li class='bulk_custom_choice'><a href='javascript:void(0);' data-key='"+escapeAttr(key)+"' onclick='"+t+"' onkeypress='"+t+"' class='bulk-choice bulk_custom_choice'>"+escapeHtml(key)+"</a></li>"}e+="<li class='choice_section_header'>"+gf_vars.predefinedChoices+"</li>",jQuery("#bulk_items").prepend(e)}}function SelectCustomChoice(e){jQuery("#gfield_bulk_add_input").val(gform_custom_choices[e].join("\n")),gform_selected_custom_choice=e,InitBulkCustomPanel()}function SelectPredefinedChoice(e){jQuery("#gfield_bulk_add_input").val(gform_predefined_choices[e].join("\n")),gform_selected_custom_choice="",InitBulkCustomPanel()}function InsertBulkChoices(e){field=GetSelectedField(),field.choices=new Array;for(var t=!1,i=0;i<e.length;i++){if(text_price=e[i].split("|:"),text_value=text_price[0],price="",1<text_price.length){var l=GetCurrentCurrency();price=l.toMoney(text_price[1])}text_value=text_value.split("|"),field.choices.push(new Choice(jQuery.trim(text_value[0]),jQuery.trim(text_value[text_value.length-1]),jQuery.trim(price))),1<text_value.length&&(t=!0)}gform.doAction("gform_bulk_insert_choices",field),t&&(field.enableChoiceValue=!0,jQuery("#field_choice_values_enabled").prop("checked",!0),ToggleChoiceValue()),LoadFieldChoices(field),UpdateFieldChoices(GetInputType(field))}function InitBulkCustomPanel(){(0==gform_selected_custom_choice.length?CloseCustomChoicesPanel:LoadCustomChoicesPanel)()}function LoadCustomChoicesPanel(e,t){e?(jQuery("#custom_choice_name").val(""),jQuery("#bulk_save_button").html(gf_vars.save),jQuery("#bulk_cancel_link").show(),jQuery("#bulk_delete_link").hide()):(jQuery("#custom_choice_name").val(gform_selected_custom_choice),jQuery("#bulk_save_button").html(gf_vars.update),jQuery("#bulk_cancel_link").hide(),jQuery("#bulk_delete_link").show()),t=t||"",jQuery("#bulk_save_as").hide(t),jQuery("#bulk_custom_edit").show(t)}function CloseCustomChoicesPanel(e){e=e||"",jQuery("#bulk_save_as").show(e),jQuery("#bulk_custom_edit").hide(e)}function IsEmpty(e){var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}function SetFieldChoice(e,t){var i=jQuery("#"+e+"_choice_text_"+t).val(),l=jQuery("#"+e+"_choice_value_"+t).val(),d=jQuery("#"+e+"_choice_price_"+t).val();field=GetSelectedField(),field.choices[t].text=i,field.choices[t].value=field.enableChoiceValue?l:i,field.enablePrice&&(d=(d=GetCurrentCurrency().toMoney(d))||"",field.choices[t].price=d);jQuery("#field_choices :radio, #field_choices :checkbox").each(function(e){field.choices[e].isSelected=this.checked}),LoadBulkChoices(field),UpdateFieldChoices(GetInputType(field))}function SetInputChoice(e,t,i,l){var d=GetSelectedField(),a=GetInput(d,e);e=e.toString().replace(".","_"),a.choices[t].text=l,a.choices[t].value=a.enableChoiceValue?i:l,jQuery(".field-input-choice-"+e+":radio, .field-input-choice-"+e+":checkbox").each(function(e){a.choices[e].isSelected=this.checked}),UpdateInputChoices(a)}function UpdateFieldChoices(e){var t="";"checkbox"==e&&(field.inputs=new Array);var i=0;switch(GetInputType(field)){case"select":for(var l=0;l<field.choices.length;l++){selected=field.choices[l].isSelected?"selected='selected'":"",t+="<option value='"+(field.choices[l].value?field.choices[l].value:field.choices[l].text).replace(/'/g,"&#039;")+"' "+selected+">"+field.choices[l].text+"</option>"}break;case"checkbox":for(l=0;l<field.choices.length;l++){(l+1+i)%10==0&&i++;var d=field.id+"."+(l+1+i);field.inputs.push(new Input(d,field.choices[l].text));var a="choice_"+field.id+"_"+l;checked=field.choices[l].isSelected?"checked":"",l<5&&(t+="<li><input type='"+e+"' "+checked+" id='"+a+"' disabled='disabled'><label for='"+a+"'>"+field.choices[l].text+"</label></li>")}5<field.choices.length&&(t+="<li class='gchoice_total'>"+gf_vars.editToViewAll.replace("%d",field.choices.length)+"</li>");break;case"radio":for(l=0;l<field.choices.length;l++){a="choice_"+field.id+"_"+l;checked=field.choices[l].isSelected?"checked":"",l<5&&(t+="<li><input type='"+e+"' "+checked+" id='"+a+"' disabled='disabled'><label for='"+a+"'>"+field.choices[l].text+"</label></li>")}t+=field.enableOtherChoice?"<li><input type='"+e+"' "+checked+" id='"+a+"' disabled='disabled'><input type='text' value='"+gf_vars.otherChoiceValue+"' disabled='disabled' /></li>":"",5<field.choices.length&&(t+="<li class='gchoice_total'>"+gf_vars.editToViewAll.replace("%d",field.choices.length)+"</li>");break;case"list":var r=null!=field.choices;columns=r?field.choices:[[]];var n="";if(r){t+="<thead><tr>";for(l=0;l<columns.length;l++)t+="<th>"+columns[l].text+"</th>";t+="<th>&nbsp;</th></tr></thead>"}else n="class='gf_list_one_column'";t+="<tbody>",t+="<tr>";for(var o=0;o<columns.length;o++)t+="<td "+n+"><input type='text' disabled='disabled' /></td>";t+="<td><img src='"+gf_vars.baseUrl+"/images/add.png' class='add_list_item' style='cursor:pointer; margin:0 3px;' /></td>",t+="</tr></tbody>"}jQuery(".field_selected "+(".gfield_"+e)).html(t)}function UpdateInputChoices(e){for(var t="",i=0;i<e.choices.length;i++){var l=e.choices[i].isSelected?"selected='selected'":"";t+="<option value='"+(e.choices[i].value?e.choices[i].value:e.choices[i].text).replace(/'/g,"&#039;")+"' "+l+">"+e.choices[i].text+"</option>"}var d=e.id.toString().replace(".","_");jQuery(".field_selected #input_"+d).html(t)}function InsertFieldChoice(e){field=GetSelectedField();var t=field.enablePrice?"0.00":"",i=new Choice("","",t);window["gform_new_choice_"+field.type]&&(i=window["gform_new_choice_"+field.type](field,i)),field.choices.splice(e,0,i),LoadFieldChoices(field),UpdateFieldChoices(GetInputType(field))}function InsertInputChoice(e,t,i){var l=GetSelectedField(),d=GetInput(l,t),a=new Choice("","");d.choices.splice(i,0,a),LoadInputChoices(e,d),UpdateInputChoices(d)}function DeleteFieldChoice(e){field=GetSelectedField();var t=jQuery("#"+GetInputType(field)+"_choice_value_"+e).val();HasConditionalLogicDependency(field.id,t)&&!confirm(gf_vars.conditionalLogicDependencyChoice)||(field.choices.splice(e,1),LoadFieldChoices(field),UpdateFieldChoices(GetInputType(field)))}function DeleteInputChoice(e,t,i){var l=GetSelectedField(),d=GetInput(l,t);d.choices.splice(i,1),LoadInputChoices(e,d),UpdateInputChoices(d)}function MoveFieldChoice(e,t){field=GetSelectedField();var i=field.choices[e];field.choices.splice(e,1),field.choices.splice(t,0,i),LoadFieldChoices(field),UpdateFieldChoices(GetInputType(field))}function MoveInputChoice(e,t,i,l){var d=GetSelectedField(),a=GetInput(d,t),r=a.choices[i];a.choices.splice(i,1),a.choices.splice(l,0,r),LoadInputChoices(e,a),UpdateInputChoices(a)}function GetFieldType(e){return e.substr(0,e.lastIndexOf("_"))}function GetSelectedField(){var e=jQuery(".field_selected");if(e.length<=0)return!1;var t=e[0].id.substr(6);return GetFieldById(t)}function SetPasswordProperty(e){SetFieldProperty("enablePasswordInput",e)}function ToggleDateCalendar(e){var t=e?"":"slow",i=jQuery("#field_date_input_type").val();"datefield"==i||"datedropdown"==i?(jQuery("#date_picker_container").hide(t),SetCalendarIconType("none")):jQuery("#date_picker_container").show(t)}function ToggleCalendarIconUrl(e){var t=e?"":"slow";jQuery("#gsetting_icon_custom").is(":checked")?jQuery("#gfield_icon_url_container").show(t):(jQuery("#gfield_icon_url_container").hide(t),jQuery("#gfield_calendar_icon_url").val(""),SetFieldProperty("calendarIconUrl",""))}function SetTimeFormat(e){SetFieldProperty("timeFormat",e),LoadTimeInputs()}function LoadTimeInputs(){var e=GetSelectedField();"time"!=e.type&&"time"!=e.inputType||("24"==jQuery("#field_time_format").val()?(jQuery("#input_default_value_row_input_"+e.id+"_3").hide(),jQuery(".field_selected .gfield_time_ampm").hide()):(jQuery("#input_default_value_row_input_"+e.id+"_3").show(),jQuery(".field_selected .gfield_time_ampm").show()),jQuery("#input_placeholder_row_input_"+e.id+"_3").hide(),jQuery(".field_custom_input_row_"+e.id+"_3").hide())}function SetDateFormat(e){SetFieldProperty("dateFormat",e),LoadDateInputs()}function LoadDateInputs(){var e=jQuery("#field_date_input_type").val(),t=jQuery("#field_date_format").val(),i=t?t.substr(0,3):"mdy";if("datefield"==e){switch(i){case"ymd":jQuery(".field_selected #gfield_input_date_month").remove().insertBefore(".field_selected #gfield_input_date_day"),jQuery(".field_selected #gfield_input_date_year").remove().insertBefore(".field_selected #gfield_input_date_month");break;case"mdy":jQuery(".field_selected #gfield_input_date_day").remove().insertBefore(".field_selected #gfield_input_date_year"),jQuery(".field_selected #gfield_input_date_month").remove().insertBefore(".field_selected #gfield_input_date_day");break;case"dmy":jQuery(".field_selected #gfield_input_date_month").remove().insertBefore(".field_selected #gfield_input_date_year"),jQuery(".field_selected #gfield_input_date_day").remove().insertBefore(".field_selected #gfield_input_date_month")}jQuery(".field_selected .ginput_date").show(),jQuery(".field_selected .ginput_date_dropdown").hide(),jQuery(".field_selected #gfield_input_datepicker").hide(),jQuery(".field_selected #gfield_input_datepicker_icon").hide()}else if("datedropdown"==e){switch(i){case"ymd":jQuery(".field_selected #gfield_dropdown_date_month").remove().insertBefore(".field_selected #gfield_dropdown_date_day"),jQuery(".field_selected #gfield_dropdown_date_year").remove().insertBefore(".field_selected #gfield_dropdown_date_month");break;case"mdy":jQuery(".field_selected #gfield_dropdown_date_day").remove().insertBefore(".field_selected #gfield_dropdown_date_year"),jQuery(".field_selected #gfield_dropdown_date_month").remove().insertBefore(".field_selected #gfield_dropdown_date_day");break;case"dmy":jQuery(".field_selected #gfield_dropdown_date_month").remove().insertBefore(".field_selected #gfield_dropdown_date_year"),jQuery(".field_selected #gfield_dropdown_date_day").remove().insertBefore(".field_selected #gfield_dropdown_date_month")}jQuery(".field_selected .ginput_date_dropdown").css("display","inline"),jQuery(".field_selected .ginput_date").hide(),jQuery(".field_selected #gfield_input_datepicker").hide(),jQuery(".field_selected #gfield_input_datepicker_icon").hide()}else jQuery(".field_selected .ginput_date").hide(),jQuery(".field_selected .ginput_date_dropdown").hide(),jQuery(".field_selected #gfield_input_datepicker").show(),jQuery("#gsetting_icon_calendar").is(":checked")?jQuery(".field_selected #gfield_input_datepicker_icon").show():jQuery(".field_selected #gfield_input_datepicker_icon").hide()}function SetCalendarIconType(e,t){field=GetSelectedField(),"date"==GetInputType(field)&&(null==e&&(e="none"),"none"==e?jQuery("#gsetting_icon_none").prop("checked",!0):"calendar"==e?jQuery("#gsetting_icon_calendar").prop("checked",!0):"custom"==e&&jQuery("#gsetting_icon_custom").prop("checked",!0),SetFieldProperty("calendarIconType",e),ToggleCalendarIconUrl(t),LoadDateInputs())}function SetDateInputType(e){field=GetSelectedField(),"date"==GetInputType(field)&&(field.dateType=e,field.inputs=GetDateFieldInputs(field),CreateDefaultValuesUI(field),CreatePlaceholdersUI(field),CreateInputLabelsUI(field),ToggleDateSettings(field),ResetDefaultInputValues(field),ResetInputPlaceholders(field),ToggleDateCalendar(),LoadDateInputs())}function SetPostImageMeta(){var e=jQuery(".field_selected #gfield_display_title").is(":checked"),t=jQuery(".field_selected #gfield_display_caption").is(":checked"),i=jQuery(".field_selected #gfield_display_description").is(":checked"),l=e||t||i;SetFieldProperty("displayTitle",e),SetFieldProperty("displayCaption",t),SetFieldProperty("displayDescription",i),jQuery(".field_selected .ginput_post_image_title").css("display",e?"block":"none"),jQuery(".field_selected .ginput_post_image_caption").css("display",t?"block":"none"),jQuery(".field_selected .ginput_post_image_description").css("display",i?"block":"none"),jQuery(".field_selected .ginput_post_image_file").css("display",l?"block":"none")}function SetFeaturedImage(){if(jQuery("#gfield_featured_image").is(":checked")){for(i in form.fields)form.fields.hasOwnProperty(i)&&(form.fields[i].postFeaturedImage=!1);SetFieldProperty("postFeaturedImage",!0)}else SetFieldProperty("postFeaturedImage",!1)}function SetFieldProperty(e,t){null==t&&(t=""),GetSelectedField()[e]=t}function SetInputName(e,t){var i=GetSelectedField();if(e=e&&e.trim(),t){for(var l=0;l<i.inputs.length;l++)if(i.inputs[l].id==t)return void(i.inputs[l].name=e)}else i.inputName=e}function SetInputDefaultValue(e,t){var i,l=GetSelectedField();e=e&&e.trim();for(var d=0;d<l.inputs.length;d++)if(l.inputs[d].id==t)return l.inputs[d].defaultValue=e,void jQuery('[name="input_'+t+'"], #input_'+t.toString().replace(".","_")).each(function(){"INPUT"==this.nodeName?jQuery(this).val(e):(i=jQuery(this),e=e.toLowerCase(),i.val("").children().each(function(){if(this.value.toLowerCase()==e)return i.val(this.value),!1}))})}function SetInputPlaceholder(t,e){var i=GetSelectedField();t=t&&t.trim();for(var l=0;l<i.inputs.length;l++)if(i.inputs[l].id==e)return i.inputs[l].placeholder=t,void jQuery('[name="input_'+e+'"], #input_'+e.toString().replace(".","_")).each(function(){var e=this.nodeName;"INPUT"==e?jQuery(this).prop("placeholder",t):"SELECT"==e&&jQuery(this).find('option[value=""]').text(t)})}function ResetInputPlaceholders(e){(e=e||GetSelectedField()).inputs&&jQuery(e.inputs).each(function(){SetInputPlaceholder(void 0!==this.placeholder?this.placeholder:"",this.id)})}function ResetDefaultInputValues(e){(e=e||GetSelectedField()).inputs&&jQuery(e.inputs).each(function(){SetInputDefaultValue(void 0!==this.defaultValue?this.defaultValue:"",this.id)})}function SetInputCustomLabel(e,t){var i,l,d,a=GetSelectedField();e=e&&e.trim();for(var r=0;r<a.inputs.length;r++)if((d=a.inputs[r]).id==t)return l=""==e?(delete d.customLabel,void 0!==d.defaultLabel?d.defaultLabel:d.label):d.customLabel=e,i=".ginput_container label[for="+(i=(i="input_"+a.inputs[r].id).replace(".","_"))+"]",void jQuery(i).text(l)}function SetInputHidden(e,t){for(var i=GetSelectedField(),l=0;l<i.inputs.length;l++)if(i.inputs[l].id==t)return i.inputs[l].isHidden=e,t=t.toString().replace(".","_"),void jQuery("#input_"+t+"_container").toggle(!e)}function SetSelectedCategories(){var e=GetSelectedField();e.choices=new Array,jQuery(".gfield_category_checkbox").each(function(){this.checked&&e.choices.push(new Choice(this.name,this.value))}),e.choices.sort(function(e,t){return e.text.toLowerCase()>t.text.toLowerCase()})}function SetFieldLabel(e){var t=jQuery(".field_selected .gfield_required")[0];jQuery(".field_selected .gfield_label, .field_selected .gsection_title").text(e).append(t),SetFieldProperty("label",e)}function SetCaptchaTheme(e,t){jQuery(".field_selected .gfield_captcha").attr("src",t),SetFieldProperty("captchaTheme",e)}function SetCaptchaSize(e){var t=jQuery("#field_captcha_type").val();SetFieldProperty("simpleCaptchaSize",e),RedrawCaptcha(),jQuery(".field_selected .gfield_captcha_input_container").removeClass(t+"_small").removeClass(t+"_medium").removeClass(t+"_large").addClass(t+"_"+e)}function SetCaptchaFontColor(e){SetFieldProperty("simpleCaptchaFontColor",e),RedrawCaptcha()}function SetCaptchaBackgroundColor(e){SetFieldProperty("simpleCaptchaBackgroundColor",e),RedrawCaptcha()}function RedrawCaptcha(){"math"==jQuery("#field_captcha_type").val()?(url_1=GetCaptchaUrl(1),url_2=GetCaptchaUrl(2),url_3=GetCaptchaUrl(3),jQuery(".field_selected .gfield_captcha:eq(0)").attr("src",url_1),jQuery(".field_selected .gfield_captcha:eq(1)").attr("src",url_2),jQuery(".field_selected .gfield_captcha:eq(2)").attr("src",url_3)):(url=GetCaptchaUrl(),jQuery(".field_selected .gfield_captcha").attr("src",url))}function SetFieldSize(e){jQuery(".field_selected .small, .field_selected .medium, .field_selected .large").removeClass("small").removeClass("medium").removeClass("large").addClass(e),SetFieldProperty("size",e)}function SetFieldLabelPlacement(e){var t=e||form.labelPlacement;SetFieldProperty("labelPlacement",e),jQuery(".field_selected").removeClass("top_label").removeClass("right_label").removeClass("left_label").removeClass("hidden_label").addClass(t),"left_label"==field.labelPlacement||"right_label"==field.labelPlacement||""==field.labelPlacement&&"top_label"!=form.labelPlacement?(jQuery("#field_description_placement").val(""),SetFieldProperty("descriptionPlacement",""),jQuery("#field_description_placement_container").hide("slow")):jQuery("#field_description_placement_container").show("slow"),SetFieldProperty("labelPlacement",e),RefreshSelectedFieldPreview()}function SetFieldDescriptionPlacement(e){var t="above"==e||""==e&&"above)"==form.descriptionPlacement;SetFieldProperty("descriptionPlacement",e),RefreshSelectedFieldPreview(function(){t?jQuery(".field_selected").addClass("description_above"):jQuery(".field_selected").removeClass("description_above")})}function SetFieldSubLabelPlacement(e){SetFieldProperty("subLabelPlacement",e),RefreshSelectedFieldPreview()}function SetFieldVisibility(e,t,i){if(!i&&"administrative"==e&&HasConditionalLogicDependency(field.id)&&!confirm(gf_vars.conditionalLogicDependencyAdminOnly))return!1;for(var l=!1,d=0;d<gf_vars.visibilityOptions.length;d++)if(gf_vars.visibilityOptions[d].value==e){l=!0;break}if(l||(e="visible"),SetFieldProperty("visibility",e),t){var a=jQuery('input[name="field_visibility"]');a.prop("checked",!1),a.filter('[value="'+e+'"]').prop("checked",!0)}}function SetFieldDefaultValue(e){jQuery(".field_selected > div > input:visible, .field_selected > div > textarea:visible, .field_selected > div > select:visible").val(e),SetFieldProperty("defaultValue",e)}function SetFieldPlaceholder(l){jQuery(".field_selected > div > input:visible, .field_selected > div > textarea:visible, .field_selected > div > select:visible").each(function(){var e=this.nodeName,t=jQuery(this);if("INPUT"==e||"TEXTAREA"==e)jQuery(this).prop("placeholder",l);else if("SELECT"==e){var i=t.find('option[value=""]');0<i.length?0<l.length?i.text(l):i.remove():(t.prepend('<option value="">'+l+"</option>"),t.val(""))}}),SetFieldProperty("placeholder",l)}function SetFieldDescription(e){null==e&&(e=""),SetFieldProperty("description",e)}function SetFieldCheckboxLabel(e){null==e&&(e=""),SetFieldProperty("checkboxLabel",e)}function SetPasswordStrength(e){e?jQuery(".field_selected .gfield_password_strength").show():(jQuery(".field_selected .gfield_password_strength").hide(),jQuery("#gfield_min_strength").val(""),SetFieldProperty("minPasswordStrength","")),SetFieldProperty("passwordStrengthEnabled",e)}function ToggleEmailSettings(e){var t=void 0!==e.emailConfirmEnabled&&1==e.emailConfirmEnabled;jQuery(".placeholder_setting").toggle(!t),jQuery(".default_value_setting").toggle(!t),jQuery(".sub_label_placement_setting").toggle(t),jQuery(".sub_labels_setting").toggle(t),jQuery(".default_input_values_setting").toggle(t),jQuery(".input_placeholders_setting").toggle(t)}function SetEmailConfirmation(e){var t=GetSelectedField();e?(jQuery(".field_selected .ginput_single_email").hide(),jQuery(".field_selected .ginput_confirm_email").show()):(jQuery(".field_selected .ginput_confirm_email").hide(),jQuery(".field_selected .ginput_single_email").show()),t.emailConfirmEnabled=e,t.inputs=GetEmailFieldInputs(t),CreateDefaultValuesUI(t),CreatePlaceholdersUI(t),CreateCustomizeInputsUI(t),CreateInputLabelsUI(t),ToggleEmailSettings(t)}function SetCardType(e,t){var i=GetSelectedField().creditCards?GetSelectedField().creditCards:new Array;if(jQuery(e).is(":checked"))-1==jQuery.inArray(t,i)&&(jQuery(".gform_card_icon_"+t).fadeIn(),i[i.length]=t);else{var l=jQuery.inArray(t,i);-1!=l&&(jQuery(".gform_card_icon_"+t).fadeOut(),i.splice(l,1))}SetFieldProperty("creditCards",i)}function SetFieldRequired(e){var t=e?"*":"";jQuery(".field_selected .gfield_required").html(t),SetFieldProperty("isRequired",e)}function SetMaxLength(e){var t=GetMaxLengthPattern(),l="",d=e.value.split("");for(i in d)d.hasOwnProperty(i)&&(t.test(d[i])||(l+=d[i]));SetFieldProperty("maxLength",e.value=l)}function GetMaxLengthPattern(){return/[a-zA-Z\-!@#$%^&*();'":_+=<,>.~`?\/|\[\]\{\}\\]/}function ValidateKeyPress(e,t,i){i=void 0===i||i;var l=e.which?e.which:e.keyCode,d=t.test(String.fromCharCode(l));return!!e.ctrlKey||(i?d:!d)}function IndexOf(e,t){for(var i=0;i<e.length;i++)if(e[i]==t)return i;return-1}function ToggleCalculationOptions(e,t){e?(jQuery("#calculation_options").gfSlide("down"),"product"!=t.type&&jQuery("li.range_setting").gfSlide("up")):(jQuery("#calculation_options").gfSlide("up"),"product"!=t.type&&jQuery("li.range_setting").gfSlide("down"),SetFieldProperty("calculationFormula",""),SetFieldProperty("calculationRounding","")),SetFieldProperty("enableCalculation",e)}function FormulaContentCallback(){SetFieldProperty("calculationFormula",jQuery("#field_calculation_formula").val().trim())}function SetupUnsavedChangesWarning(){UpdateFormObject(),gforms_original_json=jQuery.toJSON(form),window.onbeforeunload=function(){if(UpdateFormObject(),gforms_original_json!=jQuery.toJSON(form)&&!gf_vars.isFormTrash)return"You have unsaved changes."}}function ToggleRichTextEditor(e){var t=GetSelectedField(),i=jQuery("#input_"+t.id),l=jQuery("#input_"+t.id+"_rte_preview");e?(i.hide(),l.show()):(l.hide(),i.show()),SetFieldProperty("useRichTextEditor",e)}function iColorShow(e,t,l,d){jQuery("#iColorPicker").css({top:t-150+"px",left:e+"px",position:"absolute"}).fadeIn("fast"),jQuery("#iColorPickerBg").css({position:"absolute",top:0,left:0,width:"100%",height:"100%"}).fadeIn("fast");var a=jQuery("#"+l).val();jQuery("#colorPreview span").text(a),jQuery("#colorPreview").css("background",a),jQuery("#color").val(a);var r=jQuery("#iColorPicker");for(i=0;i<r.length;i++){var n=document.getElementById("hexSection"+i).childNodes;for(j=0;j<n.length;j++){var o=n[j].childNodes;for(k=0;k<o.length;k++)jQuery(n[j].childNodes[k]).unbind().mouseover(function(e){var t="#"+jQuery(this).attr("hx");jQuery("#colorPreview").css("background",t),jQuery("#colorPreview span").text(t)}).click(function(){var e="#"+jQuery(this).attr("hx");jQuery("#"+l).val(e),jQuery("#chip_"+l).css("background-color",e),jQuery("#iColorPickerBg").hide(),jQuery("#iColorPicker").fadeOut(),d&&window[d](e),jQuery(this)})}}}function SetColorPickerColor(e,t,i){jQuery("#chip_"+e).css("background-color",t),i&&window[i](t)}function SetFieldChoices(){for(var e=GetSelectedField(),t=0;t<e.choices.length;t++)SetFieldChoice(GetInputType(e),t)}function SetInputChoices(e){var t,i,l,d;GetSelectedField();e.find("li").each(function(e){t=jQuery(this),d=t.data("input_id"),i=t.find(".field-choice-value").val(),l=t.find(".field-choice-text").val(),SetInputChoice(d,e,i,l)})}function MergeInputArrays(e,t){for(var i,l,d=0;d<e.length;++d)i=e[d],(l=GetInput({inputs:t},i.id))&&(e[d]=jQuery.extend(i,l));return e}function IsValidFormula(formula){if(""==formula)return!0;for(var patt=/{([^}]+)}/i,exprPatt=/^[0-9 -/*\(\)]+$/i,expr=formula.replace(/(\r\n|\n|\r)/gm,""),match,result=!1;match=patt.exec(expr);)expr=expr.replace(match[0],1);if(exprPatt.test(expr))try{var r=eval(expr);result=!isNaN(parseFloat(r))&&isFinite(r)}catch(e){result=!1}return gform.applyFilters("gform_is_valid_formula_form_editor",result,formula)}jQuery(document).ready(function(){if(setTimeout("CloseStatus();",5e3),jQuery(".field_type input").each(function(){var e=jQuery(this),t=e.data("type"),i=e.attr("onclick");void 0===t&&(-1<i.indexOf("StartAddField")&&/StartAddField\([ ]?'(.*?)[ ]?'/.test(i)&&(t=i.match(/'(.*?)'/)[1],e.data("type",t)),window.console&&console.log("Deprecated button for the "+this.value+' field. Since v1.9 the field type must be specified in the "type" data attribute.')),void 0===t||void 0!==i&&""!=i||jQuery(this).click(function(){StartAddField(t)})}),jQuery("#gform_fields").sortable({cancel:"#field_settings",handle:".gfield_admin_icons",start:function(e,t){gforms_dragging=t.item[0].id},tolerance:"pointer",over:function(e,t){if(jQuery("#no-fields").hide(),t.helper.hasClass("ui-draggable-dragging"))t.helper.data("original_width",t.helper.width()),t.helper.data("original_height",t.helper.height()),t.helper.width(t.sender.width()-25),t.helper.height(t.placeholder.height());else{var i=t.helper.height();300<i&&(i=300),t.placeholder.height(i)}},out:function(e,t){1===jQuery("#gform_fields li").length&&jQuery("#no-fields").show(),t.helper&&t.helper.hasClass("ui-draggable-dragging")&&(t.helper.width(t.helper.data("original_width")),t.helper.height(t.helper.data("original_height")))},placeholder:"field-drop-zone",beforeStop:function(e,t){jQuery("#gform_fields").height("100%");var i=t.helper.data("type");if(void 0!==i){var l=t.item.index();t.item.replaceWith("<li id='gform_adding_field_spinner'><i class='gficon-gravityforms-spinner-icon gficon-spin'></i></li>"),StartAddField(i,l)}}}),jQuery(".field_type input").draggable({connectToSortable:"#gform_fields",helper:function(){return jQuery(this).clone(!0)},revert:"invalid",cancel:!1,appendTo:"#wpbody",containment:"document",start:function(e,t){if(1==gf_vars.currentlyAddingField)return!1}}),jQuery("#field_choices, #field_columns").sortable({axis:"y",handle:".field-choice-handle",update:function(e,t){MoveFieldChoice(t.item.data("index"),t.item.index())}}),jQuery(".field_input_choices").sortable({axis:"y",handle:".field-choice-handle",update:function(e,t){var i=t.item.data("index"),l=t.item.index(),d=t.item.data("input_id");MoveInputChoice(t.item.parent(),d,i,l)}}),MakeNoFieldsDroppable(),void 0!==gf_global.view&&"settings"==gf_global.view||InitializeForm(form),jQuery(document).trigger("gform_load_form_settings",[form]),SetupUnsavedChangesWarning(),window.console){var e=jQuery(document)[0],t=jQuery.hasData(e)&&jQuery._data(e);if(t){var i=new Array("gform_load_form_settings");for(var l in t.events)-1!==jQuery.inArray(l,i)&&console.log('Gravity Forms API warning: The jQuery event "'+l+'" is deprecated on this page since version 1.7')}}jQuery(document).on("focus","#field_choices input.field-choice-text, #field_choices input.field-choice-value",function(){jQuery(this).data("previousValue",jQuery(this).val())}),InitializeFieldSettings()}),this.iColorPicker=function(){jQuery("input.iColorPicker").each(function(e){0==e&&(jQuery(document.createElement("div")).attr("id","iColorPicker").css("display","none").html('<table class="pickerTable" id="pickerTable0"><thead id="hexSection0"><tr><td style="background:#f00;" hx="f00"></td><td style="background:#ff0" hx="ff0"></td><td style="background:#0f0" hx="0f0"></td><td style="background:#0ff" hx="0ff"></td><td style="background:#00f" hx="00f"></td><td style="background:#f0f" hx="f0f"></td><td style="background:#fff" hx="fff"></td><td style="background:#ebebeb" hx="ebebeb"></td><td style="background:#e1e1e1" hx="e1e1e1"></td><td style="background:#d7d7d7" hx="d7d7d7"></td><td style="background:#cccccc" hx="cccccc"></td><td style="background:#c2c2c2" hx="c2c2c2"></td><td style="background:#b7b7b7" hx="b7b7b7"></td><td style="background:#acacac" hx="acacac"></td><td style="background:#a0a0a0" hx="a0a0a0"></td><td style="background:#959595" hx="959595"></td></tr><tr><td style="background:#ee1d24" hx="ee1d24"></td><td style="background:#fff100" hx="fff100"></td><td style="background:#00a650" hx="00a650"></td><td style="background:#00aeef" hx="00aeef"></td><td style="background:#2f3192" hx="2f3192"></td><td style="background:#ed008c" hx="ed008c"></td><td style="background:#898989" hx="898989"></td><td style="background:#7d7d7d" hx="7d7d7d"></td><td style="background:#707070" hx="707070"></td><td style="background:#626262" hx="626262"></td><td style="background:#555" hx="555"></td><td style="background:#464646" hx="464646"></td><td style="background:#363636" hx="363636"></td><td style="background:#262626" hx="262626"></td><td style="background:#111" hx="111"></td><td style="background:#000" hx="000"></td></tr><tr><td style="background:#f7977a" hx="f7977a"></td><td style="background:#fbad82" hx="fbad82"></td><td style="background:#fdc68c" hx="fdc68c"></td><td style="background:#fff799" hx="fff799"></td><td style="background:#c6df9c" hx="c6df9c"></td><td style="background:#a4d49d" hx="a4d49d"></td><td style="background:#81ca9d" hx="81ca9d"></td><td style="background:#7bcdc9" hx="7bcdc9"></td><td style="background:#6ccff7" hx="6ccff7"></td><td style="background:#7ca6d8" hx="7ca6d8"></td><td style="background:#8293ca" hx="8293ca"></td><td style="background:#8881be" hx="8881be"></td><td style="background:#a286bd" hx="a286bd"></td><td style="background:#bc8cbf" hx="bc8cbf"></td><td style="background:#f49bc1" hx="f49bc1"></td><td style="background:#f5999d" hx="f5999d"></td></tr><tr><td style="background:#f16c4d" hx="f16c4d"></td><td style="background:#f68e54" hx="f68e54"></td><td style="background:#fbaf5a" hx="fbaf5a"></td><td style="background:#fff467" hx="fff467"></td><td style="background:#acd372" hx="acd372"></td><td style="background:#7dc473" hx="7dc473"></td><td style="background:#39b778" hx="39b778"></td><td style="background:#16bcb4" hx="16bcb4"></td><td style="background:#00bff3" hx="00bff3"></td><td style="background:#438ccb" hx="438ccb"></td><td style="background:#5573b7" hx="5573b7"></td><td style="background:#5e5ca7" hx="5e5ca7"></td><td style="background:#855fa8" hx="855fa8"></td><td style="background:#a763a9" hx="a763a9"></td><td style="background:#ef6ea8" hx="ef6ea8"></td><td style="background:#f16d7e" hx="f16d7e"></td></tr><tr><td style="background:#ee1d24" hx="ee1d24"></td><td style="background:#f16522" hx="f16522"></td><td style="background:#f7941d" hx="f7941d"></td><td style="background:#fff100" hx="fff100"></td><td style="background:#8fc63d" hx="8fc63d"></td><td style="background:#37b44a" hx="37b44a"></td><td style="background:#00a650" hx="00a650"></td><td style="background:#00a99e" hx="00a99e"></td><td style="background:#00aeef" hx="00aeef"></td><td style="background:#0072bc" hx="0072bc"></td><td style="background:#0054a5" hx="0054a5"></td><td style="background:#2f3192" hx="2f3192"></td><td style="background:#652c91" hx="652c91"></td><td style="background:#91278f" hx="91278f"></td><td style="background:#ed008c" hx="ed008c"></td><td style="background:#ee105a" hx="ee105a"></td></tr><tr><td style="background:#9d0a0f" hx="9d0a0f"></td><td style="background:#a1410d" hx="a1410d"></td><td style="background:#a36209" hx="a36209"></td><td style="background:#aba000" hx="aba000"></td><td style="background:#588528" hx="588528"></td><td style="background:#197b30" hx="197b30"></td><td style="background:#007236" hx="007236"></td><td style="background:#00736a" hx="00736a"></td><td style="background:#0076a4" hx="0076a4"></td><td style="background:#004a80" hx="004a80"></td><td style="background:#003370" hx="003370"></td><td style="background:#1d1363" hx="1d1363"></td><td style="background:#450e61" hx="450e61"></td><td style="background:#62055f" hx="62055f"></td><td style="background:#9e005c" hx="9e005c"></td><td style="background:#9d0039" hx="9d0039"></td></tr><tr><td style="background:#790000" hx="790000"></td><td style="background:#7b3000" hx="7b3000"></td><td style="background:#7c4900" hx="7c4900"></td><td style="background:#827a00" hx="827a00"></td><td style="background:#3e6617" hx="3e6617"></td><td style="background:#045f20" hx="045f20"></td><td style="background:#005824" hx="005824"></td><td style="background:#005951" hx="005951"></td><td style="background:#005b7e" hx="005b7e"></td><td style="background:#003562" hx="003562"></td><td style="background:#002056" hx="002056"></td><td style="background:#0c004b" hx="0c004b"></td><td style="background:#30004a" hx="30004a"></td><td style="background:#4b0048" hx="4b0048"></td><td style="background:#7a0045" hx="7a0045"></td><td style="background:#7a0026" hx="7a0026"></td></tr></thead><tbody><tr><td style="border:1px solid #000;background:#fff;cursor:pointer;height:60px;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;" colspan="16" align="center" id="colorPreview"><span style="color:#000;border:1px solid rgb(0, 0, 0);padding:5px;background-color:#fff;font:11px Arial, Helvetica, sans-serif;"></span></td></tr></tbody></table><style>#iColorPicker input{margin:2px}</style>').appendTo("body"),jQuery(document.createElement("div")).attr("id","iColorPickerBg").click(function(){jQuery("#iColorPickerBg").hide(),jQuery("#iColorPicker").fadeOut()}).appendTo("body"),jQuery("table.pickerTable td").css({width:"12px",height:"14px",border:"1px solid #000",cursor:"pointer"}),jQuery("#iColorPicker table.pickerTable").css({"border-collapse":"collapse"}),jQuery("#iColorPicker").css({border:"1px solid #ccc",background:"#333",padding:"5px",color:"#fff","z-index":9999})),jQuery("#colorPreview").css({height:"50px"})})},jQuery(function(){iColorPicker()}),jQuery.fn.gfSlide=function(e){var t=jQuery("#field_settings").is(":visible");return"up"==e?t?this.slideUp():this.hide():t?this.slideDown():this.show(),this},gform.addFilter("gform_is_conditional_logic_field",function(e,t){return"administrative"!=t.visibility&&t.id!=GetSelectedField().id||(e=!1),e});