',{id:'xrayAdViewport',css:{position:'absolute',width:this.w,height:10,zIndex:10001,background:'rgba(255,255,255, 0.3)'}});this.viewport.appendTo(this.div)}if(!this.viewThresoldTop){this.viewThresoldTop=$('
',{id:'xrayAdThresold',css:{position:'absolute',width:this.w,height:1,zIndex:10002,background:'rgba(255,0,0, 0.5)'}});this.viewThresoldTop.appendTo(this.div);this.viewThresoldBottom=this.viewThresoldTop.clone().appendTo(this.div)}this.bodyHeight=$(document).height();this.bodyWidth=$(window).width();var g=($(window).height()/this.bodyHeight)*xrayAd.h,vT=($(window).scrollTop()/this.bodyHeight)*xrayAd.h;this.viewport.css({height:g,top:vT});this.viewThresoldTop.css({top:(($(window).scrollTop()-xrayAd.thresold)/this.bodyHeight)*xrayAd.h});this.viewThresoldBottom.css({top:(($(window).scrollTop()+xrayAd.thresold)/this.bodyHeight)*xrayAd.h+g-1});if(this.div&&this.div.length){var h=this.div.find('.xrayAdBlock');$.each(h,function(a,b){var c=$(this);var d=$(xrayAd.elements[a]);if(c.length&&d.length){var e={};e.off=d.offset();if(e.off){e.top=(e.off.top/xrayAd.bodyHeight)*xrayAd.h;e.left=(e.off.left/xrayAd.bodyWidth)*xrayAd.w;e.w=(Math.max(d.width(),10)/xrayAd.bodyWidth)*xrayAd.w;e.h=(Math.max(d.height(),10)/xrayAd.bodyHeight)*xrayAd.h;var f='#FF0071';f=(d.data('loading')==='true'?'orange':f);f=(d.data('loaded')==='true'?'#00FF00':f);c.css({top:e.top,left:e.left,width:e.w,height:e.h,borderColor:f})}}})}},load:function(b,c){this.thresold=c||0;this.init();var d=$('
',{'class':'xrayAdBlock','css':{position:'absolute',background:'#ffffff',border:'1px solid #FF0071',top:0,left:0,width:0,height:0,zIndex:10003}});$.each(b,function(){d.clone().attr('xrayblock','xrayAdBlock_'+(xrayAd.adBlockCount++)).appendTo(xrayAd.div);$(this).bind('onCompleteXray',function(){xrayAd.viewportUpdate()});$(this).bind('onLoadXray',function(){xrayAd.viewportUpdate()});xrayAd.elements.push(this)});xrayAd.viewportUpdate();$(window).bind("scroll",function(a){xrayAd.viewportUpdate()})}};(function($){$.lazyLoadAdRunning=false;$.lazyLoadAdTimers=[];$.fn.lazyLoadAd=function(h){var j={threshold:0,failurelimit:1,forceLoad:false,event:"scroll",viewport:window,placeholder:false,onLoad:false,onComplete:false,timeout:1500,debug:false,xray:false};if(h){$.extend(j,h)}function _debug(){if(typeof console!=='undefined'&&j.debug){var a=[];for(var i=0;i
j.failurelimit){return false}}});var c=$.grep(k,function(a){return!(($(a).data('loaded')==='true')?true:false)});k=$(c)});if("scroll"===j.event){$(j.viewport).bind("scroll",function(a){if(k.length===0){return false}$(j.viewport).trigger("checkLazyLoadAd")})}this.each(function(d,f){var g=$(this);if(undefined===g.attr("original")){g.attr("original",g.attr("src"))}g.isLoaded=function(){return((g.data('loaded')==='true')?true:false)};g.bind("debug",function(e,a){a=a||'start';if(j.xray){if(a==='start'){g.trigger('onLoadXray')}else if(a==='error'){g.trigger('onErrorXray')}else if(a==='complete'){g.trigger('onCompleteXray')}}if(j.debug){if(a==='start'){g.css({border:'3px solid orange'})}else if(a==='error'){g.css({border:'3px solid red'})}else if(a==='complete'){g.css({border:'3px solid green'})}}});g.one('onComplete',function(){_debug('---> lazyLoadComplete');$(g).removeAttr("original");$.lazyLoadAdRunning=false;g.data('loaded','true');g.trigger('debug','complete');if(typeof j.onComplete==='function'){try{j.onComplete()}catch(e){}}});g.stack=[];g.makinaBlock=false;g.bind('makina_go',function(){if(g.makinaBlock){return false}if(g.stack.length>0){var a=g.stack.shift();var b=g.find('.wrapAd');if(!b.length){b=$('').clone();b.appendTo(g)}var c=$('').clone().appendTo(b);if(typeof a==='string'){c.replaceWith(a)}else if(typeof a==='object'){if(a.is('script')){if(a.attr('src')){_debug('JS to load !! --> '+a.attr('src'));LazyLoader.load(a.attr('src'),g,function(){g.makinaBlock=false;_debug('JS to load !! ++> '+a.attr('src'));g.trigger('makina_go')})}else{c.replaceWith(a)}}else{c.replaceWith(a)}}g.trigger('makina_go')}else{if($.lazyLoadAdTimers.loadJS){clearTimeout($.lazyLoadAdTimers.loadJS)}$.lazyLoadAdTimers.loadJS=setTimeout(function(){g.trigger('onComplete')},j.timeout)}});g.bind('docWrite_direct',function(e,a){var b=$(a);_debug('Fragment Direct Write : ',b,b.length);$.each(b,function(){g.stack.push($(this))});g.trigger('makina_go')});g.bind('docWrite_delayed',function(e,a){_debug('Fragment Delayed Write : ',a);g.numWrappers--;_debug("Fragment append : ",g.numWrappers,a);g.docHtmlCurrent+=a;if(g.numWrappers===0){a=g.docHtmlCurrent;g.docHtmlCurrent='';setTimeout(function(){g.stack.push(a);g.docHtmlCurrent='';g.trigger('makina_go')},0)}});g.numWrappers=0;g.docHtmlCurrent='';g.bind('docWrite_overload',function(){document._writeOriginal=document.write;document.write=document.writeln=function(){var a=arguments,id=null;var b='';for(var i=0;i
]*>([\s\S]*?)<\/code>/gi;while((script=regexp.exec(g.html()))){var b=script[1];b=b.replace('','').replace('','');b=b.replace(/\>\;/g,'>').replace(/\<\;/g,'<');a.push($.trim(b))}try{a=(a.length?a.join('\n'):'');_debug('Script to eval : ',a);if(a!==''){eval(a)}}catch(e){}});g.bind('loadJS',function(e,a){var b=null,script=null;if(a.src){b=a.callback||null;a=a.src}if(a.indexOf('?')===-1){a+='?_='+(new Date().getTime())}else{a+='&_='+(new Date().getTime())}_debug('loadJS :: ',a);LazyLoader.load(a,g,function(){_debug('loadJS COMPLETE :: '+a);if(b){b()}else{$.lazyLoadAdTimers.loadJS=setTimeout(function(){g.trigger('onComplete')},j.timeout)}})});g.one("load",function(){if(!g.isLoaded()){$.lazyLoadAdRunning=true;g.data('loading','true');g.trigger('debug','start');var a=$(g).attr("original");g.history={};_debug('------------------------------ Lazy Load Ad CALL ----');_debug('Context : ',g);g.trigger('docWrite_overload');g.trigger('evalCode');if(a){g.trigger('loadJS',a)}}});if("scroll"!==j.event){g.bind(j.event,function(a){if(!g.isLoaded()){g.trigger("load")}})}});$(j.viewport).trigger('checkLazyLoadAd');return this};$.belowthefold=function(a,b){var c=0;if(b.viewport===undefined||b.viewport===window){c=$(window).height()+$(window).scrollTop()}else{c=$(b.viewport).offset().top+$(b.viewport).height()}return c<=$(a).offset().top-b.threshold};$.abovethetop=function(a,b){var c=0;if(b.viewport===undefined||b.viewport===window){c=$(window).scrollTop()}else{c=$(b.viewport).offset().top}return c>=$(a).offset().top+b.threshold+$(a).height()}})(jQuery);