/**
 * Slideshow Library
 * JavaScript for Aurora Software website http://www.aurorasoft.com.au/
 * (C) 2009 Aurora Software
 **/
 
var auroraImageArray = new Array();
var auroraImageIndex=0;

// Add our images from 0 to 9
$R(0,8).each(function(x) {
	var img=new Image();
	img.src='/images/artwork/auroras/aurora_' + x + '.jpg';
	auroraImageArray[x]=img;
});

function animateAuroraSlideshow() {
	setInterval(switchAuroraImage, 3000)
}
function switchAuroraImage() {
	// place the next image to be displayed at the front
	$('imageFront').src = auroraImageArray[auroraImageIndex].src;
	
	// make the front image appear, then swap it with the back image
	new Effect.Appear('imageFront', { afterFinish: function() {
		// make the image in the back the same as the front
		$('imageBehind').src = $('imageFront').src;
		// hide the image in the front
		$('imageFront').style.display = 'none';
		// increment the index
		auroraImageIndex++;
		if (auroraImageArray[auroraImageIndex] == undefined) {
			auroraImageIndex=0;
		}
	} } );
}

/**
 * KICK OFF THE SCRIPT
 **/
document.observe('dom:loaded', animateAuroraSlideshow);
