	//Adam Mroczek (c) 2003-2005 adam@mroczek.ca
	
	//admin: set these variables
	var MAX_NO_OF_COMMON_BANNERS=10;   //set to the number >= # banner files in common folder
									  //if set to less, will limit the number that are displayed
	var BANNER_EXT="gif";             //set to the currently used banner's filetype 
	var BANNER_DIR="images/info";	  //set to the current banner directory

	//working vars - don't adjust
	var delay = 0;                    //caches the value of banner cycle delay passed in from html
	var currentAd = 0;                //keeps track of the current ad # in the cycle
	var bannerArray = new Array;      //caches the banner images



	//extract document's name and save into a global "docname" to id the banner source
	var re = /^(\S+)(\/)(\S+)\.php$/i;
	re.exec(window.location);
	var docname=RegExp.$3;

	//make sure the first hit on the site gets it's banner too
	if (docname=="")
	{
		docname="index"
	}

	//loads the banners into the bannerArray
	//  the banner names must end with .BANNER_EXT as defined on line 5 of this script,
	//	and must have sequential numeric names begining with '0' (example '0.gif', '1.gif', '2.gif'...)
	//  the banner files as defined above must be put in the appropriate banner directory:
	//		eg. for index page: images/banners/index/
	//			(general pattern: images/banners/PAGE_NAME/)
	//		NOTE:	common banners go in: images/banners/common/ - 
	//				these will be shared by all pages
	function loadBanners(noOfLocalBanners,noOfCommonBanners)
	{
		var i=0;
		var j=0;


		for(;i<noOfLocalBanners;i++)
		{
			var banner = new Image;
			banner.src = BANNER_DIR + "/" + docname + "/" + i + "." + BANNER_EXT;
			bannerArray[i] = banner;
		}

		if(noOfCommonBanners > MAX_NO_OF_COMMON_BANNERS)
		{
			noOfCommonBanners = MAX_NO_OF_COMMON_BANNERS;
		}

		for(;j<noOfCommonBanners;j++)
		{
			var src = BANNER_DIR + "/common/" + j + "." + BANNER_EXT;
			var banner = new Image;
			banner.src = src;
			bannerArray[j + i] = banner;
		}
	}

	//cycles all banners in bannerArray every 'delaySeconds'
	function cycleBanner(delaySeconds)
	{
		//when first run, cache the parameter
		if(delaySeconds > 0)
		{
			delay = delaySeconds;
		}

		if(document.images && (bannerArray.length > 0) && (delay > 0))
		{		
			
			if(currentAd >= (bannerArray.length))
			{
				currentAd = 0;
			}
			document.adBanner.src=bannerArray[currentAd].src;
			currentAd++;

			setTimeout("cycleBanner()", delay*1000);
		}
	}

