function floater()
{
	this.collection	= [];
	this.close = false;
	this.delta = 0.8;
	this.addItem = function(id,x,y,content)
		  {
            var pageW;
            var pageH;
            if (document.documentElement.clientWidth && document.documentElement.clientWidth<document.body.clientWidth)
            {
                pageW = 'document.documentElement.clientWidth';
            }
            else
            {
                pageW = 'document.body.clientWidth';
            }
            if (document.documentElement.clientHeight && document.documentElement.clientHeight<document.body.clientHeight)
            {
                pageH = 'document.documentElement.clientHeight';
            }
            else
            {
                pageH = 'document.body.clientHeight';
            }
            
            if (typeof(x)=='string')
            {
			    x = x.replace('clientWidth',pageW);
			}
			if (typeof(y)=='string')
			{
			    y = y.replace('clientHeight',pageH);
			}
			
			document.write('<div id="' + id + '" style="z-index:10; position:absolute; width:10px; height:10px; left:' + (typeof(x)=='string'?eval(x):x) + 'px; top:' + (typeof(y)=='string'?eval(y):y) + 'px">' + content + '</div>');
			var newItem = {};
			newItem.object = document.getElementById(id);
			newItem.x = x;
			newItem.y = y;
			this.collection[this.collection.length] = newItem;
		  }
	this.play = function(fixY)
		  {
            var _this = this;
            var playFloater = function(){ _this.playFloater(fixY); };
			window.setInterval(playFloater,30);
		  }
    this.playFloater = function(fixY)
         {
	        if(screen.width<=800 || this.close)
	        {
		        for(var i=0;i<this.collection.length;i++)
		        {
			        this.collection[i].object.style.display	= 'none';
		        }
		        return;
	        }
	        for(var i=0;i<this.collection.length;i++)
	        {
                var pageX;
                var pageY;
                if (document.documentElement && document.documentElement.scrollTop)
                {
                    pageX = document.documentElement.scrollLeft;
                    pageY = document.documentElement.scrollTop;
                }
                else if (document.body)
                {
                    pageX = document.body.scrollLeft;
                    pageY = document.body.scrollTop;
                }
                else
                {
                    pageX = window.pageXOffset;
                    pageY = window.pageYOffset;
                }

		        var followObj = this.collection[i].object;
		        var followObj_x = (typeof(this.collection[i].x)=='string'?eval(this.collection[i].x):this.collection[i].x);
		        var followObj_y = (typeof(this.collection[i].y)=='string'?eval(this.collection[i].y):this.collection[i].y);
		        if(followObj.offsetLeft!=(pageX+followObj_x))
		        {
			        var dx=(pageX+followObj_x-followObj.offsetLeft)*this.delta;
			        dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
			        followObj.style.left=followObj.offsetLeft+dx+'px';
		        }
		        if(!fixY && followObj.offsetTop!=(pageY+followObj_y))
		        {
			        var dy=(pageY+followObj_y-followObj.offsetTop)*this.delta;
			        dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
			        followObj.style.top=followObj.offsetTop+dy+'px';
		        }
		        followObj.style.display	= '';
	        }
         }	
	this.stop = function()
		  {
            this.close = true;
		  }
}
