var hInterval; // handle for the callback function
var hImage; // handle for image element on the page
var aImages = new Array(); // preload buffer for images
var nImage = 1; // image number of next image to show

function changeImage() {
	if (nImage == aImages.length)
		nImage = 0;
	hImage.src = aImages[nImage++].src;
}

function imageLoad() {
	/*	init() is called in the page onLoad event.
			It preloads the images and then sets up
			a timer to call the changeImage() function.
	*/
	hImage = document.getElementById('SlideShow');
	aImages[0] = new Image();
	aImages[0].src = "images/slideshow/leafypoacher.jpg";
	aImages[1] = new Image();
	aImages[1].src = "images/slideshow/S1030115.jpg";
	aImages[2] = new Image();
	aImages[2].src = "images/slideshow/potplant.jpg";
	aImages[3] = new Image();
	aImages[3].src = "images/slideshow/fireplace.jpg";
	aImages[4] = new Image();
	aImages[4].src = "images/slideshow/bar2.jpg";
	aImages[5] = new Image();
	aImages[5].src = "images/slideshow/yard.jpg";
	aImages[6] = new Image();
	aImages[6].src = "images/slideshow/wellL.jpg";
	aImages[7] = new Image();
	aImages[7].src = "images/slideshow/puppies.jpg";
	// change image every 3000 milliseconds
	hInterval = window.setInterval("changeImage()", 3000);
	// break out of any frame
	if (top.location != document.location) 
	{
		top.location.href = document.location.href;
	}
}
