function showBanner(response,area){ oDiv = document.getElementById('banner'); if(oDiv!=null){ while(oDiv.firstChild){ oDiv.removeChild(oDiv.firstChild); } aItem = response.split("@^@"); if(aItem.length>1){ oAnchor = document.createElement("a"); oAnchor.setAttribute("href",aItem[0]); oImg = document.createElement("img"); oImg.setAttribute("alt",aItem[2]); oImg.setAttribute("src",'http://www.roddenberry.com/images/referral_banners/'+aItem[1]); oAnchor.appendChild(oImg); oDiv.appendChild(oAnchor); setTimeout(function(){rotateBanners(area)},5000); }else{ oDiv.appendChild(document.createTextNode("")); setTimeout(function(){rotateBanners(area)},100); } } } function rotateBanners(area){ xmlHttp2 = XMLHttpObject(); xmlHttp2.open("GET","http://www.roddenberry.com/?action=site.getBanner&area="+area+"&dt="+Math.random(),true); xmlHttp2.send(null); xmlHttp2.onreadystatechange=function(){ if(xmlHttp2.readyState==4){ showBanner(xmlHttp2.responseText,area); } } }