var xmlHttp 

function showUser(snum,sname)
{

xmlHttp = new GetXmlHttpObject() ;
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="getservices.php";
url=url+"?snum="+snum+"&sname="+sname;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
 xmlDoc=xmlHttp.responseXML;
 document.getElementById("phone").innerHTML = xmlDoc.getElementsByTagName("dp")[0].childNodes[0].nodeValue;
 document.getElementById("internet").innerHTML = xmlDoc.getElementsByTagName("di")[0].childNodes[0].nodeValue;
 document.getElementById("tv").innerHTML = xmlDoc.getElementsByTagName("dtv")[0].childNodes[0].nodeValue;
 
 if(xmlDoc.getElementsByTagName("address")[0].childNodes[0].nodeValue !=0){
	 
	     		
		 if(xmlDoc.getElementsByTagName("phone")[0].childNodes[0].nodeValue > 0){}else{
				 document.getElementById("phone").innerHTML = '<ul><li><span class="">Novus Digital Phone service not available at this time. For more information call 604.642.6688.</span></li></ul>';
				 }
		 if(xmlDoc.getElementsByTagName("internet")[0].childNodes[0].nodeValue > 0){}else{
				  document.getElementById("internet").innerHTML = '<ul><li><span class="">Novus Internet service not available at this time. For more information call 604.642.6688. </span></li></ul>';
				 }
		 if(xmlDoc.getElementsByTagName("analogue")[0].childNodes[0].nodeValue > 0){}else{
				  document.getElementById("tv").innerHTML = '<ul><li><span class="">Novus TV service not available at this time. For more information call 604.642.6688.</span> </li></ul>';
				 }
		
		 document.getElementById("bName").innerHTML = '<strong>Services are available in <span class="promo">'+ xmlDoc.getElementsByTagName("bName")[0].childNodes[0].nodeValue + ", " + xmlDoc.getElementsByTagName("address")[0].childNodes[0].nodeValue+"</span></stront>";
 }else{
	document.getElementById("bName").innerHTML ='<div class="promo"><strong>Services are not available at this address.</strong></div>'
}
}
} 
//document.getElementById("cable").innerHTML = xmlHttp.responseXML.getElementsByTagName('cable')[0].firstChild.data;
//document.getElementById("internet").innerHTML=xmlHttp.responseXML.getElementsByTagName('internet')[0].firstChild.data;
//document.getElementById("phone").innerHTML=xmlHttp.responseXML.getElementsByTagName('phone')[0].firstChild.data;


function GetXmlHttpObject()
 { 
 var objXMLHttp=null
 if (window.XMLHttpRequest)
  {
  objXMLHttp=new XMLHttpRequest()
  }
 else if (window.ActiveXObject)
  {
  objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
 return objXMLHttp
 }
 

