/*
Adjust Height Javascript [adjustheight.js]
author:		Ryutaro MIYASHITA (in Littel Corporation.)
create:		2010/10/08
update: 	2010/10/12
*/

function adjustHeight() {
	// Running Onload Events Start
	if(window.addEventListener) {
		// for Firefox, Safari, Opera, Google Chrome and More modern Browser.
		window.addEventListener("load", cycleAdjust, false);
	} else if(window.attachEvent) {
		// for Internet Explorer.
		window.attachEvent("onload", cycleAdjust, false);
	}
	// Running Onload Events End
}

function cycleAdjust(){
	setTimeout("loadContent()", 100);
}
function loadContent() {
	try {
		// Set Present Height
		try{
			document.getElementById("centerContents").style.height = "auto";
		}catch(e){}
		var sbLeft   = document.getElementById("sidebarLeft").offsetHeight;
		var cContent = document.getElementById("centerContents").offsetHeight;
		var sbRight  = document.getElementById("sidebarRight").offsetHeight;
		// Set Temporary Max Height (Sidebar Left)
		var max = sbLeft;

		// Calculation Max Height and Set Calculation Max Height
		if(cContent > max) {
			max = cContent;
		}else if (sbRight > max) {
			max = sbRight;
		}
		// Set Max Height for Subject Elements
		document.getElementById("sidebarLeft").style.height = max + 'px';
		document.getElementById("centerContents").style.height = max + 'px';
		document.getElementById("sidebarRight").style.height = max + 'px';
	} catch(e) {
		// Do nothing.
	}
}
