x = 4000;
var numPhotos = 1;
var currentPhoto = 0;

var running = false
var endTime = null
var timerID = null

function preloadImages(Photo0, Photo1) 
{
  if (document.images)
  {
    if (typeof(document.WD) == 'undefined')
      document.WD = new Object();
    document.WD.loadedImages = new Array();
    document.WD.loadedImages[0] = new Image();
    document.WD.loadedImages[0].src = "/Images/Photos/" + Photo0 + ".jpg";
    document.WD.loadedImages[1] = new Image();
    document.WD.loadedImages[1].src = "/Images/Photos/" + Photo1 + ".jpg";
  }
	startTimer(Photo0, Photo1)
}

function startTimer(Photo0, Photo1) 
{
	running = true
	now = new Date()
	now = now.getTime()
	endTime = now + x
	checkTimer(Photo0, Photo1)
}

function checkTimer(Photo0, Photo1) 
{
	var now = new Date()
	now = now.getTime()
	if (endTime - now <= 0) 
	{
		changePhoto(Photo0, Photo1)
	} 
	else
	{
		if (running)
			timerID = setTimeout("checkTimer('" + Photo0 + "', '" + Photo1 + "');",250)
	}
}

function changePhoto(Photo0, Photo1) 
{
	gs = new Image;
	if (document.images) 
	{
  	if (currentPhoto == numPhotos) 
  	{
			document.images['PhotoRotate'].src="/Images/Photos/" + Photo0 + ".jpg";
  		currentPhoto = 0;
  	}
  	else
  	{  	
			document.images['PhotoRotate'].src="/Images/Photos/" + Photo1 + ".jpg";
  		currentPhoto++;
  	}
  }
	startTimer(Photo0, Photo1)
}

function TopNavRoll(Name, Section)
{
	document.images[Name].src='/Images/Navigation/Top/' + Section + '/' + Name + '.jpg';
}

function LeftNavRoll(PageSortOrder, Row, State)
{
	document.images['Left' + PageSortOrder].src='/Images/Navigation/Left/' + State + '/Left' + Row + '.jpg';
}

//This function is strictly for the alumni navigation menus.

function LeftAlumniNavRoll(Section, State)
{
	document.images[Section].src='/Images/Navigation/Left/' + State + '/' + Section + '.jpg';
}

