window.onload = function(){ Setup(); }
window.onresize = function(){ Setup(); }

function GetSizer(elem)
{
	var chm = elem.getElementsByTagName("div");
	var num = chm.length;
	for( i = num - 1; i >= 0; i-- )
	{
		var n1 = chm[i].getAttribute("id");
		if (n1 == "sizer")
		{
			elem = chm[i];
			i = -1;
		}
	}
	return elem;
}

function SizeWidth()
{
	if (navigator.userAgent.indexOf("MSIE") < 0) {
		var bo = document.body;
		var bow = bo.clientWidth;

		var mb = GetSizer(bo, "mainbar");
		mb.style.width = "";
		if (mb.clientWidth < (bow - 350)) {
			mb.style.width = bow - 350;
		}

		var mp = GetSizer(bo, "main_panel");
		var mpw = mb.clientWidth;

		var tp = GetSizer(bo, "tit_bar_right");
//		var tp = GetSizer(bo, "top_panel");
		var bp = GetSizer(bo, "foot_bar_text");
//		tp.style.width = "";
//		if (tp.clientWidth < mpw) {
//			tp.style.width = bow;
//			alert("123456");
//		}

//		bp.style.width = "";
/*		if (bp.clientWidth < bow) {
			bp.style.width = bow;
		}
*/	}
}

function SizePanels()
{
				var leftpanel = document.getElementById("left_panel");
				var rghtpanel = document.getElementById("rght_panel");
				var centpanel = document.getElementById("cent_panel");
				
				var leftlast = GetSizer(leftpanel);
				var rghtlast = GetSizer(rghtpanel);
				var centlast = GetSizer(centpanel);
				
				leftlast.style.height = 1;
				rghtlast.style.height = 1;
				centlast.style.height = 1;

				var newh = Math.max(leftpanel.offsetHeight, rghtpanel.offsetHeight, centpanel.offsetHeight);
				
				if (newh > leftpanel.offsetHeight) {
					leftlast.style.height = leftlast.offsetHeight + newh - leftpanel.offsetHeight;
				}
				if (newh > rghtpanel.offsetHeight) {
					rghtlast.style.height = rghtlast.offsetHeight + newh - rghtpanel.offsetHeight;
				}
				if (newh > centpanel.offsetHeight) {
					centlast.style.height = centlast.offsetHeight + newh - centpanel.offsetHeight;
				}
				
}

function Setup()
{
	SizeWidth();
	if (document.body.getAttribute("id") == "layout-full")
	{
		SizePanels();
	}
}

