var xmlHttp
var xmlHttp2

function MatchSelectedStreet(matches) {
 var strName = document.getElementById("strname");
 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_taxdata_payment/search.php?task=getSearch&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 MatchSelectedValue(matches) {
 var search = document.getElementById("search");
 search.value = matches.options[matches.selectedIndex].text;
 document.getElementById("searchValues").innerHTML="";
 document.getElementById("searchValues").style.border="0px";
}

function showResultSearch(str,evt){
	if (str.length==0){ 
		document.getElementById("searchValues").innerHTML="";
		document.getElementById("searchValues").style.border="0px";
		return
	}
	var key = (evt.which) ? evt.which : evt.keyCode;
	if(key == 40){
		document.getElementById("matchesValue").focus();
		document.getElementById("matchesValue").options[0].selected=true;
		//document.getElementById("matchesValue").selectedindex=0;
	}else{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="components/com_taxdata_payment/search.php?task=getsearch&q="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChangedSearch
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
} 
function checkDownSearch(evt){
	var key = (evt.which) ? evt.which : evt.keyCode;
	if(key == 40){
		document.getElementById("matchesValue").focus();
		document.getElementById("matchesValue").options[0].selected=true;
		//document.getElementById("matchesValue").selectedindex=0;
	}
}
function checkUpSearch(evt){
		var key = (evt.which) ? evt.which : evt.keyCode;
		if(key == 38){
			if(document.getElementById("matchesValue").options[0].selected==true){
				document.getElementById("search").focus();
			}
		}else if(key == 13){
			MatchSelectedValue(document.getElementById("matchesValue"));
			document.taxform.submit();
		}
}
function stateChangedSearch(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		document.getElementById("searchValues").innerHTML=xmlHttp.responseText;
		document.getElementById("searchValues").style.border="1px solid #A5ACB2";
	} 
}




function MatchSelectedName(matches) {
 var name = document.getElementById("name");
 name.value = matches.options[matches.selectedIndex].text;
 document.getElementById("searchName").innerHTML="";
 document.getElementById("searchName").style.border="0px";
}

function showResultName(str){
if (str.length==0){ 
	document.getElementById("searchName").innerHTML="";
	document.getElementById("searchName").style.border="0px";
	return
}
xmlHttp2=GetXmlHttpObject2()
if (xmlHttp2==null){
	alert ("Browser does not support HTTP Request")
	return
} 
var url="components/com_taxdata_payment/search.php?task=getName&q="+str
url=url+"&sid="+Math.random()
xmlHttp2.onreadystatechange=stateChangedaccount
xmlHttp2.open("GET",url,true)
xmlHttp2.send(null)
} 
function stateChangedName(){ 
	if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete"){ 
		document.getElementById("searchName").innerHTML=xmlHttp2.responseText;
		document.getElementById("searchName").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;
}
