!function($){"use strict";function t(t,i,e,o,n){var a={url:spuvar.ajax_url,data:t,cache:!1,type:"POST",dataType:"json",timeout:3e4},n=n||!1,e=e||!1,o=o||!1;i&&(a.url=i),e&&(a.success=e),o&&(a.error=o),n&&(a.dataType=n),$.ajax(a)}function i(t,i,e){if(e){var o=new Date;o.setTime(o.getTime()+24*e*60*60*1e3);var n="; expires="+o.toGMTString()}else var n="";document.cookie=t+"="+i+n+"; path=/"}function e(t){for(var i=t+"=",e=document.cookie.split(";"),o=0;or&&(s=e/2-a/2),i.css({left:s,position:c,top:d})),n+50>o&&(c="absolute",d=f,i.css({position:c,top:d,bottom:"auto"}))}function n(t){var i=$(t).find(".spu-facebook");if(i.length){var e=i.find(".fb-like > span").width();if(0==e){var o=i.find(".fb-like").data("layout");i.append("box_count"==o?'":'")}}}function a(t,e){var n=u[t],a=$("#spu-bg-"+t),r=n.data("bgopa");if(n.is(":animated"))return!1;if(e===!0&&n.is(":visible")||e===!1&&n.is(":hidden"))return!1;if(e===!1){var s=parseInt(n.data("cookie"));s>0&&i("spu_box_"+t,!0,s)}else $(window).resize(function(){o(t)}),o(t);var d=n.data("spuanimation");return"fade"===d?n.fadeToggle("slow"):n.slideToggle("slow"),e===!0&&r>0?a.fadeIn():a.fadeOut(),e}var r=$(window).height(),d=spuvar.is_admin,u=[];return s(),$(".spu-content").children().first().css({"margin-top":0,"padding-top":0}).end().last().css({"margin-bottom":0,"padding-bottom":0}),$(".spu-box").each(function(){spuvar.safe_mode&&$(this).prependTo("body");var i=$(this),o=i.data("trigger"),s=0,c=1===parseInt(i.data("test-mode")),f=i.data("box-id"),p=1===parseInt(i.data("auto-hide")),l=parseInt(i.data("seconds-close")),h=parseInt(i.data("trigger-number"),10),g="percentage"==o?parseInt(i.data("trigger-number"),10)/100:.8,w=g*$(document).height();n(i),$(".spu-google").width($(".spu-google").width()-20),$(".spu-twitter").width($(".spu-twitter ").width()-50);var m=0,v=0,b=i.outerWidth(),_=i.find(".spu-content").width(),y=i.data("total");$(".spu-shortcode").wrapAll('
'),y&&!spuvar.disable_style&&$(window).width()>b&&($(this).find(".spu-shortcode").each(function(){m+=$(this).width()}),v=_-m-y),v>0&&($(this).find(".spu-shortcode").each(function(){$(this).css("margin-left",v/2)}),2==y?$(this).find(".spu-shortcode").last().css("margin-left",0):3==y&&$(this).find(".spu-shortcode").first().css("margin-left",0)),$(document).keyup(function(t){27==t.keyCode&&a(f,!1)});var x=navigator.userAgent,T=x.match(/iPad/i)||x.match(/iPhone/i)?"touchstart":"click";$("body").on(T,function(t){void 0!==t.originalEvent&&a(f,!1)}),$("body").on(T,".spu-box",function(t){t.stopPropagation()}),i.hide().css("left",""),u[f]=i;var k=function(){s&&clearTimeout(s),s=window.setTimeout(function(){var t=$(window).scrollTop(),i=t+r>=w;i?(p||$(window).unbind("scroll",k),a(f,!0)):a(f,!1)},100)},P=function(){s&&clearTimeout(s),s=window.setTimeout(function(){a(f,!0)},1e3*h)},j=e("spu_box_"+f);if((void 0==j||""==j||d&&c)&&("seconds"==o?P():($(window).bind("scroll",k),k()),window.location.hash&&window.location.hash.length>0)){var I=window.location.hash,S;I.substring(1)===i.attr("id")&&setTimeout(function(){a(f,!0)},100)}i.find(".spu-close-popup").click(function(){a(f,!1),"percentage"==o&&$(window).unbind("scroll",k)}),$('a[href="#'+i.attr("id")+'"]').click(function(){return a(f,!0),!1}),i.find(".gform_wrapper form").addClass("gravity-form"),i.on("submit",'form:not(".wpcf7-form, .gravity-form")',function(i){i.preventDefault();var e=!0,o=$(this),n=o.serialize(),r=o.attr("action"),s=function(t,i,e){console.log("Spu Form error: "+i+" - "+e)},d=function(t){var i=$(t).filter("#spu-"+f).html();$("#spu-"+f).html(i),$("#spu-"+f).find(".mc4wp-form-error").length||setTimeout(function(){a(f,!1)},1e3*spuvar.seconds_confirmation_close)};return t(n,r,d,s,"html"),e}),$("body").on("mailsent.wpcf7",function(){a(f,!1)}),$(document).on("gform_confirmation_loaded",function(){a(f,!1)})}),{show:function(t){return a(t,!0)},hide:function(t){return a(t,!1)},request:function(i,e,o,n){return t(i,e,o,n)}}};if(spuvar.ajax_mode){var c={pid:spuvar.pid,referrer:document.referrer},f=function(t){$("body").append(t),window.SPU=u(),d()},p=function(t,i,e){console.log("Problem loading popups - error: "+i+" - "+e)};t(c,spuvar.ajax_mode_url,f,p,"html")}else jQuery(window).load(function(){window.SPU=u()});var l=!1,h=setInterval(function(){"undefined"==typeof FB||l||o()},1e3);"undefined"!=typeof twttr&&twttr.ready(function(t){t.events.bind("tweet",n),t.events.bind("follow",n)})}(jQuery);