function addLoadEvent(func) 
{
  var oldonload = window.onload;

  if (typeof window.onload != 'function') 
  {
    window.onload = func;
  } 
  else 
  {
    window.onload = function() 
    {
    oldonload();
    func();
    }
  }
}

function getWindowHeight()
{
  var A=0;
  
  if( typeof (window.innerHeight)=="number")
  {
    A=window.innerHeight
  }
  else
  {
    if(document.documentElement&&document.documentElement.clientHeight)
    {
      A=document.documentElement.clientHeight
    }
    else
    {
      if(document.body&&document.body.clientHeight)
      {
        A=document.body.clientHeight
      }
    }
  }
return A;
}
function setFooter()
{
  if(document.getElementById)
  {
    var D=getWindowHeight();
    if(D>0)
    {
      var C=document.getElementById("container").offsetHeight;
      var A=document.getElementById("footer");
      var B=A.offsetHeight;
      
      if(D-(C+B)>=0)
      {
        A.style.position="relative";A.style.top=(D-(C+B))+"px"
      }
      else
      {
        A.style.position="static"
      }
    }
  }
}
window.addLoadEvent(setFooter);

window.onresize=function(){setFooter()};