function loadXMLDoc(dname)   //cross-browser function to load an XML document, "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
   {

       var ua = navigator.userAgent.toLowerCase();
       if (ua.indexOf('safari/') != -1){ //user is reporting as Safari, use XMLHttpRequest instead.
          XmlHTTP = new XMLHttpRequest();
          XmlHTTP.open("get", dname, false);
          XmlHTTP.send("");
          var xDoc = XmlHTTP.responseXML;
          return xDoc;
       }else{

         xmlDoc.async=false;
         xmlDoc.load(dname);
         return(xmlDoc); 

      }

   }
   catch(e) {alert(e.message)}
   return(null);
} 