
/*
Random image slideshow- By Tyler Clarke (tyler@ihatecoffee.com)
For this script and more, visit http://www.javascriptkit.com
*/

var delay=1000000 //set delay in miliseconds
var curindex=0

var randomimages=new Array()

	randomimages[0]="http://chicagofun.com/home/images/fall/applebarrel.gif"
	randomimages[1]="http://chicagofun.com/home/images/fall/apples.gif"
	randomimages[2]="http://chicagofun.com/home/images/fall/fall1.gif"
	randomimages[3]="http://chicagofun.com/home/images/fall/fallfestival.gif"
	randomimages[4]="http://chicagofun.com/home/images/fall/fallingleaves.gif"
	randomimages[5]="http://chicagofun.com/home/images/fall/garden.gif"
	randomimages[6]="http://chicagofun.com/home/images/fall/harvest.gif"
	randomimages[7]="http://chicagofun.com/home/images/fall/harvest2.gif"
	randomimages[8]="http://chicagofun.com/home/images/fall/manraking.gif"
	randomimages[9]="http://chicagofun.com/home/images/fall/mapleleaf.gif"
	
	
	

var preload=new Array()

for (n=0;n<randomimages.length;n++)
{
	preload[n]=new Image()
	preload[n].src=randomimages[n]
}

document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')

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)