var xmlHttp
function typeSearch(str1) // function to display clients info
{ 
xmlHttp=GetXmlHttpObject() // opening the xmlHttpObject
var url="typesearch.php?search="+str1 //this code sends the query string to clients.php
xmlHttp.onreadystatechange=stateTypeSearch 
xmlHttp.open("GET",url,true) // method of sending data. in this case 'GET'
xmlHttp.send(null) // function sending data
}
//
function showState(str1) // function to display clients info
{ 
xmlHttp=GetXmlHttpObject() // opening the xmlHttpObject
var url="states.php?country_id="+str1 //this code sends the query string to clients.php
xmlHttp.onreadystatechange=stateChangedStates 
xmlHttp.open("GET",url,true) // method of sending data. in this case 'GET'
xmlHttp.send(null) // function sending data
}
//
function showOtherState() // function to display clients info
{ 
xmlHttp=GetXmlHttpObject() // opening the xmlHttpObject
var url="otherstate.php" //this code sends the query string to clients.php
xmlHttp.onreadystatechange=stateChangedStates 
xmlHttp.open("GET",url,true) // method of sending data. in this case 'GET'
xmlHttp.send(null) // function sending data
}
//
function showCity(str1) // function to display clients info
{ 
xmlHttp=GetXmlHttpObject() // opening the xmlHttpObject
var url="cities.php?state_id="+str1 //this code sends the query string to clients.php
xmlHttp.onreadystatechange=stateChangedcities 
xmlHttp.open("GET",url,true) // method of sending data. in this case 'GET'
xmlHttp.send(null) // function sending data
}
//
function showOtherCity() // function to display clients info
{ 
xmlHttp=GetXmlHttpObject() // opening the xmlHttpObject
var url="othercity.php" //this code sends the query string to clients.php
xmlHttp.onreadystatechange=stateChangedcities 
xmlHttp.open("GET",url,true) // method of sending data. in this case 'GET'
xmlHttp.send(null) // function sending data
}
//
function showAdminStates(str1) // function to display clients info
{ 
xmlHttp=GetXmlHttpObject() // opening the xmlHttpObject
var url="admin_states.php?country_id="+str1 //this code sends the query string to clients.php
xmlHttp.onreadystatechange=stateChangedAdminStates 
xmlHttp.open("GET",url,true) // method of sending data. in this case 'GET'
xmlHttp.send(null) // function sending data
}
//
function saveSearch() // function to display clients info
{ 
xmlHttp=GetXmlHttpObject() // opening the xmlHttpObject
var url="excelfile.php" //this code sends the query string to clients.php
xmlHttp.onreadystatechange=stateSaveSearch 
xmlHttp.open("GET",url,true) // method of sending data. in this case 'GET'
xmlHttp.send(null) // function sending data
}
//
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=300,left = 450,top = 250');");
}
//
function stateTypeSearch() // function setting the processing state
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") // if process is completed
 { 
 document.getElementById("typesearch").innerHTML=xmlHttp.responseText // do this
 } 
 if (xmlHttp.readyState==1) // if process is still progressing
 { 
  document.getElementById("typesearch").innerHTML="<div style='background-color:#FFFF00; width:134px; '><img src='../images/indicator.gif'>Searching...</div>";
} 
}
//
function stateChangedStates() // function setting the processing state
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") // if process is completed
 { 
 document.getElementById("state").innerHTML=xmlHttp.responseText // do this
 } 
 if (xmlHttp.readyState==1) // if process is still progressing
 { 
  document.getElementById("state").innerHTML="<img src='images/indicator.gif'>Loading states...";
} 
}
//
function stateChangedcities() // function setting the processing state
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") // if process is completed
 { 
 document.getElementById("city").innerHTML=xmlHttp.responseText // do this
 } 
 if (xmlHttp.readyState==1) // if process is still progressing
 { 
  document.getElementById("city").innerHTML="<img src='images/indicator.gif'>Loading cities...";
} 
}
//
function stateChangedAdminStates() // function setting the processing state
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") // if process is completed
 { 
 document.getElementById("admin_states").innerHTML=xmlHttp.responseText // do this
 } 
 if (xmlHttp.readyState==1) // if process is still progressing
 { 
  document.getElementById("admin_state").innerHTML="<img src='images/indicator.gif'>Loading states...";
} 
}
//
function stateSaveSearch() // function setting the processing state
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") // if process is completed
 { 
 document.getElementById("savesearch").innerHTML=xmlHttp.responseText // do this
 } 
 if (xmlHttp.readyState==1) // if process is still progressing
 { 
  document.getElementById("savesearch").innerHTML="<div style='background-color:#FFFF00; width:134px; opacity:70'><img src='../images/ajaxload.gif'>Saving search...</div>";
} 
}
//
function GetXmlHttpObject() // function checking if browser supports xmlHttpRequest
{
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;
}
