/** * jquery.localscroll - animated scrolling navigation, using anchors. * copyright (c) 2007-2009 ariel flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com * dual licensed under mit and gpl. * date: 3/11/2009 * @author ariel flesler * @version 1.2.7 **/ ;(function($){var l=location.href.replace(/#.*/,'');var g=$.localscroll=function(a){$('body').localscroll(a)};g.defaults={duration:1e3,axis:'y',event:'click',stop:true,target:window,reset:true};g.hash=function(a){if(location.hash){a=$.extend({},g.defaults,a);a.hash=false;if(a.reset){var e=a.duration;delete a.duration;$(a.target).scrollto(0,a);a.duration=e}i(0,location,a)}};$.fn.localscroll=function(b){b=$.extend({},g.defaults,b);return b.lazy?this.bind(b.event,function(a){var e=$([a.target,a.target.parentnode]).filter(d)[0];if(e)i(a,e,b)}):this.find('a,area').filter(d).bind(b.event,function(a){i(a,this,b)}).end().end();function d(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,'')==l&&(!b.filter||$(this).is(b.filter))}};function i(a,e,b){var d=e.hash.slice(1),f=document.getelementbyid(d)||document.getelementsbyname(d)[0];if(!f)return;if(a)a.preventdefault();var h=$(b.target);if(b.lock&&h.is(':animated')||b.onbefore&&b.onbefore.call(b,a,f,h)===false)return;if(b.stop)h.stop(true);if(b.hash){var j=f.id==d?'id':'name',k=$(' ').attr(j,d).css({position:'absolute',top:$(window).scrolltop(),left:$(window).scrollleft()});f[j]='';$('body').prepend(k);location=e.hash;k.remove();f[j]=d}h.scrollto(f,b).trigger('notify.serialscroll',[f])}})(jquery);