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