var movingMenu = Class.create
({
	pos : 0,
	
	menu : '',
	
	initialize : function (menu)
	{
		this.menu = menu;
		Event.observe (window, 'scroll', this.respond.bind (this));
	},

	respond : function (event)
	{
		// Work out pos difference
		offset	= $(this.menu).cumulativeScrollOffset ().top;
		diff	= offset - this.pos;
		this.pos += diff;
		
		new Effect.Move
		(
			this.menu,
			{
				x : 0,
				y : diff,
				transition: Effect.Transitions.linear,
				queue : 'end',
				duration : 0.2
			}
		);
	}
});

menu = new movingMenu ('side-bar');

