var pairs = 0;
var this_pair = 0;
var historic = [];
var current = [];

function initialize() {
	var facts = document.getElementsByTagName("DL");
	for (var i=0; i < facts.length; i++) {
		if (facts[i].className=="historic") historic.push(facts[i].id);
		else if (facts[i].className=="current") current.push(facts[i].id);
	}
	pairs = Math.min(historic.length, current.length);
	this_pair = Math.floor(Math.random()*pairs);
	show_pair(this_pair);
}

function show_pair(i) {
	var historic_id = historic[i];
	var current_id = current[i];
	document.getElementById("home").className = historic_id+" "+current_id;
}

if (window.attachEvent) window.attachEvent("onload", initialize);
else if (window.addEventListener) window.addEventListener("load", initialize, false);
