function Largest(val1, val2)
{
	return (val1 > val2) ? val1 : val2;
}

function GetPageHeight()
{
	return document.body.scrollHeight;
}

function SetBlockHeights()
{
	var startHeight = GetPageHeight();
	do
	{
		document.getElementById("leftbottom").style.minheight++;
	} while (startHeight == GetPageHeight());
	document.getElementById("leftbottom").style.minheight--;
}

function menuItemOpen(elmnt)
{
	if (elmnt.childNodes[1])
		elmnt.childNodes[1].style.visibility="visible";
}

function menuItemClose(elmnt)
{
	if (elmnt.childNodes[1])
		elmnt.childNodes[1].style.visibility="hidden";
}

function showChildren(elmnt)
{
	x = elmnt.getElementsByTagName("div");
	for (child in x)
	{
		alert(child);
		if (child.className && child.className.substr(0, 4) == "list")
		{
			alert(child.className);
			child.style.visibility = "visible";
		}
	}
}

function hideChildren(elmnt)
{
	x = elmnt.getElementsByTagName("div");
	for (child in x)
	{
		alert(child.length);
		if (child.className && child.className.substr(0, 4) == "list")
		{
			alert(child.className);
			child.style.visibility = "hidden";
		}
	}
}

function toggleHeight(elmnt, h1, h2)
{
	elmnt.style.height = (elmnt.style.height == h2 ? h1 : h2);
}

function toggleHeightChilds(elmnt, h1, h2)
{
	x = elmnt.getElementsByTagName("div");
	
	for (var i = 0; i < x.length; i++)
	{
		if (x[i].className == "selectorItem")
		{
			toggleHeight(x[i], h1, h2);
		}
	}
}

function AdjustBarHeights()
{
    var doRight = (document.getElementById("right") ? true : false);
	var contentHeight = document.getElementById("content").offsetHeight;
	var topLeftHeight = document.getElementById("lefttop").offsetHeight + document.getElementById("lefttop").style.marginBottom;
	if (doRight) var topRightHeight = document.getElementById("righttop").offsetHeight + document.getElementById("righttop").style.marginBottom;
	if (contentHeight > document.getElementById("left").offsetHeight)
	{
		document.getElementById("leftbottom").style.height = (contentHeight - topLeftHeight) + "px";
		if (doRight) document.getElementById("rightbottom").style.height = (contentHeight - topRightHeight) + "px";
	}
    else if (doRight)
    {
        contentHeight = document.getElementById("right").offsetHeight;
		document.getElementById("leftbottom").style.height = (contentHeight - topLeftHeight) + "px";
		document.getElementById("rightbottom").style.height = (contentHeight - topRightHeight) + "px";
    }
}
