(function(c){function h(a,e,b){var d=e.hash.slice(1);if(d=document.getElementById(d)||document.getElementsByName(d)[0]){a&&a.preventDefault();var f=c(b.target||c.scrollTo.window());if(!(b.lock&&f.is(":animated")||b.onBefore&&b.onBefore.call(e,a,d,f)===false)){b.stop&&f.queue("fx",[]).stop();f.scrollTo(d,b).trigger("notify.serialScroll",[d]);b.hash&&f.queue(function(){location=e.hash})}}}var i=location.href.replace(/#.*/,""),g=c.localScroll=function(a){c("body").localScroll(a)};g.defaults={duration:1E3, axis:"y",event:"click",stop:true};g.hash=function(a){a=c.extend({},g.defaults,a);a.hash=false;location.hash&&setTimeout(function(){h(0,location,a)},0)};c.fn.localScroll=function(a){function e(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,"")==i&&(!a.filter||c(this).is(a.filter))}a=c.extend({},g.defaults,a);return a.persistent||a.lazy?this.bind(a.event,function(b){var d=c([b.target,b.target.parentNode]).filter(e)[0];d&&h(b,d,a)}):this.find("a").filter(e).bind(a.event,function(b){h(b, this,a)}).end().end()}})(jQuery);
