/* ****************************************************************************
* This file has functions for rotating banner ads.                           *
**************************************************************************** */

// global variable for total number of ads
// change this to equal the number of ads you're using
var total = 3;

// global variable for current ad
var sponsor = 1;

// global variable for number of seconds before changing ad (1000 = 1 second) 
var seconds = 15000


//function to generate a random number between 1 and num
function getRandom(num) {
   return Math.floor(Math.random() * num) + 1;
}

// function to link to appropriate sponsor
// add an "else if" line with the URLs corresponding to each banner
function goSponsor() {
   if (sponsor == 1)      top.location.href = "http://www.geocities.com/soqca/";
   else if (sponsor == 2) top.location.href = "http://methos69361.tripod.com";
   else if (sponsor == 3) top.location.href = "http://www.geocities.com/anyaday/gotmethos.html";
}

// function to rotate image, name = "banner"
function rotate() {
   //rotate in order:
   //if (++sponsor > num) sponsor = 1;

   //rotate randomly:
   sponsor = getRandom(total);

   document.banner.src = "/banners/banner" + sponsor + ".gif";

   // comment out if you just want the banner to load when the page loads with no rotation
   window.setTimeout('rotate();', seconds);
}
