/* SI_clearFooter() v0.9
 * Use this function when absolutely positioning section navigation, 
 * primarary and secondary content and the footer falls below any one
 * of them. Absolute positioning avoids the unwanted wrapping that
 * sometimes occurs in IE PC when floats are used for layout.
 */
function SI_clearFooter() {
	var d = document,w=window,dE=d.documentElement,dB=d.body,h;
	if (!d.getElementById || !dB.offsetHeight) return;
	
	/* Configuration */
	var container	  = 'inner-container';	// The inner container div
	var minHeight	  = 410;	// Minimum page height in pixels
	var extendShallow = false;	// Extends shallow children so that repeating backgrounds 
								// will repeat all the way to the footer
	var bottomOut	  = false;	// Whether the footer should just clear the contents of the 
								// inner-container div or snap to the bottom of the window 
								// when content is too short
								
								
	var ic = d.getElementById(container); // The inner container div
	ic.style.height = '0';		// Resets the height
	var oh = [];		// Holds the offset heights of each child div
	var icTop = ic.offsetTop;
	var winHeight	= (typeof(w.innerHeight)=='number')?w.innerHeight:(dE&&dE.clientHeight)?dE.clientHeight:(dB&&dB.clientHeight)?dB.clientHeight:0;
	var footHeight	= d.getElementById('footer').offsetHeight;
	oh[0] = minHeight-icTop-footHeight;	// Minimum height of the inner-container div

	
	// Make an array of the rendered heights of the contained elements
	for (i=0;i<ic.childNodes.length;i++) { c = ic.childNodes[i]; if (c.nodeName=='DIV') { c.style.height = 'auto'; oh[oh.length] = parseInt(c.offsetHeight); }}
	// Determine the max height
	h = 0; for (k=0;k<oh.length;k++) { h = (oh[k]>h)?oh[k]:h;}
	// Force footer to the bottom of the window 
	if (bottomOut) { h = ((icTop+h+footHeight) < winHeight)?winHeight-footHeight-icTop:h; }
	// Extend shorter elements
	if (extendShallow) { for (i=0;i<ic.childNodes.length;i++) { c = ic.childNodes[i]; if (c.nodeName=='DIV') { c.style.height = h+'px'; }}}
	ic.style.height = h+'px';
	}
