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