/* See http://soren.lund.org/site.js
 *
 * Site modifications:
 *
 * 2006-09-05:
 *
 * The menu id was renamed side1 and the menu.inc file is now leftmenu.inc
 *
 * Prepended last modification date with 'on '
 *
 */

function render() {
  putUrl('side1', 'leftmenu.inc');
  putStr('date', 'on ' + this.document.lastModified);
}

function putStr(id, str) {
  var element = document.getElementById(id);
  if (!element) {
    return;
  }
  element.innerHTML = str;
}

function putUrl(id, url) {
  var req = getXmlHttpReq();
  if (req) {
    // Synchronous request, wait till we have it all
    req.open('GET', url, false);
    req.send(null);
    putStr(id, req.responseText);
  } else {
    putStr(id, "Sorry, your browser does not support " +
               "XMLHTTPRequest objects. This page requires " +
               "Internet Explorer 5 or better for Windows, " +
               "or Firefox for any system, or Safari. Other " +
  	       "compatible browsers may also exist.");
  }
}

function getXmlHttpReq() {
  var req = false;

  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
  return req;
}


