var _carbonads={init:function(where,force_serve){_carbon_where=null;if(where)_carbon_where=where;var placement=this.getUrlVar('placement'),serve=this.getServe(force_serve?force_serve:this.getUrlVar('serve'),placement),baseurl=this.getUrlVar('cd')?this.getUrlVar('cd'):'srv.carbonads.net';var forcebanner=this.getUrlVar('bsaproforce',window.location.href),ignore=this.getUrlVar('bsaprostats',window.location.href),forwardedip=this.getUrlVar('bsaforwardedip',window.location.href);var pro=document.createElement('script');pro.id='_carbonads_projs';pro.type='text/javascript';pro.src='//'+baseurl+'/ads/'+serve+'.json?segment=placement:'+placement+'&callback=_carbonads_go';if(forcebanner)pro.src+='&forcebanner='+forcebanner;if(ignore)pro.src+='&ignore='+ignore;if(forwardedip)pro.src+='&forwardedip='+forwardedip;var ck='';try{ck=decodeURIComponent(document.cookie)}catch(e){};var day=ck.indexOf('_bsap_daycap='),life=ck.indexOf('_bsap_lifecap=');day=day>=0?ck.substring(day+12+1).split(';')[0].split(','):[];life=life>=0?ck.substring(life+13+1).split(';')[0].split(','):[];if(day.length||life.length){var freqcap=[];for(var i=0;i0)return'F6AIK5T';if(this.isset(reroute[placement]))return reroute[placement];return serve},getUrlVar:function(name,target){target=typeof target!=='undefined'?target:document.getElementById('_carbonads_js').src,name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(target);if(results==null)return'';else return results[1]},isset:function(v){return typeof v!=='undefined'&&v!=null},refresh:function(){this.remove(document.getElementById('_carbonads_projs'));this.remove(document.getElementById('carbonads'));this.init()},reload:function(where,force_serve){this.remove(document.getElementById('_carbonads_projs'));this.init(where,force_serve)},remove:function(el){if(typeof el!=='undefined'&&el!=null)el.parentNode.removeChild(el)}};function _carbonads_go(b){var ad=b['ads'][0],link,fulllink,image,description,time=Math.round(Date.now()/10000)|0;var placement=_carbonads.getUrlVar('placement');var serve=_carbonads.getUrlVar('serve');if(ad.html!=null){var ad_html=JSON.parse(ad.html);ad.image=ad_html.image,ad.statlink=ad_html.statlink,ad.description=ad_html.description,ad.pixel=ad_html.pixel;ad.fetch=ad_html.fetch;ad.click_redir=ad_html.click_redir}if(ad.fetch!=null){var fetch=document.createElement('script');fetch.type='text/javascript';fetch.id='_carbonads_fetchjs';fetch.src=ad.fetch;if(ad.fetch.match('fallbacks.carbonads.com'))fetch.src+='/'+placement+'/8/';if(ad.click_redir!=null)fetch.src+='?click_redir='+encodeURIComponent(ad.click_redir.replace(/srv.buysellads.com/g,'srv.carbonads.net'));document.getElementsByTagName('head')[0].appendChild(fetch);_carbonads.remove(document.getElementById('_carbonads_fetchjs'));return}image=ad.image;link=ad.statlink.split('?encredirect=');description=ad.description;if(typeof link[1]!='undefined')fulllink=link[0]+'?segment=placement:'+placement+';&encredirect='+encodeURIComponent(link[1]);else if(link[0].search('srv.buysellads.com')>0)fulllink=link[0]+'?segment=placement:'+placement+';';else fulllink=link[0];fulllink=fulllink.replace(/srv.buysellads.com/g,'srv.carbonads.net');var el=document.createElement('span');el.innerHTML=''+ad.description+'';if(!_carbonads.isset(ad.removecarbon))el.innerHTML+='ads via Carbon';if(typeof ad.pixel!='undefined'){var pixels=ad.pixel.split('||');for(var j=0;j0?'carbonads_'+n.length:'carbonads';fdiv.appendChild(el);var carbonjs=document.getElementById('_carbonads_js');if(carbonjs!=null)if(_carbonads.isset(_carbon_where))_carbon_where.appendChild(fdiv);else carbonjs.parentNode.insertBefore(fdiv,carbonjs.nextSibling);var mw=document.querySelectorAll('.carbon-img > img');for(var i=0;i=0?c.substring(i+w.length+1).split(';')[0]+'%2C':'',d=new Date();d.setTime(days*3600000+d);data=existing+data;data=data.substring(0,2048);document.cookie=w+'='+data+'; expires='+d.toGMTString()+'; path=\/'};if(freqcap){append('_bsap_daycap',banner,1);append('_bsap_lifecap',banner,365)}};