
// length of slideshow timer (seconds)
var timer = 4;

//array of photo names
var photos = [
	['header_image_1', 'First Kropp header image'],
	['header_image_2', 'Second Kropp header image'],
	['header_image_3', 'Third Kropp header image'],
	['header_image_4', 'Fourth Kropp header image'],
	['header_image_5', 'Fifth Kropp header image']
	];

var img, count = 1;

function startSlideshow() {
	img = document.getElementById ('header_image_rotate');
	window.setTimeout ('cueNextSlide()', timer * 1000);
	}

function cueNextSlide() {
 	var next = new Image();
 	next.onerror = function() {
 		alert('Failed to load next images');
 	};
	next.onload = function() {
 		img.src = next.src;
 		img.alt = photos[count] [1];
 		img.width = next.width;
 		img.height = next.height;
 		if (++count == photos.length) { count = 0; }
 		window.setTimeout('cueNextSlide()', timer * 1000);
 	};
 	next.src = 'photos/' + photos[count][0] + '.jpg';
}

window.onload = function(){
	startSlideshow();
	}