// Magic Footer for IRCOAutomation.com

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;
}

// A few numbers used in the function below refer to the height of various objects on the page itself
// A height of 194 refers to the combined height of the header and menu or just the height of the image changer
// A height of 55 refers to the height of the footer
// A height of 249 refers to the combined height of the two variables listed above

function newDivs() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		var leftHeight = document.getElementById('left_column').offsetHeight;
		var newsHeight = document.getElementById('right_column').offsetHeight;
		if (windowHeight > 0) {
			var footerElement = document.getElementById('footer');
			var pageElement = document.getElementById('page_width');
			var leftElement = document.getElementById('left_column');
			var contentElement = document.getElementById('content');
			if (((leftHeight + 194) > (windowHeight - 55)) && ((leftHeight + 194) > (newsHeight + 194))) {
				footerElement.style.top = (leftHeight + 194) + 'px';
				pageElement.style.height = (leftHeight + 249) + 'px';
				contentElement.style.height = (leftHeight) + 'px';
			} else if (((newsHeight + 194) > (windowHeight - 55)) && ((newsHeight + 194) > (leftHeight + 194))) {
				footerElement.style.top = (newsHeight + 220) + 'px';
				pageElement.style.height = (newsHeight + 275) + 'px';
				contentElement.style.height = (newsHeight + 25) + 'px';
			} else {
				footerElement.style.top = (windowHeight - 55) + 'px';
				pageElement.style.height = (windowHeight) + 'px';
				leftElement.style.height = (windowHeight - (194 + 55)) + 'px';
				contentElement.style.height = (windowHeight - (194 + 55)) + 'px';
			}
		}
	}
}			