// script by Yellow Pencil

function setTall() {
	if (document.getElementById) {
		var contentHeight = document.getElementById('main');
		var rightHeight = document.getElementById('right');
		var leftHeight = document.getElementById('left');
			if (rightHeight.offsetHeight >= contentHeight.offsetHeight) {
				var leftStretch = rightHeight.offsetHeight;
				leftHeight.style.height = (leftStretch) + 'px';
			}
			else {
				var leftStretch = contentHeight.offsetHeight;
				leftHeight.style.height = (leftStretch) + 'px';
			}
	}
}
/*
window.onload = function() {
	setTall();
}

window.onresize = function() {
	setTall();
}*/

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;
}
function setScroll(){
	if (document.getElementById){
		var headerHeight = document.getElementById('header');
		var navigationHeight = document.getElementById('navigation');
		var contentpaneHeight = document.getElementById('contentpane');
		var footerHeight = document.getElementById('footer');
		var creditsHeight = document.getElementById('credits');
		var windowHeight = getWindowHeight();
		var otherHeight = (headerHeight.offsetHeight + navigationHeight.offsetHeight + footerHeight.offsetHeight + creditsHeight.offsetHeight);
		var contentpanesize = (windowHeight - otherHeight);
		contentpaneHeight.style.height = contentpanesize  + 'px';
	}
}
window.onload = function() {
	setScroll();
	setTall();
}
window.onresize = function() {
	setScroll();
	setTall();
}
