function animacion ()
{
	this.opac = 0.0;
	this.opac2 = 1.0;
	this.rtcod = 0;
	this.rtcod2 = 0;
	this.timeout = 40;
	
	this.img1 = "";
	this.img2 = "";
}
function opacidad(elem,valor)
{
	//alert(elem.id);
	elem.style.filter="alpha(opacity="+valor*100+")";
	elem.style.MozOpacity=valor;
	elem.style.opacity=valor;
}
function anim_in()
{
	/*if(this.opac == 0.0)
		this.img1.style.display="block";*/
	this.opacidad(this.img1,this.opac);
	this.opac += 0.1;
	if (this.opac < 1)
		this.rtcod = setTimeout('anim.anim_in();',this.timeout);
	else
	{
		this.opacidad(this.img1,1);
		this.opac = 0.0;
	}
	//alert('salgo');
}
function anim_out()
{
	this.opacidad(this.img2,this.opac2);
	this.opac2 -= 0.1;
	if (this.opac2 > 0)
		this.rtcod2 = setTimeout('anim.anim_out();',this.timeout);
	else
	{
		this.opacidad(this.img2,0);
		this.opac2 = 1.0;
		this.img2.style.display = "none";
	}
}
function reset()
{
	if (this.opac2 != 1.0 || this.opac != 0.0)
	{
		clearTimeout(this.rtcod);
		clearTimeout(this.rtcod2);
		//this.opacidad(this.img1,1);
		this.opac2 = this.opac;
		this.opac = 0.0;
		this.opacidad(this.img2,0);
		
	}
}
function start(foto)
{
	
	if (foto == this.img1.id)
	{
		return false;
	}
	else if (this.img1 != "" && this.img2 != "")
	{
		this.reset();
	}
	else
	{
		this.img1 = document.getElementById? document.getElementById('foto01') : document.all.foto01;
		this.opacidad(this.img1,1);
	}
	eval('this.img2 =document.getElementById? document.getElementById(\'' + this.img1.id + '\') : document.all.' + this.img1.id + ';');
	eval('this.img1 =document.getElementById? document.getElementById(\'' + foto + '\') : document.all.' + foto + ';');
	this.img1.style.display = "block";
	if (foto != this.img2.id)
	{
		this.anim_in();
		this.anim_out();
		//this.img2.style.display = "none";
	}
}
animacion.prototype.start=start;
animacion.prototype.opacidad=opacidad;
animacion.prototype.anim_in=anim_in;
animacion.prototype.anim_out=anim_out;
animacion.prototype.reset=reset;
