var delay = 2500;
var curindex = 0;

var randomimages = new Array()

randomimages[0] = "images/slideshow0.jpg"
randomimages[1] = "images/slideshow1.jpg"
randomimages[2] = "images/slideshow2.jpg"
randomimages[3] = "images/slideshow3.jpg"
randomimages[4] = "images/slideshow4.jpg"
randomimages[5] = "images/slideshow5.jpg"
randomimages[6] = "images/slideshow6.jpg"
randomimages[7] = "images/slideshow7.jpg"

var preload = new Array()

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

document.write('<img class="slideshow" name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'" width="340" height="190" border="0" vspace="0" hspace="0">');

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);
