(function(b){var a="1.2";var d=c(location.pathname);b.fn.extend({scrollable:function(){var f=[],e=false;this.each(function(){if(this==document||this==window){return}var g=b(this);if(g.scrollTop()>0){f=[this];return false}g.scrollTop(1);e=g.scrollTop()>0;g.scrollTop(0);if(e){f=[this];return false}});return this.pushStack(f)},smoothScroll:function(e){var f=b.extend({},b.fn.smoothScroll.defaults,e);this.die("click.smoothscroll").live("click.smoothscroll",function(h){var q=this,p=b(this),m=((location.hostname===q.hostname)||!q.hostname),g=f.scrollTarget||(c(q.pathname)||d)===d,o=q.hash&&"#"+q.hash.replace("#",""),i=true;if(!f.scrollTarget&&(!m||!g||o.length==1)){i=false}else{var j=f.exclude,s=0,k=j.length;while(i&&s<k){if(p.is(j[s++])){i=false}}var n=f.excludeWithin,l=0,r=n.length;while(i&&l<r){if(p.closest(n[l++]).length){i=false}}}if(i){f.scrollTarget=f.scrollTarget||o;f.link=q;h.preventDefault();b.smoothScroll(f)}});return this}});b.smoothScroll=function(g,h){var j,f,i="offset";if(typeof g==="number"){j=b.fn.smoothScroll.defaults;f=g}else{j=b.extend({},b.fn.smoothScroll.defaults,g||{});if(j.scrollElement){i="position";if(j.scrollElement.css("position")=="static"){j.scrollElement.css("position","relative")}}f=h||(b(j.scrollTarget)[i]()&&b(j.scrollTarget)[i]()[j.direction])||0}j=b.extend({link:null},j);var l=j.scrollElement||b("html, body").scrollable(),k={top:"Top",left:"Left"},e={};e["scroll"+k[j.direction]]=f+j.offset;l.animate(e,{duration:j.speed,easing:j.easing,complete:function(){if(j.afterScroll&&b.isFunction(j.afterScroll)){j.afterScroll.call(j.link,j)}}})};b.smoothScroll.version=a;b.fn.smoothScroll.defaults={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,afterScroll:null,easing:"swing",speed:400};function c(e){return e.replace(/^\//,"").replace(/(index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")}})(jQuery);
