/*****************************************************************************
Presentación de Imágenes3 (SlideShow) por Tunait! 6/agosto/03
Actualizado el 28/12/2003
Si quieres usar este script en tu sitio eres libre de hacerlo con la condición de que permanezcan intactas estas líneas, osea, los créditos.

http://javascript.tunait.com
tunait@yahoo.com 
******************************************************************************/
var segundos = 20 //cada cuantos segundos cambia la imagen







var dire = "src/img_up" //directorio o ruta donde están las imágenes




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

var iex = navigator.appName=="Microsoft Internet Explorer" ? true : false;
var fi = iex?'filters.alpha.opacity':'style.MozOpacity'
function presImagen(){
	document.foto.src = document.foto2.src
	eval('document.foto.' + fi + ' = iex?100:1;')
	eval('document.foto2.' + fi + ' = 0')
	document.foto2.src= dire + imagenes[nro_foto_mostrar]

	//tiempo=window.setTimeout('Opacidad()',segundos*1000)
}
var opa = iex ? 100 : 1;
var opa2 = 0
function Opacidad(){
	if(opa >= 0){
		cambia()
		opa -= iex?10:0.1
		setTimeout('Opacidad()',10)
	}
	else{
	opa = iex?100:1;
		presImagen()
	}
}
function cambia(){
	opaci = iex?100 : 1
	eval('document.foto.' + fi + ' = opa')
	eval('document.foto2.' + fi + ' = (opaci-opa)')
}

var tiempo
var nro_foto_mostrar = 0;
function inicio(inicio_nro_foto_mostrar){
    nro_foto_mostrar = inicio_nro_foto_mostrar;
	clearTimeout(tiempo);
	presImagen();
	Opacidad();
	document.getElementById('noticia_destacada_categoria').innerHTML = categorias[inicio_nro_foto_mostrar];
	document.getElementById('noticia_destacada_titulo').innerHTML = titulos[inicio_nro_foto_mostrar];
	document.getElementById('noticia_destacada_copete').innerHTML = copetes[inicio_nro_foto_mostrar];
	document.getElementById('noticia_destacada_link').href = links[inicio_nro_foto_mostrar];
	tiempo = window.setTimeout('inicio_auto()',segundos*1000);
}
function inicio_auto() {
    if (nro_foto_mostrar + 1 <= imagenes.length - 1) {
        nro_foto_mostrar = nro_foto_mostrar + 1;
    } else {
        nro_foto_mostrar = 0;
    }
	inicio(nro_foto_mostrar);
}
function escribe(){
	document.writeln('<img src="' + dire + imagenes[nro_foto_mostrar] + '" name="foto2" id="foto2" style="-moz-opacity:0" class="img_central"> ')
	document.writeln(' <img src="' + dire + imagenes[nro_foto_mostrar] + '" name="foto" id="foto" class="img_central">')
}

document.writeln ('<style type="text/css">')
document.writeln ('#foto {')
if(iex){
	document.writeln ('filter: alpha(opacity=100);')
}
document.writeln ('position:absolute;}')
document.writeln ('#foto2 {')
if(iex){
	document.writeln ('filter: alpha(opacity=0);')
}
document.writeln ('position:absolute;}')
document.writeln ('</style>')

tiempo = window.setTimeout('inicio_auto()',segundos*1000);