!function(e,g,i,d){var a=XF.Cookie.get("sam_viewed")?JSON.parse(XF.Cookie.get("sam_viewed")):{};var j=null;var c=0;var h="down";e(g).scroll(function(){var k=e(this).scrollTop();if(k>c){h="down"}else{h="up"}c=k});function f(m){if(!m.length){return}var o=e(g).scrollTop();if(h=="up"){o-=100}else{o+=100}var n=o+e(g).height();if(h=="up"){n-=100}else{n+=100}var k=e(m).offset().top;var l=k+e(m).height();return((l<=n)&&(k>=o))}function b(l,k){gtag("event",k,{event_category:"Ads",event_label:l.name+" | "+l.type+" | "+l.position})}e(function(){if(XF.samViewCountMethod=="impression"){var n=[];e(XF.samItem+"[data-id][data-cv]").each(function(){var p=e(this).data("id");var o=e(this).data("position")?e(this).data("position"):e(this).parents("div[data-position]").data("position");n.push([p,o])});setTimeout(function(){for(var o in XF.samBgAds){n.push([XF.samBgAds[o],"javascript"])}if(n.length){XF.ajax("POST",XF.canonicalizeUrl("index.php?sam-item/track-impressions"),{impressions:n},function(q){if(q.ga!==undefined&&g.gtag!==undefined){for(var p in q.ga){b(q.ga[p],"Impression")}}},{skipDefault:true,global:false})}},2000);if(e("#siropuChatBar").length){e('div[data-position="footer_fixed"]').each(function(){e(this).css("bottom",e("#siropuChatBar").height()+5)})}}var l=e(XF.samItem+"[data-affiliate-url]");l.on("mousedown",function(q){if(q.which==1||q.which==2){q.preventDefault();var o=e(this).data("affiliate-url");var p=e(this).attr("target");g.open(o,p?p:"_self");e(this).trigger("adClick")}});l.on("mouseover",function(p){var o=e(this).data("non-affiliate-url");if(o){e(this).attr("href",o)}});l.contextmenu(function(o){e(this).attr({href:e(this).data("affiliate-url"),"data-non-affiliate-url":e(this).attr("href")})});e(i).on("mouseover",XF.samItem+" iframe",function(){j=e(this).parents(XF.samItem)});e(i).on("mouseout",XF.samItem+" iframe",function(){j=null});e(g).blur(function(){if(j){j.trigger("click")}});e(g).focus(function(){j=null});function k(p){var o=p.match(/[^-]?width:\s?([\d]+)px/i);return o[1]!==undefined?o[1]:""}function m(){e(".samCustomSize").each(function(){var q=e(this).parent();var p=e(this).hasClass("samResponsive");var o=e(this).hasClass("samCarousel");var t=e(this).attr("style");var s=0;if(t){s=k(t)}else{e(this).find(XF.samItem+"[style]").each(function(){s=k(e(this).attr("style"));if(s){return false}})}var r=s>=q.width();if(r&&!p){e(this).addClass("samResponsive")}else{if(!r&&p){e(this).removeClass("samResponsive")}}})}e(g).resize(function(){m()});m()});XF.SAMUnit=XF.Element.newHandler({options:{position:""},init:function(){var m=this.$target;var l=m.hasClass("samCarousel");if(l&&!m.hasClass("samCustomSize")){var n=m.parent().data("options");if(n.slidesPerView!==undefined){return}var k=[];m.find(XF.samItem+" img[data-src]").on("load",function(){k.push(e(this).width())});m.find(XF.samItem+" img:not([data-src])").each(function(){k.push(e(this).width())});setTimeout(function(){var s=Math.max.apply(Math,k);if(s){var p=(m.parent().width()-s);if(p){var r=p/2-25;var o=0;var q=0;if(m.hasClass("samAlignCenter")){o=r;q=r}else{if(m.hasClass("samAlignRight")){o=p;q=0}else{o=0;q=p}}m.parent().find(".swiper-button-prev").css("left",o-5);m.parent().find(".swiper-button-next").css("right",q-5)}}},1000)}}});XF.SAMItem=XF.Element.newHandler({options:{id:0,ha:0,da:0,df:false,cc:false,cv:false,ll:false,rf:0},refreshInterval:false,init:function(){var l=this.$target;if(this.options.cv){l.on("adView",e.proxy(this,"trackView"))}if(this.options.cc){l.on("click adClick",e.proxy(this,"trackClick"))}if(this.options.df){l.on("adJsView",e.proxy(this,"trackJsView"))}l.on("adViewCarousel",function(){if(f(l.parent())){l.trigger("adView",true)}});var k=this;e(g).scroll(function(){var m=l.parent();if(f(m)){if(k.options.da){k.initDelayDisplay()}else{if(!m.hasClass("samCarousel")){l.trigger("adView")}}if(k.options.ha){k.initDelayHide()}if(k.options.df){l.trigger("adJsView")}if(k.options.ll&&!l.attr("data-loading")){k.loadAd()}}});e(g).scroll()},trackView:function(m,n){if(XF.samViewCountMethod!="view"){return}var k=this.$target;var l=this.getPositionId();if(k.data("viewed")||k.is(":hidden")||(k.parents(".samCarousel").length&&!n)){return}XF.ajax("POST",XF.canonicalizeUrl("index.php?sam-item/"+this.options.id+"/track-view"),{position_id:l},function(o){if(o.ga!==undefined&&g.gtag!==undefined){b(o.ga,"View")}},{skipDefault:true,global:false});if(l=="javascript"){e(".samBackgroundItem").attr("data-viewed",true)}else{k.attr("data-viewed",true)}},trackClick:function(p){var l=this.$target;var n=this.getPositionId();var m=n=="javascript"?l:l.find("a");var k="";if(m.data("multiple")){k=m.find("img").attr("src");if(!k){var o=e(".samBackground").css("background-image");k=o.replace("url(","").replace(")","").replace(/\"/gi,"")}}if(l.data("clicked")){return}XF.ajax("POST",XF.canonicalizeUrl("index.php?sam-item/"+this.options.id+"/track-click"),{position_id:n,image_url:k,page_url:(g.location!=g.parent.location)?i.referrer:i.location.href},function(q){if(n=="javascript"){e(".samBackgroundItem").attr("data-clicked",true)}else{l.attr("data-clicked",true)}if(q.ga!==undefined&&g.gtag!==undefined){b(q.ga,"Click")}},{skipDefault:true,global:false})},trackJsView:function(){a[this.options.id]=XF.samServerTime;XF.Cookie.set("sam_viewed",JSON.stringify(a))},initDelayDisplay:function(){var k=this.$target;if(k.is(":visible")||k.data("da-init")){return}k.attr("data-da-init",true);setTimeout(function(){k.fadeIn();k.trigger("adView");k.removeAttr("data-da-init")},this.options.da*1000)},initDelayHide:function(){var l=this.$target;var m=l.parent();if(l.data("ha-init")){return}l.attr("data-ha-init",true);var k=this;setTimeout(function(){l.fadeOut();l.removeAttr("data-ha-init");setTimeout(function(){if(m.find(XF.samItem+":visible").length==0){m.remove()}},500)},(this.options.da+this.options.ha)*1000)},loadAd:function(m){var k=this;var l=this.$target;var n=k.getPositionId();l.attr("data-loading",true);XF.ajax("GET",XF.canonicalizeUrl("index.php?sam-item/"+this.options.id+"/load"),{position_id:n},function(p){if(p.ad){if(k.options.rf){var o=l.find(".samBackup, .samCloseButton, .samSupportUs").detach();l.html(p.ad);l.append(o)}else{l.prepend(p.ad)}if(!m){l.removeClass("samLazyLoading");e(i).trigger("samInitAdblockDetection")}if(k.options.rf&&!k.refreshInterval){k.refreshInterval=setInterval(function(){k.loadAd(true)},k.options.rf)}}},{skipDefault:true,global:false})},getPositionId:function(){var k=this.$target.data("position");switch(k){case"content_thread":case"content_conversation":case"content_profile":case"javascript":return k;break;default:return this.$target.parents("div[data-position]").data("position");break}}});XF.SAMLazy=XF.Element.newHandler({options:{src:"",carousel:false},init:function(){var k=this;var l=this.$target;if(k.options.carousel==false){e(g).scroll(function(){if(l.is(":hidden")&&f(l.parents("div[data-position]"))){k.loadImage()}});e(g).scroll()}this.$target.on("loadImage",e.proxy(this,"loadImage"))},loadImage:function(){this.$target.attr("src",this.options.src).fadeIn("slow").removeAttr("data-src")}});XF.SAMMonitor=XF.Element.newHandler({options:{id:0,cl:1},clickCount:0,init:function(){this.$target.on("click",e.proxy(this,"monitorClick"))},monitorClick:function(){this.clickCount++;if(this.clickCount==this.options.cl){this.remove()}var k=this;XF.ajax("POST",XF.canonicalizeUrl("index.php?sam-item/"+this.options.id+"/monitor-click"),{page_url:(g.location!=g.parent.location)?i.referrer:i.location.href},function(l){if(l.blocked){k.remove()}},{skipDefault:true,global:false})},remove:function(){var k=this.$target;var l=k.parent();k.remove();if(!l.find(XF.samItem).length){l.remove()}}});XF.SAMGa=XF.Element.newHandler({options:{ga:{}},init:function(){var k=this;var l=this.$target;if(g.gtag===undefined){return}if(XF.samViewCountMethod=="impression"){b(this.options.ga,"Impression")}else{e(g).scroll(function(){if(!l.data("viewed")&&f(l.parent())){b(k.options.ga,"View");k.markAsViewed()}})}l.on("click",function(){if(l.data("clicked")){return}b(k.options.ga,"Click");k.markAsClicked()})},markAsViewed:function(){this.$target.attr("data-viewed",true)},markAsClicked:function(){this.$target.attr("data-clicked",true)}});XF.SAMClose=XF.Click.newHandler({eventNameSpace:"SAMClose",options:{},init:function(){},click:function(){var m=this.$target.parents("div[data-position]");var k=m.data("position");m.fadeOut();if(k=="over_bb_code_video_attachment"||k=="media_view_video_container"){var l=m.parents(".bbMediaWrapper-inner");l.find(".samVideoOverlay").fadeOut();l.find("video")[0].play()}else{if(k=="media_view_video_embed_container"){e(".samVideoOverlay").fadeOut()}}}});XF.Element.register("sam-unit","XF.SAMUnit");XF.Element.register("sam-item","XF.SAMItem");XF.Element.register("sam-lazy","XF.SAMLazy");XF.Element.register("sam-monitor","XF.SAMMonitor");XF.Element.register("sam-ga","XF.SAMGa");XF.Click.register("sam-close","XF.SAMClose")}(jQuery,window,document);
Flash Sale Popup