function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false; 
	try 
	{ 
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 
		try
		{ 
			// Creacion del objet AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!="undefined") { xmlhttp=new XMLHttpRequest(); } 

	return xmlhttp; 
}

function showProduct(productRef)
{
	// Obtengo el div donde se mostraran las advertencias y errores
	var productDiv=document.getElementById("producto");
	var ajax=nuevoAjax();

	ajax.open("POST", "../productos/showProduct.php", true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("productRef="+productRef);
	
	ajax.onreadystatechange=function()
	{
		if(ajax.readyState==1){
           productDiv.innerHTML = "Cargando...";
           //modificamos el estilo de la div, mostrando una imagen de fondo
           prodcutDiv.style.background = "url('../images/ajax-preloader.gif') no-repeat";
        } 
		if (ajax.readyState==4)
		{
			// Muestro el mensaje enviado desde el servidor			
			productDiv.innerHTML=ajax.responseText;
		}
	}
	
}