(function(a){var d=location.href.replace(/#.*/,""),b=a.localScroll=function(b){a("body").localScroll(b)};b.defaults={duration:1e3,axis:"y",event:"click",stop:true,target:window,reset:true};b.hash=function(d){if(location.hash){d=a.extend({},b.defaults,d);d.hash=false;if(d.reset){var e=d.duration;delete d.duration;a(d.target).scrollTo(0,d);d.duration=e}c(0,location,d)}};a.fn.localScroll=function(e){e=a.extend({},b.defaults,e);return e.lazy?this.bind(e.event,function(b){var d=a([b.target,b.target.parentNode]).filter(f)[0];d&&c(b,d,e)}):this.find("a,area").filter(f).bind(e.event,function(a){c(a,this,e)}).end().end();function f(){return !!this.href&&!!this.hash&&this.href.replace(this.hash,"")==d&&(!e.filter||a(this).is(e.filter))}};function c(f,h,b){var d=h.hash.slice(1),c=document.getElementById(d)||document.getElementsByName(d)[0];if(!c)return;f&&f.preventDefault();var e=a(b.target);if(b.lock&&e.is(":animated")||b.onBefore&&b.onBefore.call(b,f,c,e)===false)return;b.stop&&e.stop(true);if(b.hash){var g=c.id==d?"id":"name",i=a("<a> </a>").attr(g,d).css({position:"absolute",top:a(window).scrollTop(),left:a(window).scrollLeft()});c[g]="";a("body").prepend(i);location=h.hash;i.remove();c[g]=d}e.scrollTo(c,b).trigger("notify.serialScroll",[c])}})(jQuery);