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;
}

// FUNCION QUE SE EJECUTA CUANDO SE TECLEA ALGO EN LA CAJA DE BUSQUEDA

function busqueda_producto()
{
	var busqueda = document.getElementById("texto_busqueda").value;
			
	c = document.getElementById('contenido'); // Antes el div era resultado

	ajax=objetoAjax();
 	ajax.open("POST", "modulos/resultado_busqueda.php",true);
	ajax.onreadystatechange=function()
	{
		if (ajax.readyState==4)
		{
			c.innerHTML = ajax.responseText
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("busqueda="+busqueda);
}

// FUNCION QUE MUESTRA TODOS LOS ARTICULOS DE UN FABRICANTE

function articulos_fabricante(fabricante)
{
			
	c = document.getElementById('contenido'); // Antes el div era resultado

	ajax=objetoAjax();
 	ajax.open("POST", "modulos/resultado_busqueda.php",true);
	ajax.onreadystatechange=function()
	{
		if (ajax.readyState==4)
		{
			c.innerHTML = ajax.responseText
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("fabricante="+fabricante);
}
