// JavaScript Document
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( contentIds, footerId)
{
	if (document.getElementById) 
	{
		var windowHeight=getWindowHeight();
		if (windowHeight>0) 
		{
			// get the max height of the different content ids
			var contentHeight = 0;
			for( var i = 0; i < contentIds.length; i++ )
				if( contentHeight < document.getElementById( contentIds[ i ] ).offsetHeight )
					contentHeight = document.getElementById( contentIds[ i ] ).offsetHeight;
			
			var footerElement=document.getElementById( footerId );
			var footerHeight=footerElement.offsetHeight;
			
			if (windowHeight-(contentHeight+footerHeight)>=0) 
			{
				footerElement.style.position='relative';
				footerElement.style.top=(windowHeight-(contentHeight+footerHeight))+'px';
			}
			else 
			{
				footerElement.style.position='static';
			}
		}
	}
}
 


/**
* Utility function to add an event listener
* @param o object to add event to
* @param e name of event ("keypress", "keydown", ...), do not add the "on" prefix
* @param f function to handle even (function reference, not its string name)
*/
function addEvent( o, e, f )
{
	if (o.addEventListener)
	{ 
		o.addEventListener( e, f, true); 
		return true; 
	}
	else if (o.attachEvent)
	{ 
		return o.attachEvent( "on" + e, f); 
	}
	else 
	{
		return false; 
	}
}