jQuery(document).ready(function(a){a(".frm_ajax_loading").css("visibility","hidden");var d=a(".frm_blank_field").closest(".frm_toggle_container").prev(".frm_trigger");d&&frmToggleSection(d);if(a.isFunction(a.fn.on))a(document).on("click",'.frm-show-form input[type="submit"]',function(){if("frm_prev_page"==a(this).attr("name")){var b=a(this).parents("form:first"),b=a(b).find(".frm_next_page").attr("id").replace("frm_next_p_","");a(".frm_next_page").val(b)}else a(".frm_next_page").val("")});else a('.frm-show-form input[type="submit"]').live("click",
function(){if("frm_prev_page"==a(this).attr("name")){var b=a(this).parents("form:first"),b=a(b).find(".frm_next_page").attr("id").replace("frm_next_p_","");a(".frm_next_page").val(b)}else a(".frm_next_page").val("")})});
function frmToggleSection(a){a.next(".frm_toggle_container").slideToggle(200);a.hasClass("active")?(a.removeClass("active"),a.children(".ui-icon-triangle-1-s").addClass("ui-icon-triangle-1-e"),a.children(".ui-icon-triangle-1-e").removeClass("ui-icon-triangle-1-s")):(a.addClass("active"),a.children(".ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-s"),a.children(".ui-icon-triangle-1-s").removeClass("ui-icon-triangle-1-e"))}
function frmClearDefault(a,d){a=a.replace(/(\n|\r\n)/g,"\r");d.value.replace(/(\n|\r\n)/g,"\r")==a&&(d.value="",jQuery(d).removeClass("frm_default"))}function frmReplaceDefault(a,d){a=a.replace(/(\n|\r\n)/g,"\r");""==d.value&&(d.value=a,jQuery(d).addClass("frm_default"))}
function frmCheckDependent(a,d){if("undefined"!=typeof __FRMRULES)var b=__FRMRULES;if("undefined"!=typeof __FRMURL)var h=__FRMURL;if("undefined"!=typeof b&&(b=b[d],"undefined"!=typeof b)){for(var e=[],f=0;f<b.length;f++){var k=b[f];if("undefined"!=typeof k)for(var m=0;m<k.Conditions.length;m++){var l=k.Conditions[m];l.HideField=k.Setting.FieldName;l.MatchType=k.MatchType;l.Show=k.Show;e.push(l)}}for(var g=[],n=[],p=e.length,f=0;f<p;f++)(function(b){var c=e[b];"undefined"==typeof g[c.HideField]&&(g[c.HideField]=
[]);if(c.FieldName!=d||"undefined"==typeof a){var f=a;"radio"==c.Type||"data-radio"==c.Type?a=jQuery("input[name='item_meta["+c.FieldName+"]']:checked, input[type='hidden'][name='item_meta["+c.FieldName+"]']").val():"select"==c.Type||"data-select"==c.Type?a=jQuery("select[name='item_meta["+c.FieldName+"]'], input[type='hidden'][name='item_meta["+c.FieldName+"]']").val():"checkbox"!=c.Type&&"data-checkbox"!=c.Type&&(a=jQuery("input[name='item_meta["+c.FieldName+"]']").val())}"undefined"==typeof a&&
(a=jQuery("input[type=hidden][name='item_meta["+c.FieldName+"]']").val(),"undefined"==typeof a&&(a=""));if("checkbox"==c.Type)g[c.HideField][b]=!1,jQuery("input[name='item_meta["+c.FieldName+"][]']:checked, input[type='hidden'][name^='item_meta["+c.FieldName+"]']").each(function(){var a=frmOperators(c.Condition,c.Value,jQuery(this).val());!1==g[c.HideField][b]&&a&&(g[c.HideField][b]=!0)});else if("data-radio"==c.Type)"undefined"==typeof c.DataType||""==c.DataType||"data"==c.DataType?""==a?(g[c.HideField][b]=
!1,jQuery("#frm_field_"+c.HideField+"_container").fadeOut("slow"),jQuery("#frm_data_field_"+c.HideField+"_container").html("")):g[c.HideField][b]="undefined"==typeof c.DataType?frmOperators(c.Condition,c.Value,a):{funcName:"frmGetData",f:c,sel:a}:g[c.HideField][b]=""==a?!1:{funcName:"frmGetDataOpts",f:c,sel:a};else if("data-checkbox"==c.Type){var k=[];jQuery("input[name='item_meta["+c.FieldName+"][]']:checked, input[type='hidden'][name='item_meta["+c.FieldName+"][]']").each(function(){k.push(jQuery(this).val())});
"undefined"==typeof c.DataType||""==c.DataType||"data"==c.DataType?0==k.length?(g[c.HideField][b]=!1,jQuery("#frm_field_"+c.HideField+"_container").fadeOut("slow"),jQuery("#frm_data_field_"+c.HideField+"_container").html("")):(g[c.HideField][b]=!0,jQuery("#frm_data_field_"+c.HideField+"_container").html(""),frmGetData(c,k,h,1)):g[c.HideField][b]=0==k.length?!1:{funcName:"frmGetDataOpts",f:c,sel:k}}else"data-select"==c.Type&&"undefined"!=typeof c.LinkedField?""==c.DataType||"data"==c.DataType?""==
a?(g[c.HideField][b]=!1,jQuery("#frm_data_field_"+c.HideField+"_container").html("")):a&&jQuery.isArray(a)?(g[c.HideField][b]=!0,jQuery("#frm_data_field_"+c.HideField+"_container").html(""),frmGetData(c,a,h,1)):g[c.HideField][b]={funcName:"frmGetData",f:c,sel:a}:g[c.HideField][b]=""==a?!1:{funcName:"frmGetDataOpts",f:c,sel:a}:"undefined"==typeof c.Value&&0===c.Type.indexOf("data")?(c.Value=""==a?"1":a,g[c.HideField][b]=frmOperators(c.Condition,c.Value,a),c.Value=void 0):g[c.HideField][b]=frmOperators(c.Condition,
c.Value,a);c.FieldName!=d&&(a=f);"any"==c.MatchType?!1!=g[c.HideField][b]?"show"==c.Show?!0!=g[c.HideField][b]?frmShowField(g[c.HideField][b],h,c.FieldName):jQuery("#frm_field_"+c.HideField+"_container").show():jQuery("#frm_field_"+c.HideField+"_container").hide():n.push({result:g[c.HideField][b],show:c.Show,match:"any",fname:c.FieldName,fkey:c.HideField}):"all"==c.MatchType&&n.push({result:g[c.HideField][b],show:c.Show,match:"all",fname:c.FieldName,fkey:c.HideField});b==p-1&&jQuery.each(n,function(a,
b){"undefined"!=typeof b&&"undefined"!=typeof b.result&&("any"==b.match&&!frmInArray(!0,g[b.fkey])||"all"==b.match&&frmInArray(!1,g[b.fkey])?"show"==b.show?(jQuery("#frm_field_"+b.fkey+"_container:hidden").hide(),jQuery("#frm_field_"+b.fkey+"_container").hide()):jQuery("#frm_field_"+b.fkey+"_container").show():"show"==b.show?jQuery("#frm_field_"+b.fkey+"_container").show():(jQuery("#frm_field_"+b.fkey+"_container:hidden").hide(),jQuery("#frm_field_"+b.fkey+"_container").hide()),!1!=typeof b.result&&
!0!=typeof b.result&&frmShowField(b.result,h,b.fname),delete n[a])})})(f)}}
function frmOperators(a,d,b){"undefined"==typeof b&&(b="");jQuery.isArray(b)&&-1<jQuery.inArray(d,b)&&(b=d);-1!=String(d).search(/^\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*$/)&&(d=parseFloat(d),b=parseFloat(b));return{"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},"<":function(a,b){return a>b},">":function(a,b){return a<b},LIKE:function(a,b){return-1!=b.indexOf(a)},"not LIKE":function(a,b){return-1==b.indexOf(a)}}[a](d,b)}
function frmInArray(a,d){if("undefined"==typeof d)return!1;for(var b=d.length,h=0;h<b;h++)if(d[h]==a)return!0;return!1}function frmShowField(a,d,b){"frmGetDataOpts"==a.funcName?frmGetDataOpts(a.f,a.sel,d,b):"frmGetData"==a.funcName&&frmGetData(a.f,a.sel,d,0)}
function frmGetData(a,d,b,h){h||jQuery("#frm_data_field_"+a.HideField+"_container").html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:b,data:"controller=fields&frm_action=ajax_get_data&entry_id="+d+"&field_id="+a.LinkedField+"&current_field="+a.HideField,success:function(b){""!=b&&jQuery("#frm_field_"+a.HideField+"_container").show();if(h)jQuery("#frm_data_field_"+a.HideField+"_container").append(b);else{jQuery("#frm_data_field_"+a.HideField+"_container").html(b);var f=jQuery("#frm_data_field_"+
a.HideField+"_container").children("input").val();""!=b&&""!=f||jQuery("#frm_field_"+a.HideField+"_container").hide();frmCheckDependent(d,a.HideField)}return!0}})}
function frmGetDataOpts(a,d,b,h){var e=[];if("checkbox"==a.DataType||"radio"==a.DataType)jQuery("input[name='item_meta["+a.HideField+"][]']:checked").each(function(){e.push(jQuery(this).val())});else if("select"==a.DataType){var f=0<jQuery("select[name='item_meta["+a.HideField+"][]']").length?"[]":"";e.push(jQuery("select[name='item_meta["+a.HideField+"]"+f+"']").val())}else e.push(jQuery("input[name='item_meta["+a.HideField+"]']").val());jQuery("#frm_data_field_"+a.HideField+"_container").html('<span class="frm-loading-img"></span>');
0==e.length&&(e="");jQuery.ajax({type:"POST",url:b,data:"controller=fields&frm_action=ajax_data_options&hide_field="+h+"&entry_id="+d+"&selected_field_id="+a.LinkedField+"&field_id="+a.HideField,success:function(b){""==b?(jQuery("#frm_field_"+a.HideField+"_container").hide(),e=""):"all"!=a.MatchType&&jQuery("#frm_field_"+a.HideField+"_container").show();jQuery("#frm_data_field_"+a.HideField+"_container").html(b);jQuery(b).hasClass("frm_chzn")&&jQuery(".frm_chzn").chosen();""!=b&&""!=e&&jQuery.each(e,
function(b,d){"checkbox"==a.DataType?jQuery("#field_"+a.HideField+"-"+d).attr("checked","checked"):"select"==a.DataType?0<jQuery("select[name='item_meta["+a.HideField+"]"+f+"'] option[value="+d+"]").length?jQuery("select[name='item_meta["+a.HideField+"]"+f+"']").val(d):e.splice(b,1):jQuery("input[name='item_meta["+a.HideField+"]']").val(d)});frmCheckDependent(e,a.HideField)}})}
function frmOnSubmit(a){a.preventDefault();jQuery(this).find(".wp-editor-wrap").length&&tinyMCE.triggerSave();frmGetFormErrors(this)}
function frmGetFormErrors(a,d){"undefined"!=typeof __FRMURL&&(d=__FRMURL);jQuery(a).find('input[type="submit"]').attr("disabled","disabled");jQuery(a).find(".frm_ajax_loading").css("visibility","visible");jQuery.ajax({type:"POST",url:d,data:jQuery(a).serialize()+"&controller=entries&_ajax_nonce=1",success:function(b){b=b.replace(/^\s+|\s+$/g,"");0===b.indexOf("{")&&(b=jQuery.parseJSON(b));if(""==b||!b||"0"==b||"object"!=typeof b&&0===b.indexOf("<!DOCTYPE"))jQuery("#frm_loading").length&&(b=jQuery(a).find("input[type=file]").val(),
"undefined"!=typeof b&&""!=b&&window.setTimeout(function(){jQuery("#frm_loading").fadeIn("slow")},2E3)),jQuery(a).find("#recaptcha_area").length&&(1>jQuery(a).find(".frm_next_page").length||1>jQuery(a).find(".frm_next_page").val())&&jQuery(a).find("#recaptcha_area").replaceWith(""),a.submit();else if("object"!=typeof b){jQuery(a).find(".frm_ajax_loading").css("visibility","hidden");var d=jQuery(a).closest("#frm_form_"+jQuery(a).find('input[name="form_id"]').val()+"_container"),e=d.offset().top;d.replaceWith(b);
var f=document.documentElement.scrollTop||document.body.scrollTop;e&&(0<e&&f>e)&&jQuery(window).scrollTop(e);if("function"==typeof frmThemeOverride_frmAfterSubmit){if(d=jQuery(b).find('input[name="form_id"]').val())var k=jQuery('input[name="frm_page_order_'+d+'"]').val();frmThemeOverride_frmAfterSubmit(d,k,b)}0<jQuery(a).find('input[name="id"]').length&&(b=jQuery(a).find('input[name="id"]').val(),jQuery("#frm_edit_"+b).find("a").addClass("frm_ajax_edited").click())}else{jQuery(a).find('input[type="submit"]').removeAttr("disabled");
jQuery(a).find(".frm_ajax_loading").css("visibility","hidden");k=!0;jQuery(".form-field").removeClass("frm_blank_field");jQuery(".form-field .frm_error").replaceWith("");var d="",m=!1,l;for(l in b)jQuery(a).find("#frm_field_"+l+"_container").length&&jQuery("#frm_field_"+l+"_container").is(":visible")&&(k=!1,""==d&&(d="#frm_field_"+l+"_container",e=jQuery(a).find(d).offset().top,f=jQuery("html").css("margin-top"),e&&f&&(e-=parseInt(f)),f=document.documentElement.scrollTop||document.body.scrollTop,
e&&f>e&&jQuery(window).scrollTop(e-4)),jQuery(a).find("#frm_field_"+l+"_container #recaptcha_area").length&&(m=!0,Recaptcha.reload()),jQuery(a).find("#frm_field_"+l+"_container").addClass("frm_blank_field"),"function"==typeof frmThemeOverride_frmPlaceError?frmThemeOverride_frmPlaceError(l,b):jQuery(a).find("#frm_field_"+l+"_container").append('<div class="frm_error">'+b[l]+"</div>"));!0!=m&&jQuery(a).find("#recaptcha_area").replaceWith("");k&&a.submit()}},error:function(b){jQuery(a).find('input[type="submit"]').removeAttr("disabled");
a.submit()}})}function frmGetEntryToEdit(a,d,b,h){jQuery.ajax({type:"POST",url:h,data:"controller=entries&frm_action=edit_entry_ajax&id="+a+"&post_id="+b+"entry_id="+d,success:function(b){jQuery("#frm_form_"+a+"_container").replaceWith(b)}})}
function frmEditEntry(a,d,b,h,e,f,k){var m=jQuery("#frm_edit_"+a).text(),l=jQuery("#"+b+a).html();jQuery("#"+b+a).html('<span class="frm-loading-img" id="'+b+a+'"></span><div class="frm_orig_content" style="display:none">'+l+"</div>");jQuery.ajax({type:"POST",url:d,dataType:"html",data:"controller=entries&frm_action=edit_entry_ajax&post_id="+h+"&entry_id="+a+"&id="+e,success:function(g){jQuery("#"+b+a).children(".frm-loading-img").replaceWith(g);jQuery("#frm_edit_"+a).replaceWith('<span id="frm_edit_'+
a+'"><a onclick="frmCancelEdit('+a+",'"+b+"','"+m+"','"+d+"',"+h+","+e+",'"+k+'\')" class="'+k+'">'+f+"</a></span>")}})}
function frmCancelEdit(a,d,b,h,e,f,k){var m=jQuery("#frm_edit_"+a).text();jQuery("#frm_edit_"+a).find("a").hasClass("frm_ajax_edited")||(jQuery("#"+d+a).children(".frm_forms").replaceWith(""),jQuery("#"+d+a).children(".frm_orig_content").fadeIn("slow").removeClass("frm_orig_content"));jQuery("#frm_edit_"+a).replaceWith('<a id="frm_edit_'+a+'" class="frm_edit_link '+k+'" href="javascript:frmEditEntry('+a+",'"+h+"','"+d+"',"+e+","+f+",'"+m+"','"+k+"')\">"+b+"</a>")}
function frmUpdateField(a,d,b,h,e,f){jQuery("#frm_update_field_"+a+"_"+d).html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:e,data:"controller=entries&frm_action=update_field_ajax&entry_id="+a+"&field_id="+d+"&value="+b,success:function(b){""==h?jQuery("#frm_update_field_"+a+"_"+d+"_"+f).fadeOut("slow"):jQuery("#frm_update_field_"+a+"_"+d+"_"+f).replaceWith(h)}})}
function frmDeleteEntry(a,d,b){jQuery("#frm_delete_"+a).replaceWith('<span class="frm-loading-img" id="frm_delete_'+a+'"></span>');jQuery.ajax({type:"POST",url:d,data:"controller=entries&frm_action=destroy&entry="+a,success:function(d){"success"==d?jQuery("#"+b+a).fadeOut("slow"):jQuery("#frm_delete_"+a).replaceWith(d)}})}function frmRemoveDiv(a){jQuery(a).fadeOut("slow").replaceWith("")}
function frmNextUpload(a,d,b){a.wrap('<div class="frm_file_names frm_uploaded_files">');a.after(a.val()+' <a href="#" onclick="frmClearFile(jQuery(this));return false;">'+b+"</a>");a.hide();jQuery("#frm_field_"+d+"_container").append('<input name="file'+d+'[]" type="file" onchange="frmNextUpload(jQuery(this),'+d+",'"+b+"')\"/>")}function frmClearFile(a){a.parent(".frm_file_names").replaceWith("");return!1};