var origWidth = window.innerWidth;
var banners = new Array("building: McGovern Institute for Brain Research", "building: Simmons Hall", "building: Ray and Maria Stata Center");
randomNum = 0;

showalt = function() {
	document.getElementById("caption").innerHTML = banners[randomNum];
	document.getElementById("caption").style.display = 'block';
}

hidealt = function() {
	document.getElementById("caption").style.display = 'none';
	document.getElementById("caption").innerHTML = "";
}

startList = function() {
	// JavaScript Document for IE subnav 
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("navcontainer");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
	// pick random banner image
	randomNum = Math.floor(Math.random() * banners.length);
	var bannerURL = document.getElementById("banner").src.split("1");
	document.getElementById("banner").src = bannerURL[0] + (randomNum + 1).toString() + bannerURL[1];
	document.getElementById("banner").onmouseover = showalt;
	document.getElementById("tagline").onmouseover = showalt;
	document.getElementById("caption").onmouseover = showalt;
	document.getElementById("banner").onmouseout = hidealt;
	document.getElementById("tagline").onmouseout = hidealt;
	document.getElementById("caption").onmouseover = showalt;
}

window.onload=startList;
