// JavaScript Document

function randomIndex(lobound,hibound) {
	return (Math.floor(Math.random()*(hibound+1-lobound))+lobound);
}

function randomSplash(thenumber) {
	
// Here is where you specify the number of images in rotation
var numAll=3
	
if (thenumber==undefined) {
	
	tempNdx=randomIndex(1,numAll);
	
} else {
	
	tempNdx=thenumber;
	if (tempNdx>numAll) {
		tempNdx=1;
	}
	if (tempNdx<1) {
		tempNdx=numAll;
	}
}


var captions=new Array()
captions[1]="Yale students in the classroom"
captions[2]="The look of Yale in the 21st Century"
captions[3]="Student activities on campus"

nextNumber=tempNdx+1;
prevNumber=tempNdx-1;

splashString = '<img src="images/homephotos/'+tempNdx+'.jpg" width="397" height="210" border="0" alt="" \/>';
splashString = splashString + '<table id="splashtable" width="397" cellspacing="0" cellpadding="0" bgcolor="#0073ae"><tr>';
splashString = splashString + '<td><p class="cutline">'+captions[tempNdx]+'<\/p><\/td>';
splashString = splashString + '<td width="65"><p class="cutline"><a href="javascript:randomSplash('+prevNumber+')"><img src="images/previous.gif" alt="Previous" name="button_prev" width="15" height="18" border="0" id="button_prev" \/><\/a>';
splashString = splashString + '&nbsp;&nbsp;<a href="javascript:randomSplash('+nextNumber+')"><img src="images/next.gif" alt="Next" name="button_next" width="15" height="18" border="0" id="button_next" \/><\/a><\/p><\/td>';
splashString = splashString + '<\/tr><\/table>';

document.getElementById('splashdiv').innerHTML=splashString;
}
