/******************************************************************************\
* Modifying the Slideshow:
* 
* 1. All slideshow images must be no greater than 640x480 pixels (w x h).
* 
* 2. All slideshow images must be stored in the "slideshow" folder, which is 
*    located in the ChE web root.
* 
* 3. Do not modify the constant "PATHBASE", as this points to where the various  
*    slideshow images are physically located.
* 
* 4. Add or remove image filenames from the "FILES" array below.
* 
* 5. Add or remove image alternate text tags from the "ALTS" array below.  
*    Each alternate text tag corresponds to an image filename in the "FILES" 
*    array, so the two arrays must be the same length, and the first alt tag 
*    belongs to the first image file, and so on.
* 
\******************************************************************************/

PATHBASE = 'http://www.che.ksu.edu/slideshow/';
FILES = new Array('research2.jpg', 'lab.jpg', 'research.jpg', 'teaching.jpg', 'open_house.jpg', 'splash.jpg');
ALTS = new Array('Research', 'Undergraduate Lab', 'Research', 'Teaching', 'Open House', 'Chemical Engineering at Kansas State University');

var imageElement = null;
var images = null;
var index = 0;

function startSlideshow() {
    imageElement = document.getElementById('slideshowimage');
    images = new Array();
    var i = 0;
    for (i = 0; i < FILES.length; i++) {
        images[i] = new Image();
        images[i].src = PATHBASE+FILES[i];
        images[i].alt = ALTS[i];
    }
    index = 0;
    window.setInterval('showNextImage();', 3000);
}

function showNextImage() {
    if (index < images.length) {
        imageElement.src = images[index].src;
        imageElement.alt = images[index].alt;
        index++;
    } else {
        window.clearInterval();
    }
}
