jQuery(function(r){function e(){wysijaAJAX.popTitle=wysijatrans.previewemail,wysijaAJAX.dataType="json",wysijaAJAX.task="send_preview",wysijaAJAX._wpnonce=wysijanonces.campaigns.send_preview,0<jQuery("#campaignstep3").length&&(wysijaAJAX.data=jQuery("#campaignstep3").serializeArray(),wysijaAJAX.id=jQuery("#email_id").val()),wysijaAJAX.receiver=jQuery("#preview-receiver").val(),jQuery.WYSIJA_SEND()}function t(){return"function"==typeof saveWYSIJA?saveWYSIJA(function(){e()}):e(),!1}function n(){var e={};return r(".checkbox.checklists").each(function(){r(this).attr("checked")&&(e[r(this).attr("id")]={total:parseInt(r("#"+r(this).attr("id")+"count").val()),title:r(this).attr("alt")})}),e}function i(){var e=n(),t=0,i="";for(var a in e)t+=parseInt(e[a].total),i+=e[a].title+", ";if(i=i.substr(0,i.length-2),wysijatrans.alertsend==undefined||r("#scheduleit").attr("checked"))return wysijatrans.ignoreprevious==undefined||!r("#ignore_subscribers").attr("checked")||!!confirm(wysijatrans.ignoreprevious);var s=wysijatrans.alertsend;return s=(s=s.replace("[#]",t)).replace("[#nms]",i),!!confirm(s)}function a(){if(r("#wysija-send-spamtest").hasClass("disabled"))return!1;WysijaPopup.showLoading(),WysijaPopup.showOverlay(),saveWYSIJA(function(){s()})}function s(){wysijaAJAX.popTitle=wysijatrans.previewemail,wysijaAJAX.dataType="json",wysijaAJAX.task="send_spamtest",wysijaAJAX._wpnonce=wysijanonces.campaigns.send_spamtest,r.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(e){if(WysijaPopup.hideLoading(),e.result.result){r("#wysija-spam-results").attr("href",e.result.urlredirect).fadeIn("slow");var t=parseInt(r("#counttriesleft").html())-1;r("#counttriesleft").html(t),t<=0&&r("#wysija-send-spamtest").addClass("disabled"),WysijaPopup.hideOverlay()}else e.result.notriesleft&&alert(e.result.notriesleft),WysijaPopup.hideOverlay()},error:function(e){alert("Request error not JSON:"+e.responseText),delete wysijaAJAXcallback.onSuccess},dataType:wysijaAJAX.dataType})}r(".action-send-spam-test").click(function(){return tb_show(wysijatrans.processqueue,r(this).attr("href")+"&KeepThis=true&TB_iframe=true&height=618&width=1000",null),tb_showIframe(),!1}),r("#wj-send-preview").click(t),r("#submit-send").click(i),r(document).ready(function(){function e(e){r("#scheduleit").attr("checked")?(r(".schedule-row").show(),r("#submit-send").val(wysijatrans.schedule)):(r(".schedule-row").hide(),r("#submit-send").val(e))}if("function"!=typeof saveWYSIJA){r("#datepicker-day").datepicker({minDate:0,showOn:"focus",dateFormat:"yy-mm-dd"});var t=r("#submit-send").val();e(t),r("#scheduleit").change(function(){e(t)})}}),r("#wysija-send-spamtest").click(a),r("#link-back-step2").click(function(){return r("#hid-redir").attr("value","savelastback"),r("#campaignstep3").submit(),!1})}),window.mailpoet="object"==typeof window.mailpoet?window.mailpoet:{$:{}},function(e,i){"use strict";var t=i.mailpoet.fn={};t.isGoodFromAddress=function(e){var t=e.split("@")[1];return void 0!==t&&""!==t&&t.toLowerCase()===i.location.host.toLowerCase()},t.isGmailAddress=function(e){var t=e.split("@")[1];return void 0!==t&&""!==t&&"gmail.com"===t.toLowerCase()}}(jQuery,window),function(e,t){"use strict";var i=t.mailpoet;e(t).load(function(){"object"==typeof e.fn.tooltip&&(i.$.from_email=e("#from_email"),i.$.from_email.tooltip({animation:!0,placement:"bottom",trigger:"manual",html:!0,title:function(){return i.$.from_email.data("message")}}).on({"verifyEmail.mailpoet":function(){if(i.fn.isGoodFromAddress(i.$.from_email.val()))return i.$.from_email.data("message","").tooltip("hide");if("true"===wysijatrans.emailCheck.isGmail)return i.$.from_email.data("message","").tooltip("hide");var e="";return e=i.fn.isGmailAddress(i.$.from_email.val())?wysijatrans.emailCheck.gmailText:wysijatrans.emailCheck.text,i.$.from_email.is(":visible")?i.$.from_email.data("message",e).tooltip("show"):i.$.from_email.tooltip("hide")},keyup:function(){i.$.from_email.trigger("verifyEmail.mailpoet")}}).trigger("verifyEmail.mailpoet"))})}(jQuery,window);