/* ------------------------------------------------------------------------ */
/* Used to pass the objectID into functions depending on the browser being used. */
function findDOM(objectID, withStyle)
{

var isDHTML = 0;
var isID = 0;
var isAll = 0;
var isLayers = 0;

	if (document.getElementById)
	{
 		isID = 1;
		isDHTML = 1;
	}

	else
	{
		if (document.all)
		{
			isAll = 1;
			isDHTML = 1;
		}
		else
		{
			browserVersion = parseInt (navigator.appVersion);
			if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) 
			{
				isLayers =1;
				isDHTML = 1;
			}
		}
	}

	if (withStyle == 1)
	{
		if (isID)
		{return (document.getElementById(objectID).style);}
		else
		{
			if (isAll)
			{return (document.all[objectID].style);}
		
			else
			{
				if (isLayers)
				{return (document.layers[objectID]);}
			}
		}
	}
	else
	{
		if (isID)
		{return (document.getElementById(objectID));}
		else
		{
			if (isAll)
			{return (document.all[objectID]);}			
			else
			{
				if (isLayers)
				{return (document.layers[objectID]);}
			}
		}
	}
}

/* ------------------------------------------------------------------------ */
/* Returns hidden or visible depending whether or not the object is visible. */
/* the variable dom is returned from the findDom function which looks at */
/* the type of browser being used */
/* Adapted from Using Javascript - Paul McFedries */
function getVisibility(dom)
{
	if (!document.layers)
	{
		if (dom.visibility)
		{return dom.visibility;}
	}
	else
	{
		if (dom.visibility == "show")
		{return "visible";}
		if (dom.visibility == "hide")
		{return "hidden";}
	}
	return "visible";
}
/* ------------------------------------------------------------------------ */
/* Hides or shows the object depending on the state parameter. Can be hidden, visible or toggle */
/* Pass in the objectID defined in the HTML page. state should either be visible or hidden */
function setVisibility(objectID, state)
{
	var dom = findDOM(objectID,1);
	if (state == "toggle")
	{
		if (getVisibility(dom) == "visible")
		{state = "hidden";}
		else
		{state = "visible";}
	}
	dom.visibility = state;
}

