window.onload = windowOnLoad;

function windowOnLoad()
{
  if (document.getElementById("loadmessage")) 
    document.getElementById("loadmessage").innerHTML = 
      "<a id=\"messagelink\" href=\"index.htm\">* Closed Until Further Notice. *</a>";
}

function go(n)
{
  if (n == "menu") document.location.href = n + ".htm";
  else document.location.href = n + ".htm";
}

function processReqChange() 
{
  // iff req state is "complete" - all other states are tossed out and ignored
  if (xml_http_req.readyState == 4) 
  {
    // iff "OK"
    if (xml_http_req.status == 200) 
    {
      var response = xml_http_req.responseXML.documentElement;
      
      var action = response.getElementsByTagName('action')[0].firstChild.data;
      var result = response.getElementsByTagName('result')[0];
      
      if (action == "alert") alert(result.firstChild.data);
      else eval(action + '(result)');
    } 
    // else ignore any errors
  }
}

// url must contain a URL that returns an xml document with two child elements:
// action - the name of a callback javascript function
// result - the value of the xml response that will be returned (as an argument) to the callback javascript function
//          (value is an XML node object)
function loadXMLDoc(url) 
{
  // branch for native XMLHttpRequest object
  if (window.XMLHttpRequest) 
  {
    xml_http_req = new XMLHttpRequest();
    xml_http_req.onreadystatechange = processReqChange;
    xml_http_req.open("GET", url, true);
    xml_http_req.send(null);
  } 
  // branch for IE/Windows ActiveX version
  else if (window.ActiveXObject) 
  {
    xml_http_req = new ActiveXObject("Microsoft.XMLHTTP");
    if (xml_http_req) 
    {
      xml_http_req.onreadystatechange = processReqChange;
      xml_http_req.open("GET", url, true);
      xml_http_req.send();
    }
  }
}

function fade_in(eid, r, g, b, i)
{
  var e = document.getElementById(eid);
  
  e.style.color = "rgb(" + r + "," + g + "," + b + ")";
  if (i != 0) setTimeout("fade_in(\"" + eid + "\", " + r + ", " + g + ", " + b + ", " + i + ")", 20);
}

