	var bannerNum = 0;			//the Baner number currently shown
	var tempMax = 0;			//the total number of banners
	var pic = "";				//text string for banner name
	var paused = new Boolean(false);	//boolean for pause button on or not (true means go)
	var timer;				//timer for window time out
	var timeOutTime = 4000;			//default time to timeout


	//Main method that rotates the banners
	function rotateBanner(maxBanners) {
		tempMax = maxBanners;
		clearTimeout(timer);
		if(paused){
			if (++bannerNum >tempMax)
				bannerNum = 1;
			for(i=1;i<=tempMax;i++){
				pic = "banner" + i;
				document.getElementById(pic).style.display="none";
			}
			pic = "banner" + bannerNum;
			document.getElementById(pic).style.display="";
		}
		startRotate();
	}
	
	//Starts the rotation and resets the timeOutTime
	function startRotate(){
		timer=window.setTimeout('rotateBanner(tempMax);', timeOutTime);
	}

	//Pause button, sets and resets paused boolean 
	function pauseRotate(){
		paused = !paused;
	}

	//forward button, advances one banner
	function goForward(){
		paused = true;
		clearTimeout(timer);
		if (++bannerNum >tempMax)
			bannerNum = 1;
		for(i=1;i<=tempMax;i++){
			pic = "banner" + i;
			document.getElementById(pic).style.display="none";
		}
		pic = "banner" + bannerNum;
		document.getElementById(pic).style.display="";
		startRotate();
	}

	//back button, advances "maxBanners"
	function goBack(){
		paused = true;
		clearTimeout(timer);
		for(i=1;i<=tempMax-1;i++){
			if (++bannerNum >tempMax)
				bannerNum = 1;
		}
		for(i=1;i<=tempMax;i++){
			pic = "banner" + i;
			document.getElementById(pic).style.display="none";
		}
		pic = "banner" + bannerNum;
		document.getElementById(pic).style.display="";
		startRotate();
	}
	

