function getLeft(node) {
  var x = 0;
  var parent = node;
  while(parent && parent.tagName != "BODY" && parent.tagName != "HTML") {
    x += parent.offsetLeft;
    parent = parent.offsetParent;
  }
  return x;
}
function getTop(node) {
  var x = 0;
  var parent = node;
  while(parent && parent.tagName != "BODY" && parent.tagName != "HTML") {
    x += parent.offsetTop;
    parent = parent.offsetParent;
  }
  return x;
}
function getBottom(node) {
  return getTop(node) + node.offsetHeight;
}
function getRight(node) {
  return getLeft(node) + node.offsetWidth;
}

function positionLayers() {
  var tp = document.getElementById("topPane");
  var mn = document.getElementById("menu");
  var cp = document.getElementById("contentPane");
  var width = parseInt(document.body.offsetWidth);
  tp.style.width = width + "px";
  tp.style.left = "0px"; tp.style.top = "0px";
  mn.style.left = "0px"; mn.style.top = getBottom(tp) + "px";
  tp.style.visibility = "visible"; mn.style.visibility = "visible";
  x = getRight(mn);
  y = getBottom(tp);
  cp.style.left = x + 10 + "px" ;
  cp.style.top  = y + 15 + "px" ;
  var height = parseInt(document.body.offsetHeight);
  cp.style.width  = width -  x - 12 + "px";
  cp.style.height = height - y - 27 + "px";
  cp.style.visibility = "visible";
}

window.onresize = positionLayers;

function loadContent(filename, desc) {
  var status = document.getElementById("location");
  var cp = document.getElementById("contentPane");
  cp.src = filename;
  status.innerHTML = desc;
}