var delta=0.15
var collection;

function floaters() {
    this.items = [];
    this.addItem = function(id,x,y){
		
        var newItem = {};
        newItem.object = document.getElementById(id);
        newItem.x = x;
        newItem.y = y;
        
        this.items[this.items.length] = newItem;
    }
    
    this.play = function(){
        collection = this.items
        setInterval('play()',10);
    }  
}
function play(){
    for(var i=0;i<collection.length;i++){
        collection[i].object.style.display = 'block';
        collection[i].object.style.visibility='visible';
    }
    
    for(var i=0;i<collection.length;i++){
   
        var scrollLeft,scrollTop;
        
        if (window.pageYOffset){
        	scrollTop = window.pageYOffset
        }else if (document.documentElement && document.documentElement.scrollTop){
        	scrollTop = document.documentElement.scrollTop;
        }else if (document.body){
            scrollTop = document.body.scrollTop;
        }
        
        if (window.pageXOffset){
        	  scrollLeft = window.pageXOffset
        }else if (document.documentElement && document.documentElement.scrollLeft){
        	scrollLeft = document.documentElement.scrollLeft;
        }else if (document.body){
        	  scrollLeft = document.body.scrollLeft;
        }
    
        var followObj = collection[i].object;
        
        var followObj_x = parseInt(document.documentElement.clientWidth/2)+283;
        var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
		if (document.documentElement.scrollTop < 252)
		{
			followObj_y = 252 - document.documentElement.scrollTop;
		}
		
        if(followObj.offsetLeft!=(scrollLeft+followObj_x)) {
            var dx=(scrollLeft+followObj_x-followObj.offsetLeft)*delta;
            dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
            followObj.style.left=followObj.offsetLeft+dx+'px';
        }
        if(followObj.offsetTop!=(scrollTop+followObj_y)) {
            var dy=(scrollTop+followObj_y-followObj.offsetTop)*delta;
            dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
            followObj.style.top=followObj.offsetTop+dy+'px';
        }
		
        followObj.style.display = 'block';
    }
    for(var i=0;i<collection.length;i++){
        collection[i].object.style.display = 'block';
        collection[i].object.style.visibility='visible';
    }
} 