var interval = 3.0; // delay between rotating images (in seconds)
interval *= 1000;

var img_folder = "/images/logos/imagerotator/"; // location of images

images = new Array();
// insert image file names [Max dimensions: 200x150 pixels]
images = [
		  "AcadianTimber.png",
		  "AFR.png",
		  "Ainsworth.png",
		  "Alpac.png",
		  "AthabascaNorthern.png",
		  "AtlasHoldings.png",
		  "Belkorp.png",
		  "Boise.png",
		  "Conifex.png",
		  "DMI.png",
		  "Domtar.png",
		  "FFP.png",
		  "IdahoForest.png",
		  "JMLongyear.png",
		  "LongviewFibre.png",
		  "Lonza.png",
		  "Matson.png",
		  "Millar.png",
		  "Mistik.png",
		  "NewPage.png",
		  "Newstech.png",
		  "Potomac.png",
		  "Rocktenn.png",
		  "Roseburg.png",
		  "RSG.png",		  
		  "SFK.png",
		  "SunMountain.png",
		  "TMI.png",
		  "WashingtonAlder.png",
		  "WestFraserTimber.png",
		  "Weyerhaeuser.png"
		 ];
  
var num_img = images.length;

img_list = new Array();

for (img_index = 0; img_index < num_img; img_index++) {

	img_list[img_index] = img_folder + images[img_index];

}

img_index = Math.floor(Math.random() * num_img) - 1; // Start at a random image

function getNextImage() {

	img_index = (img_index + 1) % num_img;

	var new_img = img_list[img_index];
	
	return(new_img);

}

function rotateImage(imgElement) {

	var next_img = getNextImage();
	document.getElementById(imgElement).style.backgroundImage = "url(" + next_img + ")";
	
	var recur_call = "rotateImage('" + imgElement + "')";
	setTimeout(recur_call, interval);

}