//footer
function footer()
{
  var h = windowHeight(), footer = $id('footer'), bottom = getY($id('bottom'))
  var fh = footer.clientHeight || footer.offsetHeight
  if (bottom != 0)
  {
    if (bottom < h - fh) footer.style.marginTop = ((h - fh) - bottom - 3) + 'px'
    else footer.style.marginTop = 0
  }
  footer.parentNode.style.visibility = 'visible'
}

// shorter names for grabbing stuff
function $id(id)
{
  return document.getElementById(id)
}
function $tags(t, o)
{
  o = o || document;
  return o.getElementsByTagName(t)
}
function $tag(t, o, i)
{
  o = o || document;
  return o.getElementsByTagName(t)[i || 0]
}

// get window size
function windowHeight()
{
  return self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0
}
function windowWidth()
{
  return self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0
}
// get pixel position of an object
function getY(o)
{
  var y = 0
  if (o.offsetParent) while (o.offsetParent)
  {
    y += o.offsetTop;
    o = o.offsetParent
  }
  return y
}
function getX(o)
{
  var x = 0
  if (o.offsetParent) while (o.offsetParent)
  {
    x += o.offsetLeft;
    o = o.offsetParent
  }
  return x
}