function toggleLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}

function disableSubmit(whichButton)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		document.getElementById(whichButton).disabled = true;
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		document.all[whichButton].disabled = true;
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		document.layers[whichButton].disabled = true;
	}
}

function confirmDelete()
{
    var agree=confirm("Are you sure you wish to delete this entry?");
    if (agree)
        return true;
    else
        return false;
}

function returnObjById( id )
{
	if (document.getElementById)
		var returnVar = document.getElementById(id);
	else if (document.all)
		var returnVar = document.all[id];
	else if (document.layers)
		var returnVar = document.layers[id];
	return returnVar;
}

function setHandler( tagType, clsName, eventType, func )
{
	elements = document.getElementsByTagName( tagType );
	for( var t = 0; t < elements.length; t++ )
	{
		if( elements[t].className.indexOf( clsName ) >= 0 )
		{
			var code = "elements[t]." + eventType + " = " + func;
			eval( code );
		}
	}
}

function toggleColor( )
{
	var style2 = this.style;
	style2.backgroundColor = style2.backgroundColor? "":"#FFFF00";
}

function toggleBgColor( elem )
{
	var style2 = elem.style;
	style2.backgroundColor = style2.backgroundColor? "":"#FFFF00";
}

function externalLinks( )
{
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++)
	{
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
	}
}

function initpage( )
{
	setHandler( 'tr', 'toggle', 'onclick', 'toggleColor' );
	setHandler( 'span', 'heading', 'onmouseover', 'toggleColor' );
	setHandler( 'span', 'heading', 'onmouseout', 'toggleColor' );
	externalLinks( );
}

window.onload = initpage;