function Moving(queue, timestep, delta)
{
	// Delay in milliseconds between each update.
	this.Timestep = timestep;
	var _this = this; // capture current context
	this.Directions = [];
	queue.Apply(function (o, i, l) 
		{ 
			_this.Directions[i] = Math.PI*2*i/l; 
			// Make sure it is positioned where it is
			var point = Node.FindPoint(o);
			o.style.left = point.X + "px";
			o.style.top = point.Y + "px";

			// Put on top
			o.style.zIndex = 2000;

			// Initialize the movement
			o.style.float = "none";
			o.style.position = "absolute";
		});

	this.Start = 
		function ()
		{
			queue.Apply(function (o,i,l) 
				{
					var dx = delta * Math.cos(_this.Directions[i]);
					var dy = delta * Math.sin(_this.Directions[i]);
					var point = Node.FindPoint(o);
					o.style.left = (point.X + dx) + "px";
					o.style.top = (point.Y + dy) + "px";
					_this.KeepInside(o, i);
				});
			setTimeout (_this.Start, _this.Timestep);
		};
		
	// Adjust direction if it extends beyond border
	// In: Element o: Element to adjust direction of
	this.KeepInside = function(o, i)
		{
			if (o.offsetLeft < 0) // hit left border
			{
				_this.Directions[i] = (_this.Directions[i] > Math.PI ? 1.5 * Math.PI : 0) + Math.PI * Math.random() / 2 ;
			}
			else if (o.offsetTop < 0) // hit top border
			{
				_this.Directions[i] = (_this.Directions[i] > 3 * Math.PI / 2 ? 0 : 0.5 * Math.PI) + Math.PI * Math.random() / 2 ;
			}
			else if (o.offsetLeft + o.offsetWidth > Browser.InnerWidth()) // hit right border
			{
				_this.Directions[i] = (_this.Directions[i] < Math.PI / 2 ? 0.5 * Math.PI : Math.PI) + Math.PI * Math.random() / 2 ;
			}
			else if (o.offsetTop + o.offsetHeight > Browser.InnerHeight()) // hit bottom border
			{
				_this.Directions[i] = (_this.Directions[i] > Math.PI / 2 ? Math.PI : 1.5 * Math.PI) + Math.PI * Math.random() / 2 ;
			}
		}
}
