/*******************************
 *
 *	Footer Manager
 *
 *  Version: 1.0
 *
 *	Authors:
 *  A List Apart (http://alistapart.com/articles/footers)
 *	The Roundhouse
 *  Paul Lewis
 *
 *  Description:
 *
 *	Handles the placement of the footer onto the bottom of the page,
 *  rewritten function, based on A List Apart article, but using Moo FX
 */

function placeFooter()
{
	var windowHeight 		= window.getHeight();
	var footerElement 		= $('finfooter');

	if(footerElement && windowHeight > 0)
	{
		var contentHeight		= $('fincontainer').offsetHeight;
		var arrLeftTabs			= $$('.finlefttab');
		var arrRightTabs		= $$('.finrighttab');	
		
		if(arrLeftTabs.length > 0)
		{
			contentHeight = Math.max(contentHeight, arrLeftTabs[0].offsetHeight);
		}
		if(arrRightTabs.length > 0)
		{
			contentHeight = Math.max(contentHeight, arrRightTabs[0].offsetHeight);
		}
		
		var blInWhosWho	= (document.location.href.indexOf('whoswho') > -1);
		var footerHeight	= footerElement.getStyle('height').toInt();

		if(!blInWhosWho && windowHeight-(contentHeight+footerHeight)>=0)
		{
			footerElement.setStyle('position', 'relative');
			footerElement.setStyle('top', windowHeight-(contentHeight+footerHeight)+'px');
		}
		else
		{
			footerElement.setStyle('position', 'static');
		}
	}
}

window.addEvent('resize', placeFooter);
window.addEvent('load', placeFooter);
