// DESHABILITA BOTON DERECHO DEL RATON

var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")

// PRECARGA DE IMAGENES

var i
var imagenes = new Array("boton_h.gif","boton_izq_h.gif","carritoN.gif","cPresentacion.jpg","pPresentacion.png","fPresentacion.jpg","cCavas.jpg","pCavas.png","fCavas.jpg","cEmbutidos.jpg","pEmbutidos.png","fEmbutidos.jpg","cBodega.jpg","pBodega.png","fBodega.jpg","cTienda.jpg","pTienda.png","fTienda.jpg","cContactar.jpg","pContactar.png","fContactar.jpg")
var lista_imagenes = new Array() 

for(i in imagenes)
{ 
	lista_imagenes[i] = new Image() 
	lista_imagenes[i].src = 'clipart/imagenes/' + imagenes[i]
}

// CAMBIO DE IMAGENES DE CABECERA Y PIE

//Devuelve la referencia de la capa
function getElement(nombreCapa,nombrePadre)
{

	(document.layers) ? nn4=true : nn4=false;
	(document.all) ? ie=true : ie=false;
	(document.getElementById) ? dom=true : dom=false;
	if (ie)
		return document.all[nombreCapa];

	if (dom)
		return document.getElementById(nombreCapa);

	if (nn4)
	{
		//Si no se pasa el parámetro nombrePadre, este será el nombre
		//de la capa a buscar
		nombrePadre = (nombrePadre)? nombrePadre : self;
		//Definimos una variable que referencia la colección de capas
		layerColeccion = nombrePadre.document.layers;
		//Si la capa se encuentra en esta colección devolvemos su
		//referencia
		if (layerColeccion[nombreCapa])
		return layerColeccion[nombreCapa];
		//Si la capa no se encuentra en la colección actual, mientras existan
		//capas, entramos en estas y buscamos la capa en cada una de las
		//colecciones de estas
		for(i=0; i < layerColeccion.length;)
		return(getElement(nombreCapa, layerColeccion[i++]));
	}
}

//Cambia la imagen
function cambiaImagen(nombreCapa,nombreImagen)
{
   //Recuperamos la referencia a la capa
   var capa = getElement(nombreCapa);

   if (nn4)
     capa.backgroundImage = 'url(clipart/imagenes/' + nombreImagen + ')';
   else
     capa.style.backgroundImage = 'url(clipart/imagenes/' + nombreImagen + ')';
}

// CAMBIO DE IMAGENES DE MENU

function carroA ()
{
	document.getElementById("carro").setAttribute("src","clipart/imagenes/carrito.gif")
}

function carroN ()
{
	document.getElementById("carro").setAttribute("src","clipart/imagenes/carritoN.gif")
}

function carroA1 ()
{
	document.getElementById("carro1").setAttribute("src","clipart/imagenes/carrito.gif")
}

function carroN1 ()
{
	document.getElementById("carro1").setAttribute("src","clipart/imagenes/carritoN.gif")
}

// Cerrar popUp
function cierraPop()
{
   //Recuperamos la referencia a la capa
   var capa = getElement('popUp');

   if (nn4)
     capa.visibility = 'hide';
   else
     capa.style.visibility = 'hidden';
}

// Abrir popUp
function abrePop()
{
   //Recuperamos la referencia a la capa
   var capa = getElement('popUp');

   if (nn4)
     capa.visibility = 'show';
   else
     capa.style.visibility = 'visible';
}

// AVISO WEB EN CONSTRUCCION

function enConstruccion ()
{
	alert('Estamos trabajando para ofrecerles esta web al completo.\nGracias por su comprensión.\n\nPara más información, por favor, CONTACTE con nosotros.');
}