//-------------------------------------------------------------------------------------------------
// Slideshow Module
//
// Mike Schoonover
// Feb 2004
// 
// Changes an image displayed, cycling through a series of specified images.
//
// Search for //!!!--- Add filenames of new entries here ---!!! to find the code
// section to be modified for adding/changing images.
//
// See the bottom of the page for example of HTML code for using this
// script.
//

//-------------------------------------------------------------------------------------------------
// changeSlide
//
// Changes the image to the next image in the list.  Sets up a timer to call
// itself again each time. 
//

function changeSlide(seed){

//increment seed to point to the next picture in the array, start over at 0 when
//last picture reached

if (seed < slideImages.length-1) seed++;
    else seed = 0;

//display the image pointed to by seed
document.images["slides"].src = slideImages[seed].src;

//create a command string, converting the seed value to a string in the command
var cmd="changeSlide(" + seed + ")";

//setup a timer to execut the command string which will call this function again
timerTwo = window.setTimeout(cmd, 3000);

}//end of changeSlide
//-------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------
// loadImages
//
// Loads the images specified in the parameter list into an array.
//

function loadImages() 
{

for (var i=0; arguments[i]; i++) {

    slideImages[i] = new Image();
    slideImages[i].src = arguments[i];

    }

}//end of loadImages
//-------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------
// --- Free Code not in a Function ---
//

browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

if (browserVer >= 3) version = "n3";
    else version = "n2";

if (version == "n3") {

    slideImages = [];
    path = "images/slideshow/";
    
    //load slide images into array slideImages

    //!!!--- Add filenames of new entries here ---!!!

    loadImages(
	path + "FolsomSupply-thumb.jpg",
	path + "bjackketchum-thumbnail.jpg",
	path + "FolsomHotel-thumbnail.jpg",
                path + "FolsomPostOffice-thumbnail.jpg",
	path + "BuffaloHeadMountain-thumbnail.jpg",
	path + "FolsomMuseum-thumbnail.jpg"
	);

    }

//end of Free Code
//-------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------
// Example code for use in HTML Page 
//

// An image should be created with the name "slide":
//    (NOTE all images in the slide show should be the size specified in this
//      tag or the browser will stretch or shrink them to fit, with questionable
//      results.)

//  <P ALIGN="RIGHT"><IMG SRC="images/slideshow/somepicture.gif" 
//      WIDTH="127" HEIGHT="114" ALIGN="MIDDLE" BORDER="0" name="slides">

// The "BODY" tag should be modified to start the slideshow after the page
// has been fully loaded:
//
// <BODY onload="changeSlide(0)">
//

//end of Example code for use in HTML Page 
//-------------------------------------------------------------------------------------------------

