function xmlhttp(){
	var xmlhttp;
	try{xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
	catch(e){
		try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
		catch(e){
			try{xmlhttp = new XMLHttpRequest();}
			catch(e){
				xmlhttp = false;
			}
		}
	}
	if (!xmlhttp) 
		return null;
	else
		return xmlhttp;
}

function buscarUsuarios(){
	var query = document.getElementById('q').value;
	var A = document.getElementById('resultados');
	var B = document.getElementById('loading');
	var ajax = xmlhttp();
	ajax.open("GET","themes/PortonArtesano/ajax/buscador-usuarios-ajax.php?q="+encodeURIComponent(query),true);
	ajax.onreadystatechange=function(){
		if(ajax.readyState==1){
			B.innerHTML = "<img src='themes/PortonArtesano/ajax/imagenes/cargando-buscador.gif' alt='cargando...'>";
		}
		if(ajax.readyState==4){
			A.innerHTML = ajax.responseText;
			B.innerHTML = "";
		}
		if(ajax.readyState==0){
			A.innerHTML = "";
			B.innerHTML = "";
		}
	}
	NoCache = parseInt(Math.random()*999999999999999);//EVITAMOS EL CACHE DEL NAVEGADOR
	ajax.send(null);
	return false;
}
function killBox(dato) {
	document.getElementById('q').value = dato;
	document.getElementById('resultados').innerHTML = ""; 
	observerOnclick = 'click';
}
