!function(){function e(e){return document.getElementById(e)}function a(e){for(var a,r=e.target.files||e.dataTransfer.files,i=0;a=r[i];i++){var n=jQuery(this).attr("data-val");t(a,n)}}function r(e){for(var a,r=e.target.files||e.dataTransfer.files,t=0;a=r[t];t++){var i=jQuery(this).attr("data-val");UploadPresetFile(a,i)}}function t(e,a){if(e.type.indexOf("image")<0)return jQuery('[data-val="'+a+'"]').val(""),alert("Please upload image files only"),!1;if("form_bg"==a&&jQuery("#ajax_form_loader").show(),!(location.host.indexOf("sitepointstatic")>=0)){var r=new XMLHttpRequest,t=(new Date).getTime(),i=e.name.lastIndexOf("."),n=e.name.substring(i+1),o=/.*(?=\.)/.exec(e.name),d=t+"_"+o;fname=d.replace(/[^\w\s]/gi,"").replace(/ /g,"")+"."+n;var l=(jQuery('[data-id="arfmainformurl"]').val(),jQuery('[data-id="arffiledragurl"]').val(),document.getElementById("ajaxurl").value);r.open("POST",l);var s=jQuery('input[name="_wpnonce_arprice"]').val(),u=new FormData;u.append("action","arp_send_form_data_admin"),u.append("files",e),u.append("_wpnonce_arprice",s),r.setRequestHeader("X_FILENAME",fname),r.setRequestHeader("X-FILENAME",fname),r.send(u),r.onreadystatechange=function(){if(4==r.readyState)if(200==r.status){var e=r.responseText;if(jQuery("#form_bg_img").val(""),/error/.test(e)){var a=e.split("~|~"),t=a[1];return jQuery("#editor_error_message").find(".message_descripiton").html(t),jQuery("#editor_error_message").animate({width:"toggle"},"1000","linear"),jQuery(window.opera?"html":"html, body").animate({scrollTop:jQuery("#editor_error_message").offset().top-250},"slow"),jQuery("#editor_error_message").delay(3e3).animate({width:"toggle"},"1000","linear"),jQuery("#ajax_form_loader").hide(),!1}jQuery('input[name="arp_template_bg_img"]').val(e);var i=jQuery("#pricing_table_bg_img_upload_url").val();jQuery("#ajax_form_loader").hide(),jQuery("#arp_bg_img_preview").length<=0?jQuery("#delete_bg_image").before("<img src='"+i+e+"' height='35' width='35' name='arp_bg_img_preview' id='arp_bg_img_preview' style='border:1px solid #D5E3FF !important; margin-right:15px;'>"):jQuery("#arp_bg_img_preview").attr("src",i+e),jQuery(".arp_ajaxfileupload").css("display","none"),jQuery(".arp_ajaxfile_after_upload").css("display","block")}else 400==r.status&&jQuery(document).trigger("heartbeat-tick.wp-auth-check",[{"wp-auth-check":!1}])},jQuery("#ajax_form_loader").hide()}}window.File&&window.FileList&&window.FileReader,jQuery(document).on("click",".original",function(){var r=e(jQuery(this).attr("id"));r.addEventListener("change",a,!1);var t=new XMLHttpRequest;t.upload}),jQuery(document).on("click",".arf_preset_data",function(){var a=e(jQuery(this).attr("id"));a.addEventListener("change",r,!1);var t=new XMLHttpRequest;t.upload})}();