ColorFade = function(idSniffer)
{
	this.snifferElement = idSniffer;
	this.anim_in = new Array();
	this.anim_out = new Array();
}

ColorFade.prototype.addItem = function(id, origColor, overColor, time)
{
	var noeud = document.getElementById(id);

	if(noeud != undefined)
	{
		var attributes = { 
			backgroundColor: { to: overColor } 
		}; 
		var anim = new YAHOO.util.ColorAnim(noeud, attributes, time);
		var overStr = new String(overColor);
		anim.wsPointeurFct = (overStr.substring(0,1) != "#");
		anim.wsCouleur = overColor;
		this.anim_in.push(anim);
		
		attributes = { 
			backgroundColor: { to: origColor } 
		}; 
		var animOut = new YAHOO.util.ColorAnim(noeud, attributes, time); 
		var origStr = new String(origColor);
		animOut.wsPointeurFct = (origStr.substring(0,1) != "#");
		animOut.wsCouleur = origColor;
		this.anim_out.push(animOut);
	}
}

ColorFade.prototype.fadeIn = function()
{
/*
	var p = document.createElement("p");
	p.innerHTML = "fadeIn";
	document.getElementById("fullTest").appendChild(p);	
	*/
	for(var i = 0; i < this.anim_in.length; i++)
	{
		
		this.anim_in[i].stop();
		this.anim_out[i].stop();
		if(this.anim_in[i].wsPointeurFct == true)
		{
			this.anim_in[i].attributes.backgroundColor = { to: this.anim_in[i].wsCouleur() };
		}
		else
		{
			this.anim_in[i].attributes.backgroundColor = { to: this.anim_in[i].wsCouleur };
		}
		this.anim_in[i].animate();
	}
}

ColorFade.prototype.fadeOut = function()
{
	/*
	var p = document.createElement("p");
	p.innerHTML = "fadeOut";
	document.getElementById("fullTest").appendChild(p);	
	*/
	for(var i = 0; i < this.anim_out.length; i++)
	{
		this.anim_in[i].stop();
		this.anim_out[i].stop();
		if(this.anim_out[i].wsPointeurFct == true)
		{
			this.anim_out[i].attributes.backgroundColor = { to: this.anim_out[i].wsCouleur() };
		}
		else
		{
			this.anim_out[i].attributes.backgroundColor = { to: this.anim_out[i].wsCouleur };
		}
		this.anim_out[i].animate();
	}
}