// JavaScript Document

function capaElemento(capa,opacidad)
{
	this.capa = document.getElementById(capa);
	this.crono = 0;
	this.nombre = capa;
	this.frecuencia = 0;
	this.opacity = 0;
	//aumento de cada aparicion
	this.opacidad = 0;
	
}






capaElemento.prototype.setTimer = function (timer) {
	this.crono = timer;
};


capaElemento.prototype.aparece = function (frecuencia,opacidad)
{
		this.frecuencia = frecuencia;
		this.opacidad = opacidad;
		this.appear();
};


// Fades out and clips away the FileProgress box.
capaElemento.prototype.appear = function () {
	
	
	var rate = this.frecuencia;	// 15 fps
	var addOpacityBy = this.opacidad;
	
	if (this.opacity < 100) {
		this.opacity += addOpacityBy;
		if (this.opacity > 100) {
			this.opacity = 100;
		}
		
		if (this.capa.filters) {
			try {
				this.capa.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;
			} catch (e) {
				// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
				this.capa.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + this.opacity + ")";
			}
		} else {
			this.capa.style.opacity = this.opacity / 100;
		}
	}

	if (this.opacity < 100) {
		var oSelf = this;
		this.setTimer(setTimeout(function () {
			oSelf.appear();
			}, rate));
	} else 
	{
		clearTimeout(this.crono);
		if(this.nombre == 'top')
		{
		document.getElementById('bannermalosera').style.display = 'block';
		document.getElementById('bannerfotogramasspot').style.display = 'block';
		}
		
		if(this.nombre == 'capacontenidocentral')
		{
				document.getElementById('elvideo').style.display = 'block';
				document.getElementById('bannermaloseraembotellado').style.display = 'block';


		}
		if(this.nombre == 'capafacebookcomentarios') 	document.getElementById('capaflashfondo').style.display = 'none';	


	}
	
};
