// JavaScript Document
var segundos = 3 //cada cuantos segundos cambia la imagen
var dire = "imagenes/02_fotos" //directorio o ruta donde están las imágenes

var imagenes=new Array()
imagenes[0]="1.jpg"
imagenes[1]="2.jpg"
imagenes[2]="3.jpg"
imagenes[3]="4.jpg"
imagenes[4]="5.jpg"
imagenes[5]="6.jpg"
imagenes[6]="7.jpg"
imagenes[7]="8.jpg"
imagenes[8]="9.jpg"

if(dire != "" && dire.charAt(dire.length-1) != "/")
{dire = dire + "/"}

var preImagenes = new Array()
for (pre = 0; pre < imagenes.length; pre++){
	preImagenes[pre] = new Image()
	preImagenes[pre].src = dire + imagenes[pre]
	}
cont=0
function presImagen(){
document.foto.src= dire + imagenes[cont]
subeOpacidad()
if (cont < imagenes.length-1)
	{cont ++}
else
	{cont=0}
tiempo=window.setTimeout('bajaOpacidad()',segundos*1000)
}
var iex = navigator.appName=="Microsoft Internet Explorer" ? true : false;
var fi = iex?'filters.alpha.opacity':'style.MozOpacity'
var opa = iex ? 100 : 1;
function bajaOpacidad(){
	opa = 0
	cambia()
presImagen()
}

function subeOpacidad(){
opaci = iex?100:1;
if(opa <= opaci){
	cambia()
	opa += iex?10: 0.1;
	setTimeout('subeOpacidad()',10)
	}
}
function cambia(){
eval('document.foto.' + fi + ' = opa')
}
var tiempo
function inicio(){
clearTimeout(tiempo)
bajaOpacidad()
}

var titulopordefecto = "Perico de los palotes"; //Si no se especifica un título al llamar a la función colocará el que se especifique aquí
var ventana;
var cont=0;

function afoto(cual,titulo)
{
if(cont==1){ventana.close();ventana=null}
if(titulo==null){titulo=titulopordefecto}
ventana=window.open('','ventana','resizable=yes,scrollbars=no')
ventana.document.write('<html><head><title>' + titulo + '</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no" onUnload="opener.cont=0"><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)">');
ventana.document.close();
cont++;
}
function redimensionar(ancho, alto)
{
ventana.resizeTo(ancho+12,alto+28);
ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2); //centra la ventana. Eliminar si no se quiere centrar el popup
}
