var objekxhr;
var objekxhr2;

function ambildatasearch(Nama,HalamanCount,Halaman,Tempat,anim){
	buatxhr();
	nama=encodeURIComponent(document.getElementById(Nama).value);
	objekxhr.open("GET", Halaman + nama, true);
	objekxhr.send(null);
	objekxhr.onreadystatechange=function (){
		$(anim).fadeIn(400).html('<img src="img/ajax-loader.gif" align="absmiddle">');
		document.getElementById(Tempat).innerHTML = null;
		document.getElementById(Tempat).innerHTML = objekxhr.responseText;
	}
	
	objekxhr2.open("GET", HalamanCount + nama, true);
	objekxhr2.send(null);
	objekxhr2.onreadystatechange=function (){
		document.getElementById("count").innerHTML = null;
		document.getElementById("count").innerHTML = objekxhr2.responseText;
	}
}

function buatxhr(){
	if (window.ActiveXObject){
		objekxhr = new ActiveXObject("Microsoft.XMLHTTP");
		objekxhr2 = new ActiveXObject("Microsoft.XMLHTTP");
	}else if (window.XMLHttpRequest){
		objekxhr=new XMLHttpRequest();
		objekxhr2=new XMLHttpRequest();
	}else{
		alert("Tidak support");
	}
}

