/*
<script src="http://www.howard.edu/browsersniffer.js" language="javascript"></script>
<script type="text/javascript" language="javascript">
<!--
imageRotate_TotalImages = 15;
imageRotate_NumSecondsPause = 8;
imageRotate_ImageURLStart = "images/gallery2/";
imageRotate_ImageURLEnd = ".jpg";
imageRotate_StartRotation();
//-->
</script>

For non-random:
<img src="../images/gallery2/1.jpg" name="rotatingImage" width="542" height="355" border="0" id="rotatingImage" alt="">

For random:
<script type="text/javascript" language="javascript">
<!--
document.write("<img src=\"" + imageRotate_ImageURLStart + rotatingImageNum + imageRotate_ImageURLEnd + "\" width=\"300\" height=\"300\" border=\"0\" name=\"rotatingImage\" id=\"rotatingImage\">");
//-->
</script><noscript><img src="../DefaultImageURL" alt="" width="300" height="300" border="0" name="rotatingImage" id="rotatingImage"></noscript>
*/


/* The total number of images to rotate through. */
var imageRotate_TotalImages = 0;

/*
If imageRotate_LeadingZeros is true, then leading zeros will be added to the current number when outputting the image tag.
The number if leading zeros that should be added is based on the total number of images.
Ex: image009.jpg

If imageRotate_LeadingZeros is false, no leading zeros will be added.
Ex: image9.jpg
*/
var imageRotate_LeadingZeros = false;

/*
If imageRotate_Preloading is "NO", then images will not be preloaded before they are displayed.
If imageRotate_Preloading is "NEXT", the next image will be preloaded half-way through the pause between images.
If imageRotate_Preloading is "ALL", all the images will be preloaded half-way through the first pause after the first image.
*/
var imageRotate_Preloading = "NEXT";

/* The number of images that have been reploaded. */
var imageRotate_PreloadedImages = 0;

/* The number if seconds between each image. Decimal values will be treated as miliseconds. */
var imageRotate_NumSecondsPause = 10;

/* The beginning of the image URL */
var imageRotate_ImageURLStart = "";

/* The end of the image URL */
var imageRotate_ImageURLEnd = "";

/*
If imageRotate_RandomFirstImage is true, then the first image shown will be selected randomly.
If imageRotate_RandomFirstImage is false, then image number 1 will be shown first.
*/
var imageRotate_RandomFirstImage = false;

/* The current image we are on. */
var imageRotate_RotatingImageNum = 1;
if (imageRotate_RandomFirstImage == true)
{
	imageRotate_RotatingImageNum = Math.round( (Math.random() * (imageRotate_TotalImages-1)) + 1)
}

/* If the image rotation is RUNing or STOPed. */
var imageRotate_State = "STOP";

/* Rotate to the next picture. */
function nextRotatingImage()
{
	if (imageRotate_State == "RUN")
	{
		imageRotate_RotatingImageNum++;
		if (imageRotate_RotatingImageNum == imageRotate_TotalImages+1)
		{
			imageRotate_RotatingImageNum = 1;
		}
		
		var objRotatingImage = document.getElementById("rotatingImage");
		if (objRotatingImage != null)
		{
			imageRotate_GotoImage(imageRotate_RotatingImageNum);
			
			setTimeout("nextRotatingImage();", imageRotate_NumSecondsPause * 1000);
			
			if (imageRotate_Preloading == "NEXT")
			{
				// Preload the next image before it is displayed.
				setTimeout("preloadNextImage();", Math.round(imageRotate_NumSecondsPause / 2) * 1000);
			}
		}
	}
}

// Preload all the rotating images.
function preloadAllImages()
{
	for (i = 1; i <= imageRotate_TotalImages; i++)
	{
		var fakeImage = new Image();
		fakeImage.src = imageRotate_ImageURLStart + i + imageRotate_ImageURLEnd;
	}
}

// Preload an image.
function preloadNextImage()
{
	/* Determine the number of the next image */
	var nextImage = imageRotate_RotatingImageNum + 1;
	if (nextImage == imageRotate_TotalImages + 1)
	{
		nextImage = 1;
	}
	
	/* If we have not preloaded more images than the total, then continue... */
	if (imageRotate_PreloadedImages <= imageRotate_TotalImages)
	{
		var fakeImage = new Image();
		fakeImage.src = imageRotate_ImageURLStart + nextImage + imageRotate_ImageURLEnd;
		imageRotate_PreloadedImages++;
	}
}

function imageRotate_StopRotation()
{
	imageRotate_State = "STOP";
}

function imageRotate_StartRotation()
{
	// Start the rotation if the total number of images is greater than 0, and the person using a recent browser.
	if ((imageRotate_TotalImages > 0) && (is_nav6up || is_ie5_5up || is_fx || is_fb || (is_moz && is_moz_ver > 1.5)))
	{
		imageRotate_State = "RUN";
		
		// Start the rotation.
		setTimeout("nextRotatingImage();", imageRotate_NumSecondsPause * 1000);
		
		if (imageRotate_Preloading == "NEXT")
		{
			// Preload the next image before it is displayed.
			setTimeout("preloadNextImage();", Math.round(imageRotate_NumSecondsPause / 2) * 1000);
		}
		else if (imageRotate_Preloading == "ALL")
		{
			// Preload all images before the first rotation.
			setTimeout("preloadAllImages();", Math.round(imageRotate_NumSecondsPause / 2) * 1000);
		}
	}
}

function imageRotate_GotoImage(imageNumber)
{
	/* Set the current rotating image number to the passed image number */
	imageRotate_RotatingImageNum = imageNumber;
	
	/* If a tag with the ID of rotatingImage exists, then load the image into it. */
	var objRotatingImage = document.getElementById("rotatingImage");
	if (objRotatingImage != null)
	{
		objRotatingImage.src = imageRotate_ImageURLStart + imageRotate_RotatingImageNum + imageRotate_ImageURLEnd;
	}
}

function imageRotate_GotoNext(loop)
{
	if ((imageRotate_RotatingImageNum >= imageRotate_TotalImages) && (loop == true))
	{
		imageRotate_GotoImage(1);
	}
	else
	{
		imageRotate_GotoImage(imageRotate_RotatingImageNum+1);
	}
}

function imageRotate_GotoPrevious(loop)
{
	if ((imageRotate_RotatingImageNum <= 1) && (loop == true))
	{
		imageRotate_GotoImage(imageRotate_TotalImages);
	}
	else
	{
		imageRotate_GotoImage(imageRotate_RotatingImageNum-1);
	}
}