function preCargaImg(imageURL) {
		image = new Image();
		image.src = imageURL;
		return image;
}

function CambiarImg(buttonName,pos) 
 {
  
  var maximo=parseInt(document.imagen.max.value);
  if ((maximo+1) != 0)
  {
   var indice=parseInt(document.imagen.valor.value);
   if (pos==2 && indice < maximo)
	 indice++;
   else	
	 {
	  if (pos==1 && indice!= 0)
	   indice--;
     } 
   sourceImage= preCargaImg(arr_imagens[indice]);
   document[buttonName].src = sourceImage.src;
   document.imagen.valor.value=indice;
   var w=eval(arr_imagens_w[indice]);
   var h=eval(arr_imagens_h[indice]);
  }
 else
  alert ('No hay fotos disponibles');   
}

function muestra_imagen(){ 
  var maximo=parseInt(document.imagen.max.value);
  if ((maximo+1) != 0)
   {
    var indice=parseInt(document.imagen.valor.value);
    archivo=arr_imagens[indice];
    alto=arr_imagens_h[indice];
    ancho=arr_imagens_w[indice];
   
    xWidth ('ampliacion',ancho + 6) 
    xHeight ('ampliacion',alto + 6 + 20) 
    xWidth ('c1',ancho) 
    xHeight ('c1',alto) 
   
    xWidth ('cerrarampliacion',ancho) 
    xInnerHtml('c1','<img src="' + archivo + '" width="' + ancho + '" height="' + alto + '" border="0">') 
    xShow('ampliacion'); 
  }	
 else
  alert ('No hay fotos disponibles');   
 
} 

function cerrar_ampliacion(){ 
   xHide('ampliacion'); 
} 
