function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
window.onresize = function() {
	setPage();
}

function setPage() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		var tableMain = document.getElementById('main');
		var tdCol = document.getElementById('col2');
		var tdFoot = document.getElementById('footer2');
		// check if footer is loaded!!
		if (tableMain) {
			if (windowHeight > 0) {
				var totalHeight = tableMain.offsetHeight;	
				var footerHeight = 42; //tdFoot.offsetHeight;
				if (windowHeight - totalHeight >= 0) {
					tdCol.style.height = (windowHeight - footerHeight) + 'px';
				} else {
					tdCol.style.height = 'auto';
				}
			}
		}
	}
//	setTimeout("setPage()", 500);
}

/*
happens in onload function in html!
window.onload = function() {
	setFooter();
}
*/