Rotating Banner Ads

Hi,

I am not very good with java, but I have been trying to setup 2-4 rotating banner ads. I have been able to get one to work, but as soon as I try to add the code for the second, I only see the second ad and not the first. Can someone give me a hand?

Here is my site: http://bigdogcattle.com

Here is my code:

<script type="text/javascript"> //------------- First Ad ----------------------
var howOften = 5;
var current = 0; 
var ns6 = document.getElementById&&!document.all;
var items = new Array();
    items[0]="<a href='http://EklundCattle.com'><img alt='Club Calves for Sale' src='/images/Clients/ad/EklundCattle.png'>"; 
    items[1]="<a href='http://MillerShowCalves.com'><img alt='Show Steers for Sale' src='/images/Clients/ad/Wyoming-Show-Calves.jpg'>";
function rotater() {
    document.getElementById("placeholder").innerHTML = items[current];
    current = (current==items.length-1) ? 0 : current + 1;
    setTimeout("rotater()",howOften*1000);
}
function rotater() {
    if(document.layers) {
        document.placeholderlayer.document.write(items[current]);
        document.placeholderlayer.document.close();
    }
    if(ns6)document.getElementById("placeholderdiv").innerHTML=items[current]
        if(document.all)
            placeholderdiv.innerHTML=items[current];

    current = (current==items.length-1) ? 0 : current + 1;
    setTimeout("rotater()",howOften*1000);
}
window.onload=rotater; 
//------------- End First Ad ----------------------
</script>


<script type="text/javascript"> //------------- Second Ad ----------------------
var howOften = 5;
var current = 0; 
var ns6 = document.getElementById&&!document.all;
var items = new Array();
    items[0]="<a href='http://bdcwebdesign.com/'><img alt='Cattle Web Design' src='/images/Clients/ad/BDCWebDesign.png'>"; 
    items[1]="<a href='http://bigdogcattle.com/?a=Show-Cattle_Advertising_Banner'><img alt='Club Calf Advertising' src='/images/Clients/ad/CattleAdvertising.png'>";
function rotater() {
    document.getElementById("placeholder").innerHTML = items[current];
    current = (current==items.length-1) ? 0 : current + 1;
    setTimeout("rotater()",howOften*1000);
}
function rotater() {
    if(document.layers) {
        document.placeholderlayer.document.write(items[current]);
        document.placeholderlayer.document.close();
    }
    if(ns6)document.getElementById("placeholderdiv").innerHTML=items[current]
        if(document.all)
            placeholderdiv2.innerHTML=items[current];

    current = (current==items.length-1) ? 0 : current + 1;
    setTimeout("rotater()",howOften*1000);
}
window.onload=rotater; 
//------------- End Second Ad ----------------------
</script>



<div id="ad-wrap">
    <div id="ad-main">
<div id="placeholderdiv"></div>
      <p>&nbsp;</p>
<div id="placeholderdiv2"></div>

You can’t use document.write after the window has finished loading (like you do in rotater()).

After the window finishes loading, document.write will write to a new document.

Try using the DOM methods to perform your document.write tasks in the original loaded document.