﻿
	// This Javascript is the driver for a multi-image slide show on this page.
	// It depends on a set of 3 global variables:
	// - imageArray, holds the images that make up the slide show.
	// - imageDir, specifes the path prefix (if any) to be applied to the image file names
	// - imageNum, set to the index of the largest image filename.
	// These three variables are defined in the file-specific code that is placed within
	// the file containing the slideshow.
	
	var interval = 4000;  // in milliseconds
	var random_display = 0;  // set this to 1 for a random display, or 0 for sequential

	var totalImages = imageArray.length;
	
	function getNextImageNum() {

		if (random_display) {
			imageNum = randNum(0, totalImages-1);
		}
		else {
			imageNum = (imageNum+1) % totalImages;
		}

		return(imageNum);
	}
	
	function switchImage(imageLoc) {
		var imageNum = getNextImageNum();

		document[imageLoc].src = imageArray[imageNum]; // load the image

		
		var recur_call = "switchImage('" + imageLoc + "')";
		timerID = setTimeout(recur_call, interval);
	}

