
// function called when DOM is loaded
function initPage() {
	if (arguments.callee.done) return; // quit if this function has already been called
	arguments.callee.done = true; // flag this function so called only oce
	// do stuff
	write();
//	alert("It came from initPage!");
}

// for Mozilla based browsers
if (document.addEventListener) {
   document.addEventListener("DOMContentLoaded", initPage, null);
}

// for Internet Explorer (using conditional comments)
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/scr" + "ipt>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
    if (this.readyState == "complete") {
        initPage(); // call the onload handler
    }
};
/*@end @*/

/* for other browsers */
window.onload = initPage;




// index-specific stuff below

function write() {
	if (!document.getElementsByTagName || !document.getElementById('highlight-left')) { return; }
		var left = document.getElementById('highlight-left');
		var right = document.getElementById('highlight-right');
		var left_rnd = MD_random(0,8);
		var right_rnd = MD_random(0,8);
		while (left_rnd == right_rnd) {
			right_rnd = MD_random(0,8);
		}
		left.innerHTML = highlightArray[left_rnd];
		right.innerHTML = highlightArray[right_rnd];
}

var highlightArray = new Array();

highlightArray[0] = "<a href=\"profiles/17_king.html\"><img src=\"homeimages/hi_king.jpg\" alt=\"\" width=\"140\" height=\"85\" border=\"0\" /><br />Profiles: Martin Luther King, Jr.</a>";
highlightArray[1] = "<a href=\"milestones/m13_nbpc.html\"><img src=\"homeimages/hi_nbpc.jpg\" alt=\"\" width=\"140\" height=\"85\" border=\"0\" /><br />Milestones: Nat\'l Black Political Convention</a>";
highlightArray[2] = "<a href=\"profiles/11_hamer.html\"><img src=\"homeimages/hi_hamer.jpg\" alt=\"\" width=\"140\" height=\"85\" border=\"0\" /><br />Profiles:<br />Fannie Lou Hamer</a>";
highlightArray[3] = "<a href=\"profiles/36_panthers.html\"><img src=\"homeimages/hi_panthers.jpg\" alt=\"\" width=\"140\" height=\"85\" border=\"0\" /><br />Profiles:<br />The Black Panthers</a>";
highlightArray[4] = "<a href=\"share/index.html\"><img src=\"homeimages/hi_share.jpg\" alt=\"\" width=\"140\" height=\"85\" border=\"0\" /><br />Share Your Views:<br />Who Are Your Heroes?</a>";
highlightArray[5] = "<a href=\"about/press.html\"><img src=\"homeimages/hi_press.gif\" alt=\"\" width=\"140\" height=\"85\" border=\"0\" /><br />About the TV Series:<br />Press Reviews</a>";
highlightArray[6] = "<a href=\"story/08_washington.html\"><img src=\"homeimages/hi_march.jpg\" alt=\"\" width=\"140\" height=\"85\" border=\"0\" /><br />Follow the Story:<br />The March on Washington</a>";
highlightArray[7] = "<a href=\"story/21_boston.html#press\"><img src=\"homeimages/hi_boston.jpg\" alt=\"\" width=\"140\" height=\"85\" border=\"0\" /><br />Newspapers:<br />The Boston Busing Crisis</a>";
highlightArray[8] = "<a href=\"reflect/r02_today.html\"><img src=\"homeimages/hi_alanjenkins.jpg\" alt=\"\" width=\"140\" height=\"85\" border=\"0\" /><br />Reflections: Civil and Human Rights Today</a>";


function MD_random(r1, r2) {
  if (r2 > r1) return (Math.round(Math.random()*(r2-r1))+r1);
  else return (Math.round(Math.random()*(r1-r2))+r2);
}