JSFX.FloatingLayer = function(theDiv, x, y)
{
	//Call the superclass constructor
	this.superC = JSFX.Layer;
	this.superC(JSFX.findLayer(theDiv), x, y);

	this.baseX = x;
	this.baseY = y;
	this.x = x;
	this.y = y;
	this.moveTo(x,y);
	this.show();

}
JSFX.FloatingLayer.prototype = new JSFX.Layer;

JSFX.FloatingLayer.prototype.animate = function()
{
	var targetX;
	var targetY;
	if(this.baseX > 0)
		targetX = JSFX.Browser.getMinX() + this.baseX;
	else
		targetX = JSFX.Browser.getMaxX() + this.baseX;

	if(this.baseY > 0)
		targetY = JSFX.Browser.getMinY() + this.baseY;
	else
		targetY = JSFX.Browser.getMaxY() + this.baseY;

	var dx = (targetX - this.x)/8;
	var dy = (targetY - this.y)/8;
//	this.x += dx;
	this.y += dy;

	this.moveTo(this.x, this.y);
}
JSFX.MakeFloatingLayer = function(theDiv, x, y)
{
	JSFX.MakeFloatingLayer.floaters[JSFX.MakeFloatingLayer.floaters.length] = new JSFX.FloatingLayer(theDiv, x, y);
}
JSFX.MakeFloatingLayer.floaters = new Array();
JSFX.MakeFloatingLayer.animate = function()
{
	var i;
	for(i=0 ; i<JSFX.MakeFloatingLayer.floaters.length ; i++)
		JSFX.MakeFloatingLayer.floaters[i].animate();
}
setInterval("JSFX.MakeFloatingLayer.animate()", 20);
