Walkable = Class.create();
Walkable.prototype =
{
	initialize: function(container)
	{
		this.container = $(container);
		this.currentAction = null;
		buttons = $$("a.button");
		for (i=0; i<buttons.length; i++)
			Event.observe(buttons[i], "click", this.clickCallback.bindAsEventListener(this), true);
	},
	
	clickCallback: function(event)
	{
		Event.stop(event);
		element = $(Event.findElement(event, "a").readAttribute("href").split("#").last());
		if (element)
		{
			if (this.currentAction)
				this.currentAction.cancel();
			this.currentAction = new Effect.Move(this.container,
			{
				x: -parseInt(element.offsetLeft),
				y: -parseInt(element.offsetTop),
				mode: "absolute",
				afterFinish: this.killCurrentAction.bind(this)
			});
		}
	},
	
	killCurrentAction: function()
	{
		delete this.currentAction;
	}
}
