var slotNo=1; var noSwitch=false; function pause(){ noSwitch=true; } function resume(){ noSwitch=false; } function getAdContainer(adSlot){ var slotId = 'slot'+(Number(adSlot)+1); var cont = document.getElementById(slotId); return cont; } function hidePreviousAd(){ var adContainer=null; if (slotNo>0){ adContainer=getAdContainer(slotNo-1); } else { adContainer=getAdContainer(ads.length-1); } if(adContainer!=null&&adContainer!='undefined'){ adContainer.style.display='none'; } } function timedRotation(){ if (noSwitch){ return; } rotateAd(); } function rotateAd(){ var adContainer = getAdContainer(slotNo); if (adContainer!=null&&adContainer!='undefined'){ if(adContainer.innerHTML==null||adContainer.innerHTML==''){ var url='/ad/' + ads[slotNo] + '/htmlslot.htm'; new net.ContentLoader(url, displayAd); } else { hidePreviousAd(); adContainer.style.display="inline"; incrementSlot(); } } } function incrementSlot() { if (slotNo 0 ) { addStyle(ads[slotNo]); } hidePreviousAd(); adContainer.style.display="inline"; incrementSlot(); } } function addStyle(adId){ var h=document.getElementsByTagName('head'); if(h!=null&&h!='undefined'&&h.length==1) { var adStyle=document.createElement('link'); adStyle.setAttribute('type', 'text/css'); adStyle.setAttribute('href', '/ad/' + adId + '/style.css'); adStyle.setAttribute('rel', 'stylesheet'); h[0].appendChild(adStyle); } }