run();

function run() {
	var oldOnload = window.onload;
	
	if (typeof window.onload != "function") {
		window.onload = thisOnload;
	} else {
		window.onload = function() {
			oldOnload();
			thisOnload();
		}
	}
}
	
function thisOnload() {
  writeBlogroll();
  writeHistoricalDocs();
}

function writeBlogroll() {
  if (!blogroll) return;
  var which = Math.ceil(Math.random()*(blogroll.length))-1;
  if (!document.getElementById) return;
  var theElem = document.getElementById('blogrollelem');
  theElem.innerHTML = '<a href="' + blogroll[which][0] + '">' + blogroll[which][1] + '</a>';
}

function writeHistoricalDocs() {
  if (!historicalDocs) return;
  var which = Math.ceil(Math.random()*(historicalDocs.length))-1;
  if (!document.getElementById) return;
  var theElem = document.getElementById('historicaldocelem');
  theElem.innerHTML = '<a href="' + historicalDocs[which][0] + '">' + historicalDocs[which][1] + '</a>';
}