
function ShowThis(obj, nodeName)
{
	var objParentUL = GetParentObject(obj, "UL", null, null);

	var objParentLI = GetParentObject(obj, "LI", null, null);
	var objCurrent = GetChildObject(objParentLI, nodeName, null, null);
	

	var childs = new Array();
	GetAllRecursiveChildObjects(objParentUL, nodeName, null, null, childs);


	for(var i = 0; i < childs.length; i++)
	{
		if(objCurrent != childs[i])
		{
			if(childs[i].style.display == "block")
			{
				childs[i].style.display = "none";
				SetAClass( childs[i], "");
			}
		}
		else
		{
			if(objCurrent.style.display == "block")
			{
				objCurrent.style.display = "none";
				SetAClass( childs[i], "");
				break;
			}
			else
			{
				objCurrent.style.display = "block";
				SetAClass( childs[i], "selected");
			}
		}
	}
}

function SetAClass(objUL, className)
{
	var childParent = objUL.parentNode;
	var childASibling = GetChildObject(childParent, "A", null, null);
	childASibling.className = className;
}

function SelectThisTab(show, hide)
{
	var tabButtonS = document.getElementById("tabButton" + show);
	var tabButtonH = document.getElementById("tabButton" + hide);

	var tabS = document.getElementById("tab" + show);
	var tabH = document.getElementById("tab" + hide);

	tabButtonS.className = "selected";
	tabButtonH.className = "";

	tabS.style.display = "block";
	tabH.style.display = "none";
}

function ShowThisCounty(objCounty)
{
	var objParentUL = GetParentObject(objCounty, "UL", null, null);
	//alert(objParentUL);
	var childCountyDivs = new Array();
	GetAllRecursiveChildObjects(objParentUL, "DIV", null, null, childCountyDivs);
	for(var i = 0; i < childCountyDivs.length; i++)
	{
		childCountyDivs[i].style.display = "none";
	}
	var objParentLI = GetParentObject(objCounty, "LI", null, null);
	var objCurrentCountyDiv = GetChildObject(objParentLI, "DIV", null, null);
	objCurrentCountyDiv.style.display = "block";
}

function GetChildObject(obj, tagName, attribute, value)
{
	var i;
	
	for(i=0; i<obj.childNodes.length; i++)
	{
		
		if(obj.childNodes[i].nodeName == tagName)
		{
			if(attribute!=null && attribute!="")
			{
				if(obj.childNodes[i][attribute].indexOf(value)!=-1)
					return obj.childNodes[i];
			}
			else
			{
				return obj.childNodes[i];
			}
		}
	}
	return null;
}

function GetAllRecursiveChildObjects(obj, tagName, attribute, value, childObjects)
{
	var i;
	
	for(i=0; i<obj.childNodes.length; i++)
	{
		//alert(i + " : " + obj.nodeName + " : " + obj.childNodes[i].nodeName);
		if(obj.childNodes[i].nodeName == tagName)
		{
			if(attribute!=null && attribute!="")
			{
				if(obj.childNodes[i][attribute].indexOf(value)!=-1)
				{
					childObjects[childObjects.length] = obj.childNodes[i];
					return childObjects;
				}
			}
			else
			{
				childObjects[childObjects.length] = obj.childNodes[i];
				return childObjects;
			}
		}
		
		GetAllRecursiveChildObjects(obj.childNodes[i], tagName, attribute, value, childObjects);
	}
	return childObjects;
}

function GetParentObject(obj, tagName, attribute, value)
{
	var i;
	
	while(obj.parentNode.nodeName!="BODY"&&obj.parentNode.nodeName!="HTML")
	{
		if(obj.parentNode.nodeName == tagName)
		{
			if(attribute!=null && attribute!="")
			{
				if(obj.parentNode[attribute].indexOf(value)!=-1)
					return obj.parentNode;
			}
			else
			{
				return obj.parentNode;
			}
		}
		
		obj = obj.parentNode;
	}
	
	return null;
}