﻿function FooterPusher()
{}

FooterPusher.prototype.pushThreeColFooter=function(contentId, leftColId, rightColId)
{
    var content=document.getElementById(contentId);
    var left=document.getElementById(leftColId);
    var right=document.getElementById(rightColId);
	var tallest=this.getTallestHeight(content, left, right);
	if (!this.findFlash(content) && tallest>0)
	{	
		content.style.height=tallest + 'px';
	}
}

FooterPusher.prototype.pushTwoColFooter=function(contentId, leftColId)
{
    var content=document.getElementById(contentId);
    var left=document.getElementById(leftColId);
    var tallest=this.getTallestHeight(content, left, null);
    if (!this.findFlash(content) && tallest>0)
    {
        content.style.height=tallest + 'px';
    }
}

//make sure we don't have flash in the page as adjusting heights seems to bugger that
FooterPusher.prototype.findFlash=function(ca)
{
	if (ca.getElementsByTagName('object').length>0 || ca.getElementsByTagName('embed').length>0)
	{
	   return true;
	}
	return false;
}

//gets the tallest height of the three content divs
FooterPusher.prototype.getTallestHeight=function(content, left, right)
{
	var contentHeight=content.clientHeight;
	//if we don't get a content height, something is buggered so return 0 so we don't mess with the DOM
	var rightCh=0;
	if (right!=null)
	{
	    rightCh=right.clientHeight;
	}
	if (contentHeight>0)
	{
		var tallLR=left.clientHeight>rightCh ? left.clientHeight : rightCh;
		//content height greater than heights, reutrn 0
		if (contentHeight>=tallLR)
		{
			return 0;
		}
		var ret=contentHeight>tallLR ? contentHeight : tallLR;
		return ret;
	}
	else
	{
		return 0;
	}
}