/* Profile Picture Rotator for Featured Greeks Callout Box in Fraternity and Sorority Life Section
 * Created by Brendan Saulsbury
 * 08/06/08
 * Carnegie Mellon University
 */
var rotateTime = 10; // time delay between rotation of pictures in seconds
var container, current, photos, numPhotos, randomIndex, currIndex;
window.onload = function() {
	container = document.getElementById("profiles");
	photos = container.getElementsByTagName("li");
	numPhotos = photos.length;
	for (i=0; i<numPhotos; i++) {
		photos[i].style.display="none";
	}
	container.style.display="block";
	randomIndex = Math.round(Math.random()*10000000)%numPhotos;
	currIndex = randomIndex;
	setPic();
}
function timer() {
	setTimeout("changePic()",rotateTime*1000);
}
function changePic() {
	current.style.display="none";
	if (currIndex+1>=numPhotos) currIndex = -1;
	currIndex++;
	setPic();
}
function setPic() {
	current = photos[currIndex];
	current.style.display="block";
	timer();
}