initNewsArchive = function() {
	if (document.getElementById) {
		archive = document.getElementById("NewsArchive");
		for (i=0; (h = archive.getElementsByTagName("H3")[i]); i++) {
			h.onclick = function() {
				if (this.className.indexOf("Open") != -1)
				{
					//this.className = this.className.replace(" Open", "");
					this.className = "";
				}
				else
					this.className += " Open";
				
				// fix for firefox
				var ul = this.nextSibling;

				if (this.nextSibling.nodeType == 3)
					ul = ul.nextSibling;
				
				switchDisplay(ul);
			}
		}
	}
}

function switchDisplay(obj) {
	if (typeof obj == "string") 
		obj = document.getElementById(obj);
		
	if (obj.style.display != "block") 
		obj.style.display = "block";
	else 
		obj.style.display = "none";
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

addLoadEvent(initNewsArchive);
