<!--
// slideshow.js


//    imageName - the name of the img tag to "host" the slide show.  This name is also the base
//          for the names of the images.
//          Ex.  var imageName = "photo";
//          The <img> tag will need a name="photo" attribute, and all of the images must
//          be named photoN.jpg, where N is a sequential number starting at 0.

var imageName = "photo";


//    zoom - whether to have a larger version of the images appear in a pop-up window by clicking
//          on the window.  Set to 1 to enable, 0 to disable.  If zoom is set, the large images
//          will need to be named "photoNz.jpg" where "photo" is the imageName variable above, 
//          N is the number of the corresponding smaller image, and the letter z.
//          Ex.  var zoom = 1;

var zoom = 1;

//    zoomWidth - the width of the zoomed image.
//    zoomHeight - the height of the zoomed image.
//          Naturally, these two variables only make sense if zoom is set above.

var zoomWidth = 250;
var zoomHeight = 500;

//    interval - the amount of time, in milliseconds, between images
//          Ex.  var interval = 4000;  
//          Four seconds between images.

var interval =1000;

//    imageCount - the number of images in the slide show.
//          Ex.  var imageCount = 10;
//          Ten images in the slide show.

var imageCount = 9;

//    imageLoc - the directory that hold the images.  This is relative to the page invoking this script.
//          Ex.  var imageLoc = "images/";
//          This will look under the current directory for the images/ subdirectory.

var imageLoc = "i/";

//    step - a system variable that holds the step value.  1 goes forward through the images, -1 goes backward.

var step = 1;


// init
    
    var intervalID = 0;

    // build list of images for slide show
    var imageList = new Array(); 
    var zoomImageList = new Array(); 
    for (var i = 0; i < imageCount; i++) {  
        imageList[i] = imageLoc + imageName + i + ".png"; // URL of each image
        if (zoom) {
            zoomImageList[i] = imageLoc + imageName + i + "z.png"; // URL of each zoomed image
        }
    }
    i = 0; // reset index variable
   
    startShow();
	
// create the slide show window and schedule showing of images by nextSlide
function startShow() { 
    // reset the timer and bounds check the interval value
    clearInterval(intervalID);
    if (interval < 500) {
        interval = 500;
    } else if (interval > 15000) {
	interval = 150000;
    }

    // schedule the next slide
    intervalID = window.setInterval('nextSlide()', interval);

    // display the first slide
    nextSlide();
}

// display the next slide
function nextSlide() {
    // mod the index to create the loop
    i %= imageCount;  
    if (step == -1 && i <= 0) {
        i = 0; // safety
        step = 1;
    } else if (step == 1 && i >= (imageCount -1)) {
        i = imageCount - 1; // safety
        step = -1;
    }

    // set the link for the zoomed image
    //if (zoom) {
        //document.links[0].href = zoomImageList[i];
    //}

    // replace the current image with the next one and increment the index  
    document.images[imageName].src = imageList [i];  
    i += step;

}

// pop up the zoomed image
function zoomWin() {
    if (zoom) {
	var params = 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='
              + (zoomWidth + 16) + ",height=" + (zoomHeight + 16) + ',left = 50,top = 50';
	zwin = window.open(zoomImageList[i-1], 'Zoom', params);
	zwin.window.focus();
    }
}

// slow down the slide show
function slowDown(increment) {
    if (interval + increment > 15000) {
	interval = 15000;
    } else {
	interval += increment;
    }

    // reset slide show
    startShow();
}

// speed up the slide show
function speedUp(increment) {
    if (interval - increment < 500) {
	interval = 500;
    } else {
	interval -= increment;
    }

    // reset slide show
    startShow();
}
-->
