;(function($j){var URI=location.href.replace(/#.*/,'');var $jlocalScroll=$j.localScroll=function(settings){$j('body').localScroll(settings)};$jlocalScroll.defaults={duration:1000,axis:'y',event:'click',stop:true};$jlocalScroll.hash=function(settings){settings=$j.extend({},$jlocalScroll.defaults,settings);settings.hash=false;if(location.hash)setTimeout(function(){scroll(0,location,settings)},0)};$j.fn.localScroll=function(settings){settings=$j.extend({},$jlocalScroll.defaults,settings);return(settings.persistent||settings.lazy)?this.bind(settings.event,function(e){var a=$j([e.target,e.target.parentNode]).filter(filter)[0];a&&scroll(e,a,settings)}):this.find('a').filter(filter).bind(settings.event,function(e){scroll(e,this,settings)}).end().end();function filter(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,'')==URI&&(!settings.filter||$j(this).is(settings.filter))}};function scroll(e,link,settings){var id=link.hash.slice(1),elem=document.getElementById(id)||document.getElementsByName(id)[0];if(elem){e&&e.preventDefault();var $jtarget=$j(settings.target||$j.scrollTo.window());if(settings.lock&&$jtarget.is(':animated')||settings.onBefore&&settings.onBefore.call(link,e,elem,$jtarget)===false)return;if(settings.stop)$jtarget.queue('fx',[]).stop();$jtarget.scrollTo(elem,settings).trigger('notify.serialScroll',[elem]);if(settings.hash)$jtarget.queue(function(){location=link.hash})}}})(jQuery);
