
/* load random images */

function RotateImage() {

	if (!document.getElementById) return false;

	var menuBG = 'rotator';

	var imageFolderPath = 'images/rotation/';

	if (!document.getElementById(menuBG)) return false;

	var random_images = new Array ();
	random_images[0] = '01.jpg ';
	random_images[1] = '02.jpg ';
	random_images[2] = '03.jpg ';
	random_images[3] = '04.jpg ';
	random_images[4] = '05.jpg ';
	random_images[5] = '06.jpg ';

	var imageURL = "url(" + imageFolderPath + random_images[rand(random_images.length)] + ")";

	var image = document.getElementById(menuBG);		
	image.style.backgroundImage = imageURL;

	// switch images on a given interval
	// var timeToRotate = 1000; // 1000 is approximately 1 sec
	// movement = setTimeout("RotateImage()", timeToRotate);
}

/* random number generator */
function rand(n) {
	return ( Math.floor ( Math.random ( ) * n ) );
}
