(function(h){var f=[];var b=[];var a=[];var j=[];h(document).on("click",".vp-wpa-group-title",function(o){o.preventDefault();var n=h(this).parents(".wpa_group:first");var m=n.find(".vp-controls:first");var p=n.siblings(".wpa_group:not(.tocopy)");var l=h("html, body");if(m.hasClass("vp-hide")){if(p.exists()){p.each(function(q,r){h(this).find(".vp-controls").first().slideUp("fast",function(){h(this).addClass("vp-hide").slideDown(0,function(){if(q==p.length-1){l.animate({scrollTop:n.offset().top-h("#wpadminbar").height()}).promise().done(function(){m.slideUp(0,function(){h(this).removeClass("vp-hide").slideDown("fast")})})}})})})}else{l.animate({scrollTop:n.offset().top-h("#wpadminbar").height()}).promise().done(function(){m.slideUp(0,function(){h(this).removeClass("vp-hide").slideDown("fast")})})}}else{m.slideUp("fast",function(){h(this).addClass("vp-hide").slideDown(0)})}return false});function e(l){l.each(function(){if(h(this).parents(".tocopy").length<=0){vp.init_controls(h(this));var s=h(this).attr("id"),m=h(this).attr("id"),q=h(this).attr("data-vp-validation"),r=h(this).attr("data-vp-bind"),o=h(this).attr("data-vp-items-bind"),p=h(this).attr("data-vp-dependency"),n=h(this).getDatas().type;q&&f.push({name:s,rules:q,type:n});if(typeof r!=="undefined"&&r!==false){r&&b.push({bind:r,type:n,source:s})}if(typeof o!=="undefined"&&o!==false){o&&a.push({bind:o,type:n,source:s})}if(typeof p!=="undefined"&&p!==false){p&&j.push({dep:p,type:"field",source:s})}}})}function k(l){l.each(function(){if(h(this).parents(".tocopy").length<=0&&!h(this).hasClass(".tocopy")){var n=h(this).attr("data-vp-dependency"),m=h(this).getDatas().type,o=h(this).attr("id");if(typeof n!=="undefined"&&n!==false){n&&j.push({dep:n,type:"section",source:o})}}})}function c(){var l=[];h(".wpa_loop.vp-sortable").sortable({items:">.wpa_group",handle:".vp-wpa-group-heading",axis:"y",opacity:0.5,tolerance:"pointer",start:function(m,n){if(typeof window.KIA_metabox!=="undefined"){l=[];vp.tinyMCE_save();h(n.item).find(".customEditor textarea").each(function(){if(h(this).parents(".tocopy").length<=0){try{tinyMCE.execCommand("mceRemoveControl",false,this.id)}catch(o){}l.push(vp.jqid(this.id))}})}},stop:function(n,o){if(typeof window.KIA_metabox!=="undefined"){for(var m=l.length-1;m>=0;m--){var q=h(l[m]);q.val(switchEditors.wpautop(q.val()))}l=l.join(", ");try{KIA_metabox.runTinyMCE(h(l));vp.tinyMCE_save();for(var m=l.length-1;m>=0;m--){var q=h(l[m]);q.val(switchEditors.pre_wpautop(q.val()))}}catch(p){}}}})}h(document).ready(function(){e(jQuery(".vp-metabox .vp-field"));k(jQuery(".vp-metabox .vp-meta-group"));d(b);g(a);i(j);c()});vp.is_multianswer=function(l){var m=["vp-checkbox","vp-checkimage","vp-multiselect"];if(jQuery.inArray(l,m)!==-1){return true}return false};vp.custom_check_radio_event(".vp-metabox",".vp-field.vp-checkimage .field .input label");vp.custom_check_radio_event(".vp-metabox",".vp-field.vp-radioimage .field .input label");h("#post").on("submit",function(o){var n=h("input[type=submit][clicked=true]"),m=n.val(),p=0;vp.tinyMCE_save();h(".vp-field").removeClass("vp-error");h(".validation-msg.vp-error").remove();h(".vp-metabox-error").remove();p=vp.fields_validation_loop(f);if(p>0){$notif=h('');if(m==="Save Draft"){h("#minor-publishing-actions .spinner, #minor-publishing-actions .ajax-loading").hide();$notif.tipsy();$notif.insertAfter("#minor-publishing-actions .spinner, #minor-publishing-actions .ajax-loading");h("#save-post").prop("disabled",false).removeClass("button-disabled")}else{if(m==="Publish"||m==="Update"){h("#publishing-action .spinner, #publishing-action .ajax-loading").hide();$notif.tipsy();$notif.insertAfter("#publishing-action .spinner, #publishing-action .ajax-loading");h("#publish").prop("disabled",false).removeClass("button-primary-disabled")}}var l=Math.ceil((n.outerHeight()-$notif.height())/2);if(l>0){$notif.css("margin-top",l)}o.preventDefault();return}h(this).find(".vp-toggle .vp-input").each(function(){var q=h("",{type:"hidden",name:this.name,value:0});h(this).before(q)})});h("#post input[type=submit]").click(function(){h("input[type=submit]",h(this).parents("form")).removeAttr("clicked");h(this).attr("clicked","true")});function d(m){for(var p=0;p0){p=jQuery(vp.jqid(s.source)).parents(".wpa_group").first().attr("id")}else{p=jQuery(vp.jqid(s.source)).parents(".postbox").attr("id");p=p.substring(0,p.lastIndexOf("_"))}}}t=t.split(",");for(var n=0;n