/** Function to rotate images:
 ** This function assumes that the image to be rotated has an ID of 'rotator',
 ** and that the images are stored as Image() objects in an array (imgArray)
 ***************************************************************************/
function rotate(ind) {
	// Get image to be rotated
	var img = document.getElementById('rotator');
	
	// If no or an invalid index value is passed, correct it
	if (isNaN(ind) || ind>=imgArray.length || ind<0) ind = 0;
	
	// If no or an invalid time is pass, correct it
	if (isNaN(time_out) || time_out<=0 ) time_out = 3000;
	
	// Swap image with next in array
	img.src = imgArray[ind++].src;
	
	// If the incremented index is outside of the array, reset it
	if(ind==imgArray.length) ind = 0;
	
	// Call function again in five seconds
	setTimeout("rotate("+ind+")", time_out);
}