function loadXMLDoc(dname) 
{
try //Internet Explorer
  {
  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  }
catch(e)
  {
  try //Firefox, Mozilla, Opera, etc.
    {
    xmlDoc=document.implementation.createDocument("","",null);
    }
  catch(e) {alert(e.message)}
  }
try 
  {
  xmlDoc.async=false;
  xmlDoc.load(dname);
  return(xmlDoc);
  }
catch(e) {alert(e.message)}
return(null);
}

function getElementsByXPath(xml, xpath)
{
  var aNodeList = [];
  if (xml.ownerDocument.evaluate)
  {
    var node;
    var result = xml.ownerDocument.evaluate(xpath, xml, null, XPathResult.ANY_TYPE, null);
    while ((node = result.iterateNext()))
    {
      aNodeList.push(node);
    }
  }
  else if (window.ActiveXObject)
  {
    xml.ownerDocument.setProperty("SelectionLanguage", "XPath");
    var nodes = xml.selectNodes(xpath);
    for (var nI = 0; nI < nodes.length; nI++)
    {
      aNodeList.push(nodes[nI]);
    }
  }
  else
  {
    alert('getElementsByXPath: Your browser can\'t handle this script');
  }
  return aNodeList;
}