/****************************************
*
* www.johnkeller.com
*
* layout.js
* created by John Keller
*
* Copyright (c) 2004
* No portion of this code may be used or redistributed without
* the express written permission of the author (John Keller).
*
****************************************/


////////////////////////////////////////
// event handler overrides

var layoutOldOnLoad = window.onload;
var layoutOldOnResize = window.onresize;

if (_dom2 || _ie5) {
	window.onload = layoutOnLoad;
	window.onresize = layoutOnResize;
}

////////////////////////////////////////
// internal variables

var minHeight = 0;

////////////////////////////////////////
// event handlers

function layoutOnLoad() {
	var navDiv;

	if (navDiv = _div("navbar")) {
		minHeight = navDiv.offsetHeight;
	}

	layoutOnResize();
}

function layoutOnResize() {
	var contentDiv, height;

	if (contentDiv = _div("content")) {
		height = contentDiv.offsetHeight;

		// ensure that content area is at least as long as the nav bar
		// (since content area is the part that pushes down the bottom navigation)

		if (height <= minHeight) {
			contentDiv.style.height = minHeight + "px";
		} else {
			contentDiv.style.height = "auto";
		}
	}
}
