var xmlHttp
var xmlHttp2

function MatchSelectedStreet(matches) {
 var strName = document.getElementById("street");
 strName.value = matches.options[matches.selectedIndex].text;
 document.getElementById("streetsearch").innerHTML="";
 document.getElementById("streetsearch").style.border="0px";
}

function showResultStreet(str){
if (str.length==0){ 
	document.getElementById("streetsearch").innerHTML="";
	document.getElementById("streetsearch").style.border="0px";
	return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
	alert ("Browser does not support HTTP Request")
	return
} 
var url="components/com_electiondb/search.php?task=getStreets&q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedStreet
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

function stateChangedStreet(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		document.getElementById("streetsearch").innerHTML=xmlHttp.responseText;
		document.getElementById("streetsearch").style.border="1px solid #A5ACB2";
	} 
}



function MatchSelectedAccount(matches) {
 var account = document.getElementById("account");
 account.value = matches.options[matches.selectedIndex].text;
 document.getElementById("accountsearch").innerHTML="";
 document.getElementById("accountsearch").style.border="0px";
}

function showResultAccount(str){
if (str.length==0){ 
	document.getElementById("accountsearch").innerHTML="";
	document.getElementById("accountsearch").style.border="0px";
	return
}
xmlHttp2=GetXmlHttpObject2()
if (xmlHttp2==null){
	alert ("Browser does not support HTTP Request")
	return
} 
var url="components/com_electiondb/search.php?task=getAccount&q="+str
url=url+"&sid="+Math.random()
xmlHttp2.onreadystatechange=stateChangedaccount
xmlHttp2.open("GET",url,true)
xmlHttp2.send(null)
} 

function stateChangedaccount(){ 
	if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete"){ 
		document.getElementById("accountsearch").innerHTML=xmlHttp2.responseText;
		document.getElementById("accountsearch").style.border="1px solid #A5ACB2";
	} 
}




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 GetXmlHttpObject2(){
  var xmlHttp2=null;
  try{
    // Firefox, Opera 8.0+, Safari
    xmlHttp2=new XMLHttpRequest();
    }catch (e){
    // Internet Explorer
    try{
      xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
      }catch (e){
      xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp2;
}
