var imgFolder = '/images/';  
var rotatePeriod = 2500;  //equivalent to 2.5 seconds; 3000 == 3 seconds, 4000 =4, etc.

var images = new Array(
	 "lab1.jpg",
	 "lab2.jpg",
	 "lab3.jpg",
	 "lab4.jpg",
	 "lab5.jpg",
	 "lab6.jpg",
	 "lab7.jpg",
	 "lab8.jpg",
	 "lab9.jpg",
	 "lab10.jpg",
	 "lab11.jpg",
	 "lab12.jpg",
	 "lab13.jpg"
);

var image = new obj('rotater'); //name in quotes must match the id attribute of the img tag in the html file
var timeoutID = 0;
rotateImage();

function rotateImage()
{
  window.clearTimeout(timeoutID);
  var random_number = Math.floor(Math.random() * images.length);
  image.src =  imgFolder + images[random_number];
  timeoutID = window.setTimeout(rotateImage, rotatePeriod);
}

function obj(name)
{
  return document.getElementById(name);
}
