function toggleLayer( whichLayer )
{
	var elem, vis;
	if( document.getElementById ) // this is the way the standards work
		elem = document.getElementById( whichLayer );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[whichLayer];
	else if( document.layers ) // this is the way nn4 works
		elem = document.layers[whichLayer];
	vis = elem.style;
	// if the style.display value is blank we try to figure it out here
	if( vis.display == '' && elem.offsetWidth != undefined && elem.offsetHeight != undefined )
		vis.display = ( elem.offsetWidth != 0 && elem.offsetHeight != 0 ) ? 'block':'none';
	vis.display = ( vis.display == '' || vis.display == 'block' ) ? 'none':'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( );
}
if( top.location != self.location )
		top.location = self.location;
window.onload = initpage;