/* Code for IE rollovers */
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload=startList;


function init()
{
	var W3CDOM = (document.createElement && document.getElementsByTagName);
	if (!W3CDOM) return;
	var test = new Image();
	var tmp = new Date();
	var suffix = tmp.getTime();
	test.src = '/images/text/fir_test.gif?'+suffix;
	test.onload = imageReplacement;

	if (window.attachEvent) {
		if(location.pathname=='/' || location.pathname=='/index.php' || location.pathname=='/archives.php') {
			replacehr(); 
		}
	}
}

function imageReplacement()
{
	replaceThem(document.getElementsByTagName('h1'));
	replaceThem(document.getElementsByTagName('h2'));
}

function replaceThem(x)
{
	var replace = document.createElement('img');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id)
		{
			var y = replace.cloneNode(true);
			y.src = '/images/text/' + x[i].id + '.gif';
			y.alt = x[i].firstChild.nodeValue;
			x[i].replaceChild(y,x[i].firstChild);
		}
	}
}
function replacehr()
{
	var thebody = document.getElementById("content-main");
	
	var hrs = document.getElementsByTagName("hr");

	thislen = hrs.length;
	for(var i=0; i<thislen; i++)
	{
		var hr = hrs[0]
		var newtag = document.createElement("div");
		var replaced = thebody.replaceChild(newtag,hr);
		  
		if (hr.className!='')
		{
			newtag.className=hr.className;
		}
	}

}

function openWindow(filename,wide,high)
{
	popupWin = window.open(filename, 'remote', 'scrollbars=yes,resizable=no,width='+wide+',height='+high+'')
}


var gSafeOnload = new Array();
function SafeAddOnload(f)
{
	if  (window.onload)
	{
		if (window.onload != SafeOnload)
		{
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}		
		gSafeOnload[gSafeOnload.length] = f;
	}
	else
		window.onload = f;
}
function SafeOnload()
{
	for (var i=0;i<gSafeOnload.length;i++)
		gSafeOnload[i]();
}
function adjustHeight()
{
	maincol = document.getElementById('content-main');
	sidecol = document.getElementById('content-col1-event');

	maincol_height	= maincol.offsetHeight;
	sidecol_height	= sidecol.offsetHeight;

	
	if (sidecol_height > maincol_height)
	{
		maincol.style.height 	= sidecol_height  + 'px';
	}
}
isIE6 = /msie|MSIE.6/.test(navigator.userAgent);
if (isIE6)
{
	SafeAddOnload(adjustHeight);
}


//window.onload=init;