window.onload=function () {
  resizeFooter();
}

function resizeFooter() {
  footerY=getY(document.getElementById('footer'));
  documentHeight=document.body.clientHeight;

  if (documentHeight-footerY>document.getElementById('footer').clientHeight) {
    document.getElementById('footer').style.height=(documentHeight-footerY)+'px';
  }
  setTimeout('resizeFooter()',500);
}

function getY( oElement )
{
  var iReturnValue = 0;
  while( oElement != null ) {
    iReturnValue += oElement.offsetTop;
    oElement = oElement.offsetParent;
  }
  return iReturnValue;
}

