//browser specific code for requesting the XML

function loadXMLDoc(url,type)
{
xmlhttp=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=onResponse;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  newtype = type;
  }
else
  {
  alert("Your browser does not support XMLHTTP.")
  }
}

//Locations

function checkReadyState(obj)
{
 if(obj.readyState == 2)
	{
		 document.getElementById('copy').innerHTML="<div align=center>Loading...</div>"
	}
	
  if(obj.readyState == 4)
  {
    if(obj.status == 200)
    {
      return true;
    }
    else
    {
      alert("Problem retrieving XML data");
    }
  }
}

//builds the table from the XML request
function onResponse() 
{
  if(checkReadyState(xmlhttp))
  {
  var response = xmlhttp.responseXML.documentElement;
  //table headings
  //txt="<p align=center style=font-weight:bold;font-size:16px;>Select a location below for more information on product offerings.<p>"
  txt = "<table border=0 cellpadding=5 cellspacing=0 width=100% id=Locations><thead><tr class=clr2>"
  txt=txt + "<th>Name</th><th>Address</th><th>City</th><th>Zip</th><th>Phone</th><th>Fax</th>"
  txt=txt + "</tr></thead><tbody>"
  //top row used to set column widths
  txt=txt + "<tr><td height=5 width=100></td><td></td><td></td><td></td></tr>"
  //builds rest of table
  x=response.getElementsByTagName(newtype)
  for (i=0;i<x.length;i++)
    {
    txt=txt + "<tr>"
	xx=x[i].getElementsByTagName("id")
      {
      try
        {
        id= xx[0].firstChild.data
        }
      catch (er)
        {
        id=""
        }
      }
    xx=x[i].getElementsByTagName("name")
      {
      try
        {
        //txt=txt + "<td><a href=Builder.asp?LOC="+ id +" class=lk12>" + xx[0].firstChild.data + "</a></td>"
		txt=txt + "<td>" + xx[0].firstChild.data + "</td>"
        }
      catch (er)
        {
        txt=txt + "<td> </td>"
        }
      }
	xx=x[i].getElementsByTagName("street")
      {
      try
        {
        txt=txt + "<td>" + xx[0].firstChild.data + "</td>"
        }
      catch (er)
        {
        txt=txt + "<td> </td>"
        }
      }	  
    xx=x[i].getElementsByTagName("city")
      {
      try
        {
        txt=txt + "<td>" + xx[0].firstChild.data + "</td>"
        }
      catch (er)
        {
        txt=txt + "<td> </td>"
        }
      }
	   xx=x[i].getElementsByTagName("zip")
      {
      try
        {
        txt=txt + "<td>" + xx[0].firstChild.data + "</td>"
        }
      catch (er)
        {
        txt=txt + "<td> </td>"
        }
      }
    xx=x[i].getElementsByTagName("phone")
      {
      try
        {
        txt=txt + "<td>" + xx[0].firstChild.data + "</td>"
        }
      catch (er)
        {
        txt=txt + "<td> </td>"
        }
      }
	 
    xx=x[i].getElementsByTagName("fax")
      {
      try
        {
        txt=txt + "<td>" + xx[0].firstChild.data + "</td>"
        }
      catch (er)
        {
        txt=txt + "<td> </td>"
        }
      }
    /*xx=x[i].getElementsByTagName("directions")
      {
      try
        {
        txt=txt + "<td><a href=" + xx[0].firstChild.data + " class=lk16>Directions</a></td>"
        }
      catch (er)
        {
        txt=txt + "<td> </td>"
        }
      }	*/  
    txt=txt + "</tr><tr><td colspan=6><hr></td></tr></tbody>"
    }
  txt=txt + "</table>"
  //write table to the page
  document.getElementById('copy').innerHTML=txt
  }
}