var xmlHttp1;
var xmlHttp2;
var xmlHttp3;

function checkLNP(str, func, sel, xmlHttpIndex)
{ 

  if (str != "")
	sel.selectedIndex = 0;

var url="/checkdid.php";
url=url+"?did="+str;

if ( xmlHttpIndex == 1 )
{
	xmlHttp1=GetXmlHttpObject();
	xmlHttp = xmlHttp1;
}
else if ( xmlHttpIndex == 2 )
{
	xmlHttp2=GetXmlHttpObject();
	xmlHttp = xmlHttp2;
}
else if ( xmlHttpIndex == 3 )
{
	xmlHttp3=GetXmlHttpObject();
	xmlHttp = xmlHttp3;
}

if (xmlHttp == null )
 {
 alert ("Browser does not support HTTP Request");
 return;
 }

	xmlHttp.onreadystatechange=func;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);


}

function getRates(country)
{ 

var url="/getrates.php";
url=url+"?country="+country;

xmlHttp1=GetXmlHttpObject();
xmlHttp = xmlHttp1;

if (xmlHttp == null )
 {
 alert ("Browser does not support HTTP Request");
 return;
 }

	xmlHttp.onreadystatechange = stateChanged_r;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged_r() 
{ 
if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")
 { 
 	document.getElementById("rate_box").innerHTML = xmlHttp1.responseText;
 } 
}


function stateChanged_1() 
{ 
if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")
 { 
 	document.getElementById("didHint_1").innerHTML = xmlHttp1.responseText;
 } 
}

function stateChanged_2() 
{ 
if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
 { 
 	document.getElementById("didHint_2").innerHTML = xmlHttp2.responseText;
 } 
}

function stateChanged_3() 
{ 
if (xmlHttp3.readyState==4 || xmlHttp3.readyState=="complete")
 { 
 	document.getElementById("didHint_3").innerHTML = xmlHttp3.responseText;
 } 
}


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;
}