// JavaScript Document
function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function focoEsencia() {
	document.buscarFamilia.familia.value='';
}

function pedirEsencia(){
	//nombre.style.backgroundColor="#EBEBEB" ;
	//donde se mostrará el resultado
	divResultado = document.getElementById('resultado');
	//tomamos el valor de los input text
	nom=document.buscarEsencia.esencia.value;
	url=location.href; //Url de la pagina para saber si seran esencias ella, el o ambientales 
	//instanciamos el objetoAjax
	ajax=objetoAjax();
	//usamos el medoto POST//archivo que realizará la operacion //consulta.php
	ajax.open("POST", "fileadmin/buscadorESENCIA/consultaEsencia.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divResultado.innerHTML = ajax.responseText
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
 ajax.send("esencia="+nom+"&url="+url);
}
