/*! * imagesLoaded PACKAGED v3.1.8 * JavaScript is all like "You images are done yet or what?" * MIT License */ (function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("wolfy87-eventemitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(window,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function f(e){this.img=e}function c(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var f=r[o];this.addImage(f)}}},s.prototype.addImage=function(e){var t=new f(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),f.prototype=new t,f.prototype.check=function(){var e=v[this.img.src]||new c(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},f.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return c.prototype=new t,c.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},c.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s});(function($){"use strict";var SPU_master=function(){var windowHeight=$(window).height();var isAdmin=spuvar.is_admin;var isPreview=spuvar.is_preview;var $boxes=[];$(".spu-content").children().first().css({"margin-top":0,"padding-top":0}).end().last().css({'margin-bottom':0,'padding-bottom':0});$(".spu-box").each(function(){var $box=$(this);if($box.hasClass('spu-top-bar')||$box.hasClass('spu-bottom-bar')){$box.prependTo('body');if($box.hasClass('spu-top-bar')&&$('#wpadminbar').length) $box.css('top','32px');} var triggerMethod=$box.data('trigger');var timer=0;var testMode=(parseInt($box.data('test-mode'))===1);var id=$box.data('box-id');var autoHide=(parseInt($box.data('auto-hide'))===1);var secondsClose=parseInt($box.data('seconds-close'));var triggerSeconds=parseInt($box.data('trigger-number'),10);var triggerPercentage=(triggerMethod=='percentage')?(parseInt($box.data('trigger-number'),10)/100):0.8;var triggerHeight=(triggerPercentage*$(document).height());facebookFix($box);var iframe=$box.find('iframe');if(iframe&&iframe.length){iframe.each(function(){$(this).attr('spusrc',$(this).attr('src'));$(this).attr('src','http://#');})} $box.on('click','a:not(".spu-close-popup, .flp_wrapper a, .spu-not-close, .spu-not-close a")',function(){toggleBox(id,false,true);});$box.on('click','.spu-close-convert,.spu-close-convert a',function(e){e.preventDefault();toggleBox(id,false,true);});$(document).keyup(function(e){if(e.keyCode==27){toggleBox(id,false,false);}});var ua=navigator.userAgent,event=(ua.match(/iPad/i)||ua.match(/iPhone/i))?"touchstart":"click";$('body').on(event,function(ev){var $target=$(ev.target);if($target.is('input.nf-element')){return;} if(ev.originalEvent!==undefined&&!($.contains($box,$target)&&$target.is('input'))&&!$box.hasClass('spu-top-bar')&&!$box.hasClass('spu-bottom-bar')){toggleBox(id,false,false);}});$('body').on(event,'.spu-box,.spu-clickable',function(event){event.stopPropagation();});$box.hide().css('left','').css('right','');$boxes[id]=$box;var triggerHeightCheck=function() {if(timer){clearTimeout(timer);} timer=window.setTimeout(function(){var scrollY=$(window).scrollTop();var triggered=((scrollY+windowHeight)>=triggerHeight);if(triggered){if(!autoHide){$(window).unbind('scroll',triggerHeightCheck);} toggleBox(id,true,false);}else{toggleBox(id,false,false);}},100);} var triggerPixelsCheck=function() {if(timer){clearTimeout(timer);} timer=window.setTimeout(function(){var scrollY=$(window).scrollTop();var triggered=(scrollY>=triggerSeconds);if(triggered){if(!autoHide){$(window).unbind('scroll',triggerPixelsCheck);} toggleBox(id,true,false);}else{toggleBox(id,false,false);}},100);} var triggerSecondsCheck=function() {if(timer){clearTimeout(timer);} timer=window.setTimeout(function(){toggleBox(id,true,false);},triggerSeconds*1000);} var nclose_cookie=$box.data('nclose-cookie');var nconvert_cookie=$box.data('nconvert-cookie');var cookieValue1=spuReadCookie(nclose_cookie);var cookieValue2=spuReadCookie(nconvert_cookie);if(((cookieValue1==undefined||cookieValue1=='')&&(cookieValue2==undefined||cookieValue2==''))||(isAdmin&&testMode)||isPreview){if(triggerMethod=='seconds'){triggerSecondsCheck();} if(triggerMethod=='percentage'){$(window).bind('scroll',triggerHeightCheck);triggerHeightCheck();} if(triggerMethod=='pixels'){$(window).bind('scroll',triggerPixelsCheck);triggerPixelsCheck();} if(window.location.hash&&window.location.hash.length>0){var hash=window.location.hash;var $element;if(hash.substring(1)===$box.attr('id')){setTimeout(function(){toggleBox(id,true,false);},100);}}} $box.on('click','.spu-close-popup',function(){toggleBox(id,false,false);if(triggerMethod=='percentage'){$(window).unbind('scroll',triggerHeightCheck);}});$(document.body).on('click','a[href="#spu-'+id+'"], .spu-open-'+id,function(e){e.preventDefault();toggleBox(id,true,false);});$('a[href="#spu-'+id+'"], .spu-open-'+id).css('cursor','pointer').addClass('spu-clickable');$box.find('.gform_wrapper form').addClass('gravity-form');$box.find('.mc4wp-form form').addClass('mc4wp-form');$box.find('.newsletter form').addClass('newsletter-form');var box_form=$box.find('form');if(box_form.length){if(!box_form.is(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .widget_wysija, .ninja-forms-form")){var action=box_form.attr('action'),pattern=new RegExp(spuvar.site_url,"i");if(action&&action.length){if(!pattern.test(action)) box_form.addClass('spu-disable-ajax');}} if($('.spu-disable-ajax form').length){$('.spu-disable-ajax form').addClass('spu-disable-ajax');} $box.on('submit','form.spu-disable-ajax:not(".flp_form")',function(){$box.trigger('spu.form_submitted',[id]);toggleBox(id,false,true);});$box.on('submit','form:not(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .spu-disable-ajax, .widget_wysija, .ninja-forms-form, .flp_form")',function(e){e.preventDefault();var submit=true,form=$(this),button=form.find('input[type="submit"]'),tail=button?button.attr('name')+'='+button.val():'button=send',data=form.serialize()+"&"+tail,referer=form.find('input[name="_wp_http_referer"]'),urlref=referer&&referer.val()!==undefined?spuvar.site_url+referer.val():window.location.href,action=form.attr('action')?form.attr('action'):urlref,url=form.hasClass('mc4wp-form')?spuvar.site_url+'/':action,error_cb=function(data,error,errorThrown){console.log('Spu Form error: '+error+' - '+errorThrown);},success_cb=function(data){var response=$(data).filter('#spu-'+id).html();$('#spu-'+id).html(response);if(!$('#spu-'+id).find('.mc4wp-alert').length){setTimeout(function(){toggleBox(id,false,true);},spuvar.seconds_confirmation_close*1000);}};request(data,url,success_cb,error_cb,'html');$box.trigger('spu.form_submitted',[id]);return submit;});$(document).on('wpcf7mailsent',function(){$box.trigger('spu.form_submitted',[id]);toggleBox(id,false,true);});if(box_form.hasClass('gravity-form')){box_form.attr('action',window.location.href)} $(document).on('gform_confirmation_loaded',function(){$box.trigger('spu.form_submitted',[id]);toggleBox(id,false,true);});$box.on('submit','.infusion-form',function(e){e.preventDefault();$box.trigger('spu.form_submitted',[id]);toggleBox(id,false,true);this.submit();});$box.on('submit','.newsletter-form',function(e){e.preventDefault();$box.trigger('spu.form_submitted',[id]);toggleBox(id,false,true);this.submit();});$('body').on('submitResponse.default',function(){$box.trigger('spu.form_submitted',[id]);toggleBox(id,false,true);});} var box_nf3=$box.find('.nf-form-cont');if(box_nf3.length){$(document).on('nfFormSubmitResponse',function(){$box.trigger('spu.form_submitted',[id]);setTimeout(function(){toggleBox(id,false,true);},spuvar.seconds_confirmation_close*1000);});}});function fixSize(id){var $box=$boxes[id];var windowWidth=$(window).width();var windowHeight=$(window).height();var popupHeight=$box.outerHeight();var popupWidth=$box.outerWidth();var intentWidth=$box.data('width');var left=0;var top=windowHeight/2-popupHeight/2;var position='fixed';var currentScroll=$(document).scrollTop();if($box.hasClass('spu-centered')){if(intentWidthwindowHeight){position='absolute';top=currentScroll;$box.css({"position":position,"top":top,"bottom":"auto",});}} function facebookFix(box){var $fbbox=$(box).find('.spu-facebook');if($fbbox.length){var $fbwidth=$fbbox.find('.fb-like > span').width();if($fbwidth==0){var $fblayout=$fbbox.find('.fb-like').data('layout');if($fblayout=='box_count'){$fbbox.append('');}else if($fblayout=='button_count'){$fbbox.append('');}else{$fbbox.append('');}}}} function centerShortcodes(box){var $box=box;var total=$box.data('total');if(total){var swidth=0;var free_width=0;var boxwidth=$box.outerWidth();var cwidth=$box.find(".spu-content").width();if(!spuvar.disable_style&&$(window).width()>boxwidth){$box.find(".spu-shortcode").wrapAll('
');$box.find(".spu-shortcode").each(function(){swidth=swidth+$(this).outerWidth();});free_width=cwidth-swidth-(total*20);} if(free_width>0){$box.find(".spu-shortcode").each(function(){$(this).css('margin-left',(free_width/2));});if(total==2){$box.find(".spu-shortcode").last().css('margin-left',0);}else if(total==3){$box.find(".spu-shortcode").first().css('margin-left',0);}}}} function toggleBox(id,show,conversion){var $box=$boxes[id];var $bg=$('#spu-bg-'+id);var $bgopa=$box.data('bgopa');if($box.is(":animated")){return false;} if((show===true&&$box.is(":visible"))||(show===false&&$box.is(":hidden"))){return false;} if(show===false){var tcookie=$box.data('tclose-cookie');var dcookie=parseFloat($box.data('dclose-cookie'));var ncookie=$box.data('nclose-cookie');if(conversion===true){tcookie=$box.data('tconvert-cookie');dcookie=parseFloat($box.data('dconvert-cookie'));ncookie=$box.data('nconvert-cookie');} if(dcookie>0){spuCreateCookie(ncookie,true,tcookie,dcookie);} $box.trigger('spu.box_close',[id]);var iframe=$box.find('iframe[src*="vimeo"],iframe[src*="youtube"],iframe[src*="youtu.be"]');if(iframe&&iframe.length){iframe.each(function(){$(this).attr('src','http://#');});}}else{setTimeout(function(){centerShortcodes($box);},1500);$box.trigger('spu.box_open',[id]);$(window).resize(function(){fixSize(id);});fixSize(id);var iframe=$box.find('iframe');if(iframe&&iframe.length){iframe.each(function(){if($(this).attr('spusrc')) $(this).attr('src',$(this).attr('spusrc'));});}} var animation=$box.data('spuanimation'),conversion_close=$box.data('close-on-conversion');if(animation==='fade'){if(show===true){$box.fadeIn('slow');}else if(show===false&&((conversion_close&&conversion)||!conversion)){$box.fadeOut('slow');}}else if(animation==='disable'){if(show===true){$box.show();}else if(show===false&&((conversion_close&&conversion)||!conversion)){$box.hide();}}else{if(show===true){$box.slideDown('slow');}else if(show===false&&((conversion_close&&conversion)||!conversion)){$box.slideUp('slow');}} if(show===true&&$bgopa>0&&!$box.hasClass('spu-top-bar')&&!$box.hasClass('spu-bottom-bar')){if(animation==='disable'){$bg.show();}else{$bg.fadeIn();}}else if(show===false&&((conversion_close&&conversion)||!conversion)){if(animation==='disable'){$bg.hide();}else{$bg.fadeOut();}} return show;} return{show:function(box_id){return toggleBox(box_id,true,false);},hide:function(box_id,conversion){return toggleBox(box_id,false,conversion);},resize:function(box_id){return fixSize(box_id);},request:function(data,url,success_cb,error_cb){return request(data,url,success_cb,error_cb);}}} if(spuvar.ajax_mode){var data={pid:spuvar.pid,referrer:document.referrer,current_url:document.documentURI,query_string:document.location.search,is_category:spuvar.is_category,is_archive:spuvar.is_archive,is_preview:spuvar.is_preview},success_cb=function(response){$('body').append(response);$(".spu-box").imagesLoaded(function(){window.SPU=SPU_master();SPU_reload_forms();});},error_cb=function(data,error,errorThrown){console.log('Problem loading popups - error: '+error+' - '+errorThrown);} request(data,spuvar.ajax_mode_url,success_cb,error_cb,'html');}else{$(".spu-box").imagesLoaded(function(){window.SPU=SPU_master();});} function request(data,url,success_cb,error_cb,dataType){var ajax={url:spuvar.ajax_url,data:data,cache:false,type:'POST',dataType:'json',timeout:30000},dataType=dataType||false,success_cb=success_cb||false,error_cb=error_cb||false;if(url){ajax.url=url;} if(success_cb){ajax.success=success_cb;} if(error_cb){ajax.error=error_cb;} if(dataType){ajax.dataType=dataType;} $.ajax(ajax);} function spuCreateCookie(name,value,type,duration){if(duration){var date=new Date();if(type=='h') date.setTime(date.getTime()+(duration*60*60*1000));else date.setTime(date.getTime()+(duration*24*60*60*1000));var expires="; expires="+date.toGMTString();}else var expires="";document.cookie=name+"="+value+expires+"; path=/";} function spuReadCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i form').each(function(){wpcf7.initForm($(this));if(wpcf7.cached){wpcf7.refill($(this));}});} if($.fn.wpcf7InitForm){$('.spu-box div.wpcf7 > form').wpcf7InitForm();}}})(jQuery);