// JavaScript Document

function setLayout() {
	var ua = navigator.userAgent; 
	var nHit = ua.indexOf("MSIE");
	var bIE = (nHit >=  0); 
	var window_w = 0;
	var window_h = 0;
	if (bIE) {
		if (ua.substr(nHit+5, 1) >= "6") {
			window_w = document.documentElement.clientWidth;
			window_h = document.documentElement.clientHeight;
		} else {
			window_w = document.body.clientWidth;
			window_h = document.body.clientHeight;
		}
	} else {
		window_w = window.innerWidth;
		window_h = window.innerHeight;
	}
	var targetDiv = document.getElementById("footer_wrap");
	targetDiv.style.marginTop = "0px";
	var ret = Element.getDimensions("container");
	if (window_h > ret.height) {
		targetDiv.style.marginTop = (window_h - ret.height)+"px";
	}
	var leftDiv = document.getElementById("contents_left");
	var rightDiv = document.getElementById("contents_right");
	if ((leftDiv != null) && (rightDiv != null)) {
		var ret = Element.getDimensions("contents_left");
		var leftH = ret.height;
		var ret = Element.getDimensions("contents_right");
		var rightH = ret.height;
		if (leftH > rightH) {
			rightDiv.style.height = (leftH-40)+"px";
		} else {
			leftDiv.style.height = (rightH-40)+"px";
		}
	}
}
window.onload = function() {
	setLayout();
}
window.onresize = function() {
	setLayout();
}

