var SmoothScroll=Fx.SmoothScroll=new Class({Extends:Fx.Scroll,options:{axes:["x","y"]},initialize:function(options,context){context=context||document;this.doc=context.getDocument();this.parent(this.doc,options);var win=context.getWindow(),location=win.location.href.match(/^[^#]*/)[0]+"#",links=$$(this.options.links||this.doc.links);links.each(function(link){if(link.href.indexOf(location)!=0){return}var anchor=link.href.substr(location.length);if(anchor){this.useLink(link,anchor)}},this);this.addEvent("complete",function(){win.location.hash=this.anchor;this.element.scrollTo(this.to[0],this.to[1])},true)},useLink:function(link,anchor){link.addEvent("click",function(event){var el=document.id(anchor)||this.doc.getElement("a[name="+anchor+"]");if(!el){return}event.preventDefault();this.toElement(el,this.options.axes).chain(function(){this.fireEvent("scrolledTo",[link,el])}.bind(this));this.anchor=anchor}.bind(this));return this}});