<!--
/*
    Fading Slideshow Script
    Jared Collums 
*/

//list of images and links
var images = new Array('main%20images/New_Folder/louiza_rot.jpg', 'main%20images/New_Folder/Hayley_rot.jpg', 'main%20images/New_Folder/silja_rot.jpg', 'main%20images/New_Folder/Julia_rot.jpg');
var x = 0;      //x tells the current picture

var ie = document.all;                      //is it an IE browser?
var slideshow = document.images.slideshow;  //shortcut to the slideshow image

//delays, tell how long to wait before changing pictures
var delay = 4;
var fade = (ie) ? slideshow.filters[0].duration: 0.6;

var loopshow = true;	//if true, slideshow starts over when end is reached

function nextslide() {
    /*
    make sure previous image is finished loading
    if not, the slideshow will wait an additional interval
    before checking again
    */

       
    if (slideshow.complete) {
        if (ie) slideshow.filters[0].apply();
        slideshow.src = images[x];
        if (ie) slideshow.filters[0].play();

        //if there are still pictures to show
        if (x < (images.length-1)) {
	       startshow();
        }
        //if not, stop the slideshow
        else {
            if (loopshow) {
                x = -1;
                startshow();
	    }
	    else {
	        stopshow();
	    }
        }
    }

    ++x;
}

//set timer for slideshow
function startshow() {  
    if (x >= images.length) {
	x = 0;
    }
    timer = setTimeout("nextslide()", (delay + fade) * 1000);
    window.status = 'Playing...';
}

//stop timer for slideshow
function stopshow() {
    clearTimeout(timer);
    window.status = 'Stopped.';
}

//open the link of the current image
function openlink() {
    if (links[x-1]) {
        window.open(links[x-1]);
    }
}

nextslide();
startshow();
//-->
