// JavaScript Document
function Fade(id,op,minOp,maxOp)
{
	if(typeof id != 'undefined')
		this.id = id;
	if(typeof op != 'undefined')
		this.op = op;
	if(typeof minOp != 'undefined')
		this.minOp = minOp;
	if(typeof maxOp != 'undefined')
		this.maxOp = maxOp;
	this.start();
}

Fade.prototype = {

	id : '',
	milisec : 50,
	_outInterval : '',
	minOp : 0,
	maxOp : 100,
	opacity : 0,
	init	: function(){},
	fadeOut	: function() {},
	fadeIn	: function(){}

}

Fade.prototype.start = function(){
	
	this.init = function(){
		<!-- Recupera a qtd de tabelas inseridas -->
		this.stop();	
		var obj = this;
		var fnc;
		
		if(this.opacity > this.minOp)
			fnc = 'fadeOut()';
		else
			fnc = 'fadeIn()';
		
		this._outInterval = setInterval(function (){ eval('obj.'+fnc); },this.milisec);		
	}
	
	this.stop = function(){
		clearInterval(this._outInterval);
	}
	
	this.fadeOut = function()
	{	
		document.getElementById(this.id).style.filter = 'alpha(opacity='+this.opacity+')';
		this.opacity-=3;
		if(this.opacity <= this.minOp-15)
			this.stop();
	}
	
	this.fadeIn	= function()
	{
		document.getElementById(this.id).style.filter = 'alpha(opacity='+this.opacity+')';
		this.opacity+=3;
		if(this.opacity >= this.maxOp)
			this.stop();
	}
}