/*************************************************
Timed Image Rotator

Author:         Tobby Hagler (tobby@tobbyhagler.com)
Date:           2005-06-02
Description:    This Javascript program rotates a 
                list of images either randomly or
                sequentially on a pre-specified 
                frequency.

*************************************************/

/*************************************************
CONFIGURATION:
    This is the stuff you can safely change.
*************************************************/

// Add the images to rotate through to the rotImages array. You can create or remove as many images as you want to.
//      The images should include full paths as neccessary.
var rotImages = new Array(
    "/images/rotator/1.jpg",
    "/images/rotator/2.jpg",
	"/images/rotator/3.jpg",
	"/images/rotator/4.jpg",
	"/images/rotator/5.jpg",
	"/images/rotator/6.jpg",
	"/images/rotator/7.jpg",
	"/images/rotator/8.jpg",
	"/images/rotator/9.jpg",
	"/images/rotator/10.jpg",
	"/images/rotator/11.jpg"
);

// frequency is the number of miliseconds until the next image shows
var frequency = 3000;

// randCycle is whether or not the cycling of images are random or not.
//      Set to false or 0 for sequential cycling of images.
//      Set to true or 1 for random cycling of images.
var randCycle = false;


/*************************************************
FUNCTIONS:
    You shouldn't touch anything after this point.
*************************************************/
function cycleImages(index) {
    document.images["trotate"].src = rotImages[index];
    if (randCycle) {
        index = Math.round(Math.random() * rotImages.length);
    } else if (index + 1 == rotImages.length) {
        index = 0;
    } else {
        index ++;
    }
    setTimeout("cycleImages(" + index + ")", frequency);
}

