<!--
// -------------------------------------------------------------------------------------------------------------------------------
// js to place footer at bottom of the page or bottom of content, depending on window height

var topMargin = 20; // the height of the uberContainer is set to the window height (if windowHeight>contentHeight) less this value
var bitExtra = 50; // to ensure the footer doesn't sit on top of content on window resize; might have to tweak this

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 setFooter() {
	if (document.getElementById) {
		var windowHeight=getWindowHeight();
		var footerElement=document.getElementById('footer');
		
		var subcolHeight = 0;
		var maincolHeight = 0;
		var xcolHeight = 0;
		
		if (windowHeight>0) {
			
			var headerHeight = document.getElementById('header').offsetHeight;
			if(document.getElementById('nav')) { var navHeight = document.getElementById('nav').offsetHeight; }
			if(document.getElementById('content')) { var contentHeight = document.getElementById('content').offsetHeight; }
			
			// find the tallest
			var foo = new Array(navHeight,contentHeight); 
			var tallestCol = 0; 
			for (x=0;x<foo.length;x++){ 
				if (foo[x] > tallestCol) { 
				tallestCol = foo[x]
				} 
			}
			
			var contentHeight = headerHeight + tallestCol + bitExtra;
			
			
			//jsAlerts(windowHeight,headerHeight,subcolHeight,maincolHeight,xcolHeight,contentHeight);

			
			if (windowHeight>contentHeight) {

				footerElement.style.position='absolute';
				footerElement.style.bottom='0px';
				//document.getElementById('uberContainer').style.height = '98%';
				document.getElementById('uberContainer').style.height = (getWindowHeight()-topMargin)+'px';
			} else {
				//alert('windowHeight<contentHeight');
				footerElement.style.position='relative';
				document.getElementById('uberContainer').style.height = 'auto';
				}
		}
		footerElement.style.visibility = 'visible';
	}
}

function jsAlerts(windowHeight,headerHeight,navHeight,contentHeight) {
	alert('windowHeight = '+windowHeight);
	alert('headerHeight = '+headerHeight);
	alert('navHeight = '+navHeight);
	alert('contentHeight = '+contentHeight);
}

function initSetFooter() {
	// Mac IE has problems with 100% height divs
	if (document.all && !window.print) {
		//alert('mac ie');
		document.getElementById('uberContainer').style.height = getWindowHeight()+'px';
	}

	setFooter();
}


window.onload = initSetFooter;
window.onresize = initSetFooter;

//-->