function togLayer(obj, id, target)
{
	clearList(getElement(target));
	clearHighlight(obj.parentNode.parentNode);
	getElement(id).style.display = "block";
	flipColor(obj,"#CCCDE1");
}

function clearList(obj)
{
	for( var x = 0; obj.childNodes[x]; x++ )
	{
		if (obj.childNodes[x].nodeName == "UL")
		{
			obj.childNodes[x].style.display = "none";
		}
	}
}

function clearHighlight(obj)
{
	if (obj == null){return;}
	for (var i = 0; i < obj.childNodes.length; i++)
	{
		clearHighlight(obj.childNodes[i]);

		if (obj.childNodes[i].nodeName == "A")
		{
			obj.childNodes[i].style.backgroundColor = "";
		}
	}
}

function flipColor(obj, colorHex)
{
	var color = (obj.style.backgroundColor == obj.id) ? colorHex : obj.id;
		obj.style.backgroundColor = color;
}

function getElement(id)
{
	var obj = null;
	if (document.getElementById)
	{
		obj = document.getElementById(id);
	}
	else if (document.all)
	{
		obj = document.all[id];
	}
	return obj;
}
