// JavaScript Document

sfHover = function() {
	var sfEls = document.getElementById("scholarshiplist").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);



//Handle rotating images on home page
//Images are all have .jpg extension, and are numbered.
//Display each image based on random number.
function rotateImages(){
	var scholarshipImageDir = "/assets/rotators/scholarship/";
	var podcastsImageDir = "/assets/rotators/podcasts/";
	var coursesImageDir = "/assets/rotators/courses/";
	
	var numScholarshipImages = 6;
	var numPodcastsImages = 5;
	var numCoursesImages = 4;
	
	var randScholarship = Math.floor(Math.random() * numScholarshipImages)+1;
	var randPodcasts = Math.floor(Math.random() * numPodcastsImages)+1;
	var randCourses = Math.floor(Math.random() * numCoursesImages)+1;
	
	var scholarshipImage = document.getElementById("scholarshipImage");
	var podcastsImage = document.getElementById("podcastsImage");
	var coursesImage = document.getElementById("coursesImage");
	
	scholarshipImage.src = scholarshipImageDir + randScholarship + ".jpg";
	podcastsImage.src = podcastsImageDir + randPodcasts + ".jpg";
	coursesImage.src = coursesImageDir + randCourses + ".jpg";
}