    function DOC(id) {
      return document.getElementById(id);
    }

    function sizeContent() {
      MIN_WIDTH = 340;

      MainTable = DOC("mainTable");
      ContentCell = DOC("content");
      RightCell = DOC("rightSpace");

      bHideRightPane = (DOC("HideRightPane") != null);

      bWidthIsSmall = bHideRightPane || ((MainTable.clientWidth - DOC("topImage").width * 2) < MIN_WIDTH);

      bRightIsVisible = RightCell.style.display == "";

      if (bWidthIsSmall != bRightIsVisible) return;
      if (bWidthIsSmall) {
//        RightCell.style.visibility = "hidden";
        RightCell.style.display = "none";
        ContentCell.colSpan = 2;
        ContentCell.style.paddingRight = "30px";
      } else {
        ContentCell.colSpan = 1;
//        RightCell.style.visibility = "";
        RightCell.style.display = "";
        ContentCell.style.paddingRight = "0";
      }
    }

    function doLoad() {
      TopImage = DOC("topImage");
      BarImage = DOC("rightBar");
      BarImage.width = TopImage.width;
      DOC("Epigraph").width = 2; // avoid Firefox bug

      sizeContent();
      if (window.customDoLoad) customDoLoad();
    }

function getEventRow() {
  var row = event ? event.srcElement : null;
  while (row)
    switch (row.tagName) {
      case "TR" : return row; break;
      case "TABLE" : return null; break;
      default : row = row.parentElement;
    }
  return null;
}

function SwitchRowBGColor(bgColor) {
  var row = getEventRow();
  if (row && row.style) row.style.backgroundColor = bgColor; /* #d0ffd0'*/;
}

function RestoreRowBGColor() {
  var row = getEventRow();
  if (row && row.style && row.style.removeAttribute)
    row.style.removeAttribute('backgroundColor');
  else
    row.style.backgroundColor = ''; // to do: use backup instead
}
