function ToggleChildren(objParent)
{
	var intChildCount = GetSafeChildCount(objParent);

	for(var i = 0; i < intChildCount; i++)
	{
		elemCurrent = objParent.children(i);
		Toggle(elemCurrent);
	}
}

function Toggle(objElement)
{
	if ( IsVisible(objElement) ) HideElement(objElement);
	else ShowElement(objElement);
}

function IsVisible(objElement)
{
	if (objElement == null) return false;
	if (objElement.style == null) return false;

	return objElement.style.display != 'none';
}

function ShowChildren(objParent)
{
	var intChildCount = GetSafeChildCount(objParent);

	for(var i = 0; i < intChildCount; i++)
	{
		elemCurrent = objParent.children(i);
		ShowElement(elemCurrent);
	}
}

function ShowElement(objElement)
{
	if (objElement == null) return;
	if (objElement.style == null) return;

	objElement.style.display='';
}

function HideChildren(objParent)
{
	var intChildCount = GetSafeChildCount(objParent);

	for(var i = 0; i < intChildCount; i++)
	{
		elemCurrent = objParent.children(i);
		HideElement(elemCurrent);
	}
}

function HideElement(objElement)
{
	if (objElement == null) return;
	if (objElement.style == null) return;

	objElement.style.display='none';
}

function GetSafeChildCount(objParent)
{
	var aChildren = objParent.children;
	if (aChildren == null) return 0;
	var intChildCount = aChildren.length;
	if (intChildCount == null) return 0;

	return intChildCount;
}