/* author@ShuvoRim
 * http://www.shuvorim.tk/
 * shuvorim@hotmail.com
 * (c)ShuvoRim Pvt. Ltd. 2002 -03
 * All rights reserved.
 * --------------------------------------------------
 * visit our web site for more free Java applications
 * and applets. Thank you for using our program.
 * --------------------------------------------------
 * Modified By: Simon Beaver
 * Version $Id: banner.js,v 1.1 2008-05-14 12:17:45 simon Exp $
 */

var numFiles = "";
var bannerurls = "";

for(var i = 0 ; i < document.anchors.length; i++) {
	if (document.anchors[i].name.substring(0,11) == "filesNames=") {
		var length = document.anchors[i].name.length;
        numFiles = document.anchors[i].name.substring(11,length -1);
	}
	if (document.anchors[i].name.substring(0,11) == "bannerurls=") {
		var length = document.anchors[i].name.length;
		bannerurls = document.anchors[i].name.substring(11,length -1);
	}
}

var size = numFiles.split(",").length;
var urlArray = new Array(size); //for URL's, increase size as necessary
var banArray = new Array(size); //for banners, increase size as necessary
var counter = 0;

if(document.images) //pre-load all banner images
{
  for(var i = 0; i < size; i++)
  {
    banArray[i] = new Image(468, 60);
    banArray[i].src = numFiles.split(",")[i];
	urlArray[i] = bannerurls.split(",")[i];
  }
}

function changeBanner() //banner changer function
{
  if(counter > size - 1)
   counter = 0;

  document.banner.src = banArray[counter].src; //sets a new banner

  url = urlArray[counter]; //sets a new URL to the banner
  counter++; //increase the counter for the next banner
}

changeBanner();

//calls the changeBanner() function every 3 seconds
//change the timer as necessary (minutes * 60000) or (seconds * 1000)
var timer = window.setInterval("changeBanner()", 10000);

