function xmlPost(url, toSend, responseHandler)
{
  xmlOpen("POST", url, toSend, responseHandler);
}

function xmlGet(url, responseHandler)
{
  xmlOpen("GET", url, null, responseHandler);
}

function xmlOpen(method, url, toSend, responseHandler)
{
  if (window.XMLHttpRequest)
  {
    // browser has native support for XMLHttpRequest object
    req = new XMLHttpRequest();
  }
  else if (window.ActiveXObject)
  {
    // try XMLHTTP ActiveX (Internet Explorer) version
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
    
  if(req)
  {
    req.onreadystatechange = responseHandler;
    req.open(method, url, true);
    req.setRequestHeader("content-type","application/x-www-form-urlencoded");
    req.send(toSend);
  }
  else
  {
    alert('Your browser does not seem to support XMLHttpRequest.');
  }
}

function getNode(parent, tagName)
{
  var i;
  var max = parent.childNodes.length;
  alert('getNode(): max = ' + max);
    
  // Check each child node
  for(i = 0; i < max; i++)
  {
    if(parent.childNodes[i].tagName)
    {
      alert('getNode(): parent.childNodes[i].tagName = ' + parent.childNodes[i].tagName);
      if(parent.childNodes[i].tagName.toUpperCase() == tagName.toUpperCase())
      {
        // We found a matching child node; return it.
        return parent.childNodes[i];
      }
    }
  }
  // One was not found; return null
  return null;
}

function getNodesWithKey(parent, tagName, key)
{
  var i;
  var cellNodes = parent.getElementsByTagName(tagName);
  var max = cellNodes.length;
    
  // Check each cell node for the specified value for
  // the 'key' attribute
  for(i = 0; i < max; i++)
  {
    if(cellNodes[i].getAttribute('key') == key)
    {
      // We found a matching cell node; return it.
      return cellNodes[i];
    }
  }
  // One was not found; return null
  return null;
}
