/*
	Javascript functions for SEED WebScreen
	copyright (c) Pixink Ltd, 2011
*/

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 swapImage() {
	//	swaps the image displayed on the home page.
	if (nImage == aImages.length)
		nImage = 0;
	hImage.src = aImages[nImage++].src;
}

function init() {
	/*	init() is called in the page onLoad event.
			It preloads the images and then sets up
			a timer to call the swapImage() function.
			
			More images can be added by simply adding
			new Image elements to the aImages array and
			setting their .src properties
	*/
	hImage = document.getElementById('scroll');
	aImages[0] = new Image();
	aImages[0].src = "images/seed1.gif";
	aImages[1] = new Image();
	aImages[1].src = "images/seed2.gif";
	aImages[2] = new Image();
	aImages[2].src = "images/seed3.gif";
	aImages[3] = new Image();
	aImages[3].src = "images/seed4.gif";
	aImages[4] = new Image();
	aImages[4].src = "images/seed5.gif";
	// change image every 5 seconds
	hInterval = window.setInterval("swapImage()", 5000);
	// break out of any frame
	if (top.location != document.location) 
	{
		top.location.href = document.location.href;
	}
}

