// JavaScript Document
var imagenes=0;
var pos=0;

function animarImg(){//REVISAR
	var imag=window.document.getElementById("animProducto");
	var path;
	if	(imagenes.length>0){
		oscurecer(1);
		imag.src=imagenes[++pos]
		idTimeouts.push(setTimeout("animarImg()",2000));
		}
	}
	
function animarDiv(obj,inc,asta,direc){
	var objec=window.document.getElementById(obj);
	if (direc==1)
		inc=eval(inc)+10;
	else
		inc=eval(inc)-10;
	objec.style.height=inc;
	
	if (direc==1) {
		objec.style.visibility="visible";
		if (inc<asta)
			idTimeouts.push(setTimeout("animarDiv('"+obj+"',"+inc+","+asta+","+direc+")",20));
		}
	else{
		if (inc>asta){
			idTimeouts.push(setTimeout("animarDiv('"+obj+"',"+inc+","+asta+","+direc+")",20));
			}
		else{ 
			objec.style.visibility="hidden";
			}
		}
	}

function mostrarImg(img,destino){
	oscurecer(0.1);
	var imag=window.document.getElementById(destino);
	imag.style.cssText="opacity:1";
	imag.src=img;
}

function oscurecer(ini,img){
		var imagen=null;
		if (img)
			imagen=window.document.getElementById(img);
		else
			imagen=window.document.getElementById("animProducto");
		ini=imagen.style.opacity;
		ini=(ini-0.1);
		estilo=imagen.style;
		if (estilo.length>2){//Es un DIV
			estilo.opacity=ini;
			}
		else
			imagen.style.cssText="opacity:"+ini;
		if (ini!=0)
			ini=(ini-0.1);
		if (ini>0){
			idTimeouts.push(window.setTimeout("oscurecer("+ini+",'"+img+"')",100));
			}
		if (ini<0){
			idTimeouts.push(window.setTimeout("oscurecer(0,'"+img+"')",1000));
			}
	}
