/*
Random image slideshow- By Tyler Clarke (tyler@ihatecoffee.com)
For this script and more, visit http://www.javascriptkit.com
*/

var delay=7000 //set delay in miliseconds
var curindex=-1;

var randomimages=new Array()
	
	randomimages[0]="/images/banner/banner.jpg"
	//randomimages[1]="/images/banner/crest.jpg"
	//randomimages[2]="/images/banner/contact.jpg"

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.banner_img.src=randomimages[curindex]
}

//setInterval("rotateimage()",delay)
rotateimage();