// JavaScript Document
/*
Random image slideshow- By Tyler Clarke (tyler@ihatecoffee.com)
For this script and more, visit http://www.javascriptkit.com
*/

var delay=4000 //set delay in miliseconds
var curindex=0

var randomimages=new Array()

	randomimages[0]="./gallery/thumbnails/0009.jpg"
	randomimages[1]="./gallery/thumbnails/0013.jpg"
	randomimages[2]="./gallery/thumbnails/0014.jpg"
	randomimages[3]="./gallery/thumbnails/0015.jpg"
	randomimages[4]="./gallery/thumbnails/0017.jpg"
	randomimages[5]="./gallery/thumbnails/0018.jpg"
	randomimages[6]="./gallery/thumbnails/0019.jpg"
	randomimages[7]="./gallery/thumbnails/0020.jpg"	
	randomimages[8]="./gallery/thumbnails/0021.jpg"	
	randomimages[9]="./gallery/thumbnails/0022.jpg"	
	
var preload=new Array()

for (n=0;n<randomimages.length;n++)
{
	preload[n]=new Image()
	preload[n].src=randomimages[n]
}

document.write('<a href="gallery_latest.html"><img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'"></a>')

function rotateimage()
{

if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
curindex=curindex==0? 1 : curindex-1
}
else
curindex=tempindex

	document.images.defaultimage.src=randomimages[curindex]
}

setInterval("rotateimage()",delay)
