var xmlHttp;
function search_loc(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
 
var url="/index.php/dating/locationquery";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged_one;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged_one() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("stateprov").innerHTML=xmlHttp.responseText;
 } 
}

function search_city(str,id_country)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
 
var url="/index.php/dating/cityquery";
url=url+"?q="+str+"&id_country="+id_country;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged_two;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged_two() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("state_city").innerHTML=xmlHttp.responseText;
 } 
}

function search_prov(str,id_country,id_prov)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
 
var url="/index.php/dating/province";
url=url+"?q="+str+"&id_country="+id_country+"&id_prov="+id_prov;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged_three;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged_three() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("prov_ince").innerHTML=xmlHttp.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;
}
