function adjust_layout() {

  // Determine the window size (http://www.howtocreate.co.uk/tutorials/javascript/browserwindow)
  var w = 0, h = 0;
  if (typeof(window.innerWidth) == 'number') {
    // Non-IE
    w = window.innerWidth;
    h = window.innerHeight;
  } else if (document.documentElement &&
             (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
    // IE 6+ in standards-compliant mode
    w = document.documentElement.clientWidth;
    h = document.documentElement.clientHeight;
  } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
    // IE 4 compatible
    w = document.body.clientWidth;
    h = document.body.clientHeight;
  }

  // Resize the background image
  document.getElementById("bg").width=w;
  document.getElementById("bg").height=h-4;

  // Reposition the main links in a circular pattern
  var a = document.getElementsByTagName("a");
  var n = 0;
  for (i = 0; i < a.length; i++) {
    if (a[i].className == "link") ++n;
  }
  for (i = 0; i < a.length; i++) {
    if (a[i].className == "link") {
      t = (i - 0.2) * 6.283 / n;
      x = (Math.cos(t) * 0.47 + 0.5) * (w - 80) - a[i].clientWidth * 0.5 + 40;
      y = (Math.sin(t) * 0.5 + 0.5) * (h - 80) - a[i].clientHeight * 0.5 + 40;
      a[i].style.left = x + "px";
      a[i].style.top = y + "px";
    }
  }

  // Reposition the other elements
  document.getElementById("about").style.right="20px";
  document.getElementById("about").style.bottom="20px";
  document.getElementById("about").style.left="";
}