// JavaScript Document
function CheckAvailability()
{ 
 What='TelStatus'
 xmlHttp=GetXmlHttpObject()
 //alert(What)
 if (xmlHttp==null)
 {
  alert ("Browser does not support HTTP Request")
  return
  }
 var DomainName=document.getElementById("txtDomain").value; 
 var url="checkavail.php?domainname="+DomainName;
 document.getElementById("divTelStatus").innerHTML='Please wait ...';
 // alert(url)
xmlHttp.onreadystatechange=stateChanged 
 xmlHttp.open("GET",url,true)
 xmlHttp.send(null)
}
 
function FindDomains()
{ 
 What='Find'
// alert(What)
 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
 {
  alert ("Browser does not support HTTP Request")
  return
  }
 var DomainName=document.getElementById("txtDomain").value; 
 var url="finddomains.php?d="+DomainName;
 document.getElementById("divTelStatus").innerHTML='Please wait ...';
//  alert(url)
xmlHttp.onreadystatechange=stateChanged 
 xmlHttp.open("GET",url,true)
 xmlHttp.send(null)
}
 
function CheckWhois()
{ 
 What='Whois'
// alert(What)
 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
 {
  alert ("Browser does not support HTTP Request")
  return
  }
 var DomainName=document.getElementById("txtDomain").value; 
 var url="checkwhois.php?domain="+DomainName;
 document.getElementById("divTelStatus").innerHTML='Please wait ...';
//  alert(url)
xmlHttp.onreadystatechange=stateChanged 
 xmlHttp.open("GET",url,true)
 xmlHttp.send(null)
}
 
function stateChanged() 
{ 
//document.getElementById("txtScores").innerHTML=xmlHttp.readyState
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
//   alert(What)
//   alert(xmlHttp.readyState)
   document.getElementById("divTelStatus").innerHTML=xmlHttp.responseText
//   alert("Reached response.");
//   alert(xmlHttp.responseText);
//   alert(xmlHttp.getAllResponseHeaders());
 } 
}


function GetXmlHttpObject()
{
var xmlHttp=null;

try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }

return xmlHttp;
}

function Populate(url)
{
  document.getElementById("frame").src = 'http://hosted.telnic.org/cgi-bin/contact/contact.cgi?domain='+url
  document.getElementById("iframe").style.display='block';
}

