/* --------------------------------------------------------------------
 *	easyslideshow
 *	This script is part of Onlinetools 
 *  http://www.onlinetools.org/easyslideshow/
 *	free of use with these lines included!  
 *
 *  Version 1.0 initial                                      
 * --------------------------------------------------------------------*/

/* --------------------------------------------------------------------
 *	Setting up the data.
 * --------------------------------------------------------------------*/
rotator=true; 	// needed for initialising the rotator
n=0;			// initialising the first image 
// The images, add and delete yours here...
theImages="flowers/001.jpg, flowers/002.jpg, flowers/003.jpg, flowers/004.jpg, flowers/005.jpg, flowers/006.jpg, flowers/007.jpg, flowers/008.jpg, flowers/009.jpg, flowers/010.jpg, flowers/011.jpg, flowers/012.jpg, flowers/013.jpg, flowers/014.jpg, flowers/015.jpg, flowers/016.jpg, flowers/017.jpg, flowers/018.jpg, flowers/019.jpg, flowers/020.jpg, flowers/021.jpg, flowers/022.jpg, flowers/023.jpg, flowers/024.jpg, flowers/025.jpg, flowers/026.jpg, flowers/027.jpg, flowers/028.jpg, flowers/029.jpg, flowers/030.jpg, flowers/031.jpg, flowers/032.jpg, flowers/033.jpg, flowers/034.jpg, flowers/035.jpg, flowers/036.jpg, flowers/037.jpg, flowers/038.jpg, flowers/039.jpg, flowers/040.jpg, flowers/041.jpg, flowers/042.jpg, flowers/043.jpg, flowers/044.jpg, flowers/045.jpg, flowers/046.jpg, flowers/047.jpg, flowers/048.jpg, flowers/049.jpg, flowers/050.jpg, flowers/051.jpg, flowers/052.jpg, flowers/053.jpg, flowers/054.jpg, flowers/055.jpg, flowers/056.jpg, flowers/057.jpg, flowers/058.jpg, flowers/059.jpg, flowers/060.jpg, flowers/061.jpg, flowers/062.jpg, flowers/063.jpg, flowers/064.jpg, flowers/065.jpg, flowers/066.jpg, flowers/067.jpg, flowers/068.jpg".split(", ");
allImages=theImages.length;
// Creating the needed image objects => preloading
imgObjects=new Array();
for (i in theImages)
{
	imgObjects[i]=new Image();
	imgObjects[i].src=theImages[i];
}
/* --------------------------------------------------------------------
 *	function autoplay() 
 *  Allows to automatically change the images.
 *  Options:
 *    run - can be 1 or 0, 1 starts the play, 0 ends it 
 *    srcimage - defines the image that will be replaced by the others
 *    direction - 1 forward -1 backward
 *    speed - speed in milliseconds
 *  requires the function rotate()
 * --------------------------------------------------------------------*/
function autoplay(run,srcimage,direction,speed)
{
	// delete old settings
	clearInterval(rotator)
	if (run != 0)
	{
		rotator=setInterval("rotate('"+srcimage+"',"+direction+")",speed);
	}else{
		clearInterval(rotator);
	}
}

/* --------------------------------------------------------------------
 *	function rotate() 
 *  Allows to change the source image to the next or last in the list.
 *  Options:
 *    srcimage - defines the image that will be replaced by the others
 *    direction - 1 forward -1 backward
 * --------------------------------------------------------------------*/
function rotate(srcimage,direction)
{
	n=n+direction;
	if (n==allImages) n=0;
	if (n==-1) n=allImages-1;
	document.images[srcimage].src=imgObjects[n].src;
}
