var Main_Container = "";
var left_container = "";
var center_container = "";
var right_container = "";
var submenu_container = "";
var allHeight = "";
var LeftHeight = "";
var CenterHeight = "";
var RightHeight = "";
var paddingLeft = "";
var paddingCenter = "";
var paddingRight = "";
DebugMode = true; 
function Height(obj) {
	try{
  	if (typeof obj!="object") obj=document.getElementById(obj);
  	if (typeof obj!="object") return 0;
		return obj.offsetHeight;
	}
	catch(e){
		return 0;
	}
}

function max(a,b){
	return a<b?b:a;
}
function PageResize(){
  GetSettings();
  PageSetup(true);
}

function GetSettings(){
	try{
	Main_Container = document.getElementById("Main_Container");
	left_container = document.getElementById("Left_Menu_Container");
	center_container = document.getElementById("left_container");
	right_container = document.getElementById("right_container");
	submenu_container = document.getElementById("submenu_container");
	footer_container = document.getElementById("Footer_Container");
	left_container.style.height = Height(center_container);
	left_container.style.height = "";
	center_container.style.height = "";
	right_container.style.height = "";
	MainHeight = Height(Main_Container);
	LeftHeight = Height(left_container);
	CenterHeight = Height(center_container);
	RightHeight = Height(right_container);
	paddingLeft = 60;
	paddingCenter = 0;
	paddingRight = 40;
  }
	catch(e){
		setTimeout(GetSettings,200);
	}
}

function PageSetup(submenu){
	try{
//	alert(Height(right_container))
  if (typeof submenu=="undefined") submenu=true;
	if (submenu===true) SubHeight = Height(submenu_container);
	else SubHeight = 0;
	MainHeight = Height(Main_Container)-SubHeight;
	LeftHeight = Height(left_container)-SubHeight;
	CenterHeight = Height(center_container);
	RightHeight = Height(right_container);
	allHeight =  max(allHeight,MainHeight);
	allHeight =  max(allHeight,LeftHeight);
	allHeight =  max(allHeight,CenterHeight);
	allHeight =  max(allHeight,RightHeight);

	left_container.style.top = SubHeight + "px";
	left_container.style.height = (allHeight) + "px";
	center_container.style.height = (allHeight+ SubHeight)+ "px";
	right_container.style.height = (allHeight+20+ SubHeight)+"px";
	footer_container.style.top = (allHeight+100) + "px";
		setTimeout(startChart,1000);
	}
	catch(e){
		setTimeout(PageSetup,1000);
	}
}

function startChart(){
  	document.getElementById("chart").style.display = "inline";
}
	function topPos(obj) {
		try
		{
	  if (typeof obj!="object") obj=document.getElementById(obj);
	  if (typeof obj!="object") return 0;
		return findPosY(obj)-minus;
		}
		catch(e)
		{
			return 0;
		}
	}

function SetContainerHeight(){
	var nHeight = parseInt(arguments[0]);
	var maxHeight = nHeight;
	for (var n=1; n<arguments.length; n++){
		try{
			arguments[n].style.height = nHeight + "px";
			var thisHeight = Height(arguments[n]);
			if (thisHeight>maxHeight) maxHeight = thisHeight;
		}
		catch(e){
			if (DebugMode)	alert(e.message)
		}
	}
	
	for (var n=1; n<arguments.length; n++){
		try{
			var thisHeight = Height(arguments[n])
			var DefHeight = maxHeight-thisHeight
			arguments[n].style.height = nHeight+DefHeight + "px";
		}
		catch(e){
			if (DebugMode)	alert(e.message)
		}
	}
}

