// AJAX - funciones para evitar recarga
var xmlHttp;
var div_destino;
	
function crearXMLHttpRequest(){
	if(window.ActiveXObject){
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	}
}
	
function getQueryBuscar(){
	var texto = escape(document.getElementById("texto").value);

	var query = "texto=" + texto;
	
	return query;
}	

function buscar_en_sitio(div, url){
	div_destino = div;
	crearXMLHttpRequest();
	var queryString = getQueryBuscar();
	xmlHttp.open("POST", url, true);
	xmlHttp.onreadystatechange = manejadorRespuesta;
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.send(queryString); 
}
	
function manejadorRespuesta(){
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			document.getElementById(div_destino).innerHTML = xmlHttp.responseText;
		}
	}
}