// Simple Script to fade in an image on the home page and rotate through a bunch of images

// This script utilizes the Prototype and Script.taculo.us javascript libraries



function homeRotator() {

	imgDir = "images/indexSplash/";

	imgList = Array('001.jpg','002.jpg','003.jpg','004.jpg','005.jpg','006.jpg','007.jpg','008.jpg','009.jpg','010.jpg','011.jpg','012.jpg','013.jpg','014.jpg');

	imgR = $('rotator');

	hideImg();

	

	function waitCycle() {

		setTimeout('homeRotator()', 1000)	

	}

	function changeImg() {

		var num = Math.floor((Math.random() * imgList.length));

		while (imgR.src.match(imgDir+imgList[num])) { // Make sure we dont show same img in a row

			var num = Math.floor((Math.random() * imgList.length));

		}

		imgR.src=imgDir+imgList[num];

		Effect.Appear(imgR, {duration:3.0, queue:{position: 'end', scope: 'homeRotator'}, afterFinish:waitCycle});

	}

	function hideImg() {

		Effect.Fade(imgR, {duration:3.0, queue:{position: 'end', scope: 'homeRotator'}, afterFinish:changeImg});

	}

}




