﻿/* Folks, addLoadEvent is a function made by Simon Willison that serves as a manageable window.onload replacement.  Jeremy Keith gave it a thumbs up in his book, DOM Scripting, and it's difficult to walk away from that book without incorporating it into every project.*/function addLoadEvent(func) {  var oldonload = window.onload;  if (typeof window.onload != 'function') {    window.onload = func;  } else {    window.onload = function() {      oldonload();      func();    }  }}/* Here's the part I wrote that uses the functions above to create our "link boxes". */function prepareBoxes() {	var boxes = getElementsByClassName(document, "li", "linkbox");	for (var i=0; i<boxes.length; i++){		var fullstories = getElementsByClassName(document, "p", "fullstory");		for (var k=0; k<fullstories.length; k++){			fullstories[k].parentNode.tabIndex = k+1;			fullstories[k].style.display = "none";			fullstories[k].parentNode.onmouseover = function() {				addClassName(this, "hovering");			}			fullstories[k].parentNode.onmouseout = function() {				removeClassName(this, "hovering");			}			fullstories[k].parentNode.onclick = function() {				var destin = this.getElementsByTagName("a");				window.location = destin[0].href;			}			fullstories[k].parentNode.onkeypress = fullstories[k].parentNode.onclick;		}	}}addLoadEvent(prepareBoxes);