

var Instances = new Array();

function Effects(objName)
{
	this.obj = document.getElementById(objName);
	
	this.instanceID = Instances.length;
	Instances[this.instanceID] = this;
	
	if (document.all)
	{
		Effects.prototype.isIE = true;
	}
	else Effects.prototype.isIE = false;
	
	this.initialHeight = this.obj.style.height.replace("px","");
}

Effects.prototype.instanceID;
Effects.prototype.first = false;
Effects.prototype.isIE;
Effects.prototype.obj;
Effects.prototype.amount;
Effects.prototype.time;
Effects.prototype.self;
Effects.prototype.initialHeight;
Effects.prototype.opacity = 0;

Effects.prototype.decreaseFade = function()
{
	this.opacity -= this.amount;
	this.setOpacity(this.obj,this.opacity);
}

Effects.prototype.increaseFade = function()
{
	this.opacity += this.amount;
	this.setOpacity(this.obj,this.opacity);
}

Effects.prototype.setOpacity = function (object,opacity)
{
	if (object.style.filter)
	{
		object.style.filter = "alpha(opacity=" + Math.round(opacity*100).toString() + ")";
	}
	else if (object.style.MozOpacity)
	{
		object.style.MozOpacity = opacity;
	}
	else if (object.style.opacity)
	{
		object.style.opacity = opacity;
	}
	else if (object.style.Opacity)
	{
		object.style.Opacity = opacity;
	}
	else if (object.style.KhtmlOpacity)
	{
		object.style.KhtmlOpacity = opacity;
	
	}
	
}


Effects.prototype.fadeOut = function ()
{
	this.decreaseFade();
	
	if (this.opacity > 0)
	{
		setTimeout("Instances[" + this.instanceID + "].fadeOut()",this.time);
	}
	else 
	{
		this.obj.style.visibility = "hidden";
		
		this.setOpacity(this.obj,0);
	}
}

Effects.prototype.fadeIn = function ()
{
	if (this.obj.style.visibility == "hidden")
	{
			this.obj.style.visibility = "visible";
	}
	
	this.increaseFade();
	
	if (this.opacity < 1)
	{
		setTimeout("Instances[" + this.instanceID + "].fadeIn()",this.time);
	}
	else 
	{
		
		this.setOpacity(this.obj,1);
	}
}

Effects.prototype.cutVerticalOut = function ()
{
	var height = this.obj.style.height.replace("px","");
	
	if (height > 0)
	{
		this.obj.style.height = (height - this.amount).toString() + "px";
		setTimeout("Instances[" + this.instanceID + "].cutVerticalOut()",this.time);
	}
	else
	{
		this.obj.style.visibility = "hidden";
		this.obj.style.height = this.initialHeight + "px";
	}
}

Effects.prototype.cutVerticalIn = function ()
{
	
	if (this.obj.style.visibility == "hidden")
	{
			this.obj.style.visibility = "visible";
	}
	/*var height = Number(this.obj.style.height.replace("px",""));
	
	//if it is starting height, set to 0
	if ((height == this.initialHeight) && !this.first)
	{
		this.first = true;
		this.obj.style.height = "0px";
		height = 0;
		
	}
	
	if (height < this.initialHeight)
	{
		
		this.obj.style.height = (height + this.amount).toString() + "px";
		setTimeout("Instances[" + this.instanceID + "].cutVerticalIn()",this.time);
	}
	else
	{
		this.obj.style.visibility = "hidden";
		this.obj.style.height = this.initialHeight + "px";
	}*/
}
