
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////


TEfectos.aEfectos = new Array ();
TEfectos.Moz      = navigator.userAgent.indexOf("Gecko") > -1;

TEfectos.prototype._iBordes    = 0;
TEfectos.prototype._iDireccion = -1;
TEfectos.prototype._iHeight    = 0;
TEfectos.prototype._sId        = '';
TEfectos.prototype._iInterval  = 0;
TEfectos.prototype.Incremento  = 10;
TEfectos.prototype.Timer       = 10;
TEfectos.prototype.onTerminar  = function () { };


TEfectos.prototype._ClearInterval = function ()
{
	var self = this;

	clearInterval (this._iInterval);
	this._iInterval = 0;
	this._iDireccion *= -1;
	self.onTerminar (self);
}


TEfectos.prototype._getHeight = function (Elemento)
{
	var Vis = Elemento.style.visibility;
	var Dis = Elemento.style.display;
	var Res = 0;

	if (Dis != 'none' && Dis != '') return Elemento.offsetHeight;
	Elemento.style.visibility = 'hidden';
	Elemento.style.display    = 'block';
	Res = parseInt (Elemento.offsetHeight);
	Elemento.style.visibility = Vis;
	Elemento.style.display    = Dis;
	return Res;
}


TEfectos.prototype.Vertical = function ()
{
	if (this._oElemento)
	{	this._oElemento.style.overflow = 'hidden';
		if (! this._iHeight) this._iHeight = this._getHeight (this._oElemento);
		if (this._iInterval) this._ClearInterval ();
		else
		{	if (this._oElemento.style.display != 'block' && this._oElemento.style.display != '')
			{	this._oElemento.style.height = '1px';
				this._oElemento.style.display = 'block';
				this._iDireccion = 1;
				this._iBordes = this._oElemento.offsetHeight - 1;
			}
		}
		this._iInterval = setInterval ('TEfectos.aEfectos ["' + this._sId + '"]._Vertical ()', this.Timer);
	}
}


TEfectos.prototype._Vertical = function ()
{
	var Alt = this._oElemento.offsetHeight;	


	if (this._iDireccion > 0)
	{	if (Alt < this._iHeight)
		{	Alt += this.Incremento - this._iBordes;
			Alt = Alt > this._iHeight ? this._iHeight : Alt;
			this._oElemento.style.height = Alt + 'px';
//		Div.style.opacity = (v/Div.MaxHeight);
//		Div.style.filter = 'alpha(opacity=' + (v * 100/Div.MaxHeight) + ');'
		} else 
		{	this._oElemento.style.height = 'auto';
			this._ClearInterval ();
		}
	} else
	{	if (Alt > 0)
		{	Alt = Alt - (this.Incremento + this._iBordes);
			if (Alt <= 0)
			{	this._oElemento.style.height = '1px';
				this._oElemento.style.display = 'none';
			} else this._oElemento.style.height = Alt + 'px';
		} else this._ClearInterval ();
	}
}


function TEfectos (sId)
{
	this._sId       = sId;
	this._oElemento = document.getElementById (sId);
}


function idEfecto (sId)
{
	if (! TEfectos.aEfectos [sId]) TEfectos.aEfectos [sId] = new TEfectos (sId);
	return TEfectos.aEfectos [sId];
}


///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////







