/* Ayads Skin Engine by Aymeric Le Corre 221718 */ (function(){var w=top,d=w.document,ie=d.documentMode||false,url='http://ayads.co/',ads_url='http://ads.ayads.co/',ayads={url:url,ads_url:ads_url,setWindow:function(w){w=w;d=w.document;},setItem:function(k,v,d){var ov=localStorage.getItem('ayads-'+k);var x=parseInt(ov?ov.split('|')[1]:Date.now());if(d) x+=parseInt(d)*1000;localStorage.setItem('ayads-'+k,v+'|'+x);for(k in localStorage) if(k.substr(0,5)==='ayads'&&localStorage.getItem(k).split('|')[1]Date.now()) return v[0];else {ayads.removeItem(k);return null;}},removeItem:function(k){localStorage.removeItem('ayads-'+k);},addcss:function(css){var style,id='ayads-style',c;if(c=!(style=d.getElementById(id))) {style=d.createElement('style');style.type='text/css';style.id=id;} if(style.styleSheet) style.styleSheet.cssText+=css;else style.appendChild(d.createTextNode(css));if(c) d.getElementsByTagName('head')[0].appendChild(style);},get:function(u,c){if(c===true) {var s=d.createElement('script');s.type='text/javascript';s.src=url+u;s.async=false;d.body.insertBefore(s,d.body.firstChild);} else {var x=new XMLHttpRequest(),r;if(c)x.onload=function(){c(x.responseText);};x.open('GET',url+u,false);x.send(null);return x.responseText;}},clickurlize:function(u){return url+'click.php?c='+ayads.zone.zid+'-'+ayads.ad.aid+(u?'&url='+encodeURIComponent(u):'');},stacktrace:function(){var err=new Error();return err.stack;}},ayads_display_ad=function(){var data=ayads.ad.data,image=data.image||ads_url+'delivery/image-'+ayads.ad.aid+'.jpg',color=data.color?data.color:'#FFF',top=data.top?data.top:0,click_url=ayads.clickurlize(data.url),html='',scale=1,height=1000,click_callback=function(e){if(d.body.scrollTop>(height+parseInt(w.getComputedStyle(d.body.parentNode).marginTop))&&!data.fixed&&!data.video&&!data.improve_id&&ayads.ad.format==1) return false;if(window.ayads_clickcount) new Image().src=ayads_clickcount;if(ayads.ad.data.capping_clicks) {var capping_click=ayads.getItem('capping-clicks-a'+ayads.ad.aid);if(capping_click) ayads.setItem('capping-clicks-a'+ayads.ad.aid,++capping_click);else ayads.setItem('capping-clicks-a'+ayads.ad.aid,1,ayads.ad.data.capping_duration);} ayads.ad.click_callback&&ayads.ad.click_callback();w.open(click_url);};if(ayads.ad.data.image) ayads.ad.data.image=image;if(window.ayads.ad&&d.location.hash.indexOf('ayads-')===-1) {setTimeout(function(){new Image().src=url+'impression.php?zid='+ayads.zone.zid+'&aid='+ayads.ad.aid+'&sid='+(ayads.zone.sid||0)+'&t='+Date.now();if(window.ayads_impressioncount) new Image().src=ayads_impressioncount;},5000);} if(ayads.ad.data.html) html+=ayads.ad.data.html;if(ayads.zone.format===ayads.ad.format&&ayads.zone.data.html) html+=ayads.zone.data.html;if(html) {html=html.replace('[timestamp]',Date.now().toString());document.write('
'+html+'
');d.body.insertBefore(document.getElementById('ayads-html'),d.body.firstChild);} if(ayads.ad.format) {if(ayads.zone.data.scale) {scale=ayads.zone.data.scale*(ayads.zone.data.scale>5?.01:1);top=Math.round(top*scale);} if(ayads.ad.data.video) ayads_display_video({scale:scale,image:image});else {var img=new Image();img.src=image;img.onload=function(){ayads.addcss('body{background-image:url("'+image+'") !important;background-size:'+Math.round(this.width*scale)+'px auto !important}');height=this.height;if(!ayads.ad.data.color&&!ie) {var canvas=document.createElement('canvas');canvas.width=1;canvas.height=img.height;var ctx=canvas.getContext('2d');var data='';var img2=new Image();var svg=new Blob([data],{type:'image/svg+xml;charset=utf-8'});var url=URL.createObjectURL(svg);img2.onload=function(){ctx.drawImage(img2,0,0);var data=ctx.getImageData(0,img2.height-1,1,1).data;if(data[3]) ayads.addcss('body{background-color:rgb('+data[0]+','+data[1]+','+data[2]+') !important}');};img2.src=url;}};} ayads.addcss('body{cursor:default;background-position:'+(ayads.ad.data.fixed?'50% '+(w.getComputedStyle(d.body.parentNode).marginTop):'center top')+' !important;background-repeat:no-repeat !important;background-image:none;background-color:'+color+' !important;background-attachment:'+(ayads.ad.data.fixed?'fixed':'scroll')+' !important;margin-left:auto !important;margin-right:auto !important;margin-top:'+top+'px !important;max-width:'+(1000*scale)+'px}html{background-image:none !important;background-color:transparent !important;cursor:pointer}');d.documentElement.onclick=function(e){if(!e||e.target===d.body.parentNode&&e.clientX9) {l=d.createElement('link');l.rel='dns-prefetch';l.href=u;h.appendChild(l);}})();},ayads_display_video=function(p){var videobg=d.createElement('video'),video=d.createElement('video'),layer=d.createElement('div'),controls=d.createElement('div'),container=d.createElement('div'),share=d.createElement('div'),canplay=true,canplay_scroll=true,canplay_hover=true,play=function(p){if(p&&canplay&&(canplay_scroll||canplay_hover)) {controls.className='ayads-video-buttons';video.play();videobg.play();} else {controls.className='ayads-video-buttons paused';video.pause();videobg.pause();}};ayads.addcss('body{position:static !important}'+'#ayads-video{height:100%}'+'#ayads-video-bg{min-width:100%;min-height:100%;position:fixed;top:0;left:0;right:0;z-index:-2147483648;cursor:pointer}'+'#ayads-video-layer{position:'+(ayads.ad.data.fixed?'fixed':'absolute')+';z-index:-2147483647;margin:auto;width:100%;height:1000px;left:0;right:0;-webkit-transform:translate3d(0,0,0);cursor:pointer}'+'#ayads-video-container{position:absolute;margin:auto;left:50%;margin-left:-195px;box-shadow: 0 0 18px #000;opacity:0;cursor:pointer}'+'.ayads-video-buttons{background:no-repeat center;background-size:contain;width:28px;height:28px;position:absolute;z-index:1;bottom:0;margin:10px 12px;opacity:.5;-webkit-transition:opacity .2s;transition:opacity .3s} .ayads-video-buttons:hover{opacity:.9 !important}\n'+'#ayads-video-controls{background-image:url(data:image/svg+xml;base64,PHN2ZyBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAzMiAzMiIgaGVpZ2h0PSIzMnB4IiBpZD0ic3ZnMiIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMzIgMzIiIHdpZHRoPSIzMnB4IiB4PSIwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeT0iMHB4Ij48ZyBpZD0iYmFja2dyb3VuZCI+PHJlY3QgZmlsbD0ibm9uZSIgaGVpZ2h0PSIzMiIgd2lkdGg9IjMyIiAvPjwvZz48ZyBpZD0icGF1c2UiPjxnPjxyZWN0IGhlaWdodD0iMjQiIHdpZHRoPSI4IiB4PSIyMCIgeT0iNCIgZmlsbD0iI0ZGRiIvPjxyZWN0IGhlaWdodD0iMjQiIHdpZHRoPSI4IiB4PSI0IiB5PSI0IiBmaWxsPSIjRkZGIiAvPjwvZz48L2c+PC9zdmc+)}'+'#ayads-video-controls.paused{background-image:url(\'data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE2cHgiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDE2IDE2IiB3aWR0aD0iMTZweCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGUvPjxkZWZzLz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGlkPSJJY29ucyB3aXRoIG51bWJlcnMiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIj48ZyBmaWxsPSIjRkZGIiBpZD0iR3JvdXAiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01MjguMDAwMDAwLCAtMTQ0LjAwMDAwMCkiPjxwYXRoIGQ9Ik01NDMsMTUyIEw1MzEsMTU4IEw1MzEsMTQ2IEw1NDMsMTUyIEw1NDMsMTUyIFogTTU0MywxNTIiIGlkPSJTaGFwZSIvPjwvZz48L2c+PC9zdmc+\');}');var img=new Image();img.onload=function(){ayads.addcss('#ayads-video-layer{background:url('+p.image+') no-repeat top center;background-size:'+(p.scale*img.width)+'px auto}');};img.src=p.image;var srctype=!!ayads.ad.data.video.toString().match(':');video.id='ayads-video';video.src=ads_url+(srctype?'gateway.php?video='+encodeURIComponent(ayads.ad.data.video):'delivery/video-'+(ayads.ad.data.video==1?ayads.ad.aid:ayads.ad.data.video)+'.mp4');video.autoplay=true;video.preload=true;video.loop=true;video.muted=true;container.style.height=Math.round(ayads.ad.data.top*p.scale)+'px';container.style.marginTop='-'+container.style.height;container.addEventListener('mouseover',function(){video.volume=.6;video.muted=false;ayads.metrics=ayads.metrics||{};if(!ayads.metrics.hover) {clearTimeout(ayads.metrics.hover_timeout);ayads.metrics.hover_timeout=setTimeout(function(){ayads.metrics.hover=1;new Image().src=url+'impression.php?zid='+ayads.zone.zid+'&aid='+ayads.ad.aid+'&metric=hover';},2000);}});container.addEventListener('mouseout',function(){video.muted=true;clearTimeout(ayads.metrics.hover_timeout);});var hovertimeout=false,mouseover=function(){video.volume=.08;video.muted=false;clearTimeout(hovertimeout);hovertimeout=setTimeout(function(){canplay_hover=true;play(true);},1000);},mouseout=function(){clearTimeout(hovertimeout);video.muted=true;canplay_hover=false;play(true);};layer.addEventListener('mouseover',mouseover);layer.addEventListener('mouseout',mouseout);videobg.addEventListener('mouseover',mouseover);videobg.addEventListener('mouseout',mouseout);w.videobg=videobg;w.layer=layer;layer.onclick=function(){d.body.parentNode.onclick();};videobg.onclick=function(){d.body.parentNode.onclick();};video.addEventListener('loadedmetadata',function(){container.style.marginLeft=-Math.floor(video.offsetWidth/2)+'px';container.style.opacity=1;});video.onclick=function(){d.body.parentNode.onclick();};video.addEventListener('canplaythrough',function(){var sync=function(){var diff=Math.abs(videobg.currentTime-video.currentTime);if(diff>.1) {videobg.currentTime=video.currentTime;if(!video.paused)videobg.play();} ayads.metrics=ayads.metrics||{};ayads.metrics.quartile=ayads.metrics.quartile||0;var quartile=Math.floor(Math.min(1,video.currentTime/video.duration)*4);if(quartileayads.metrics.quartile) {ayads.metrics.quartile=quartile;new Image().src=url+'impression.php?zid='+ayads.zone.zid+'&aid='+ayads.ad.aid+'&metric=quartile'+quartile+'¤ttime='+video.currentTime+'&duration='+video.duration;}};play(true);if(!ayads.played) {ayads.played=1;setInterval(sync,2000);} sync();});videobg.id='ayads-video-bg';videobg.src=ads_url+(srctype?'gateway.php?video='+encodeURIComponent(ayads.ad.data.video)+'&bg':'delivery/video-bg-'+(ayads.ad.data.video==1?ayads.ad.aid:ayads.ad.data.video)+'.mp4');videobg.preload=true;videobg.loop=true;videobg.muted=true;layer.id='ayads-video-layer';layer.style.marginTop=container.style.marginTop;container.id='ayads-video-container';controls.id='ayads-video-controls';controls.className='ayads-video-buttons';controls.addEventListener('click',function(){canplay=video.paused;play(video.paused);});w.addEventListener('blur',function(e){play(false)});w.addEventListener('focus',function(e){play(true)});var scrolltimeout=false;w.addEventListener('scroll',function(e){if(w.onscroll)w.onscroll(e);if(!arguments.callee.threshold) arguments.callee.threshold=(d.getElementsByTagName('html')[0].offsetTop+video.offsetHeight);var p=w.pageYOffset500) {var u=encodeURIComponent(iframes[i].src),t='';if(u.indexOf('doubleclick')!==-1) t=encodeURIComponent(div.innerHTML.match(/pixel\?d\=(.*?)&/)[1]);a={href:url+'gateway.php?a&iframeparser='+u+'&t='+t};img={src:url+'gateway.php?img&iframeparser='+u+'&t='+t};break;}}} if(window.console&&console.log) {console.log(a);console.log(img);} var pixels=document.getElementById(id+'-pixels');[['http://ad.turn.com/r/cs?pid=15',0],['http://cm.g.doubleclick.net/pixel?google_nid=improvedigital&google_cm&google_sc',0],['http://ib.adnxs.com/getuid?http://ad.turn.com/r/cs?pid=15',0],['http://pixel.mathtag.com/sync/js?sync=auto',1]].forEach(function(u){if(u[1]) {var e=document.createElement('script');e.type='text/javascript';e.async=true;} else {var e=document.createElement('img');e.style.display='none';} e.src=u[0];pixels.appendChild(e);});if(window.ayads_data) {ayads_data.improve_id=ayads.ad.data.improve_id;ayads.ad.data=ayads_data;delete ayads_data;if(ayads.ad.data.shop) shop_display_ad();else ayads_display_ad();} else if(a&&img&&a.href&&img.src&&a.href.length>30&&img.src.indexOf('.gif')===-1) {if(a.href.indexOf('j')===0) {ayads.ad.data.url=a.href.match(/\(.*\)/)[0].replace(/\(|\)|'/gi,'');} else ayads.ad.data.url=a.href;ayads.ad.data.image=img.src;ayads.ad.data.top=220;ayads.ad.data.color=false;if(a.onclick) ayads.ad.click_callback=a.onclick;if(window.ayads_shop) ayads.ad.data.shop=ayads_shop;ayads_display_ad();} else {ayads.zone.noads.push(ayads.ad.aid);ayads.setItem('noads-'+ayads.ad.aid,1,864);ayads_select_ad();}};if(data.improve_id.toString().match('rubicon')) {rp_account='9585';rp_site='19865';rp_zonesize='148042-68';rp_adtype='js';rp_smartfile='[SMART FILE URL]';var script_url='http://ads.rubiconproject.com/ad/9585.js';} else var script_url='http://ad.360yield.com/adj?p='+data.improve_id+'&w=1800&h=1000&tz='+(new Date().getTimezoneOffset())+'&click3rd=';document.write('