/*!
 * jQuery Smooth Scroll Plugin v1.3
 *
 * Date: Sat Nov 20 18:12:52 2010 -0500
 * Requires: jQuery v1.3+
 *
 * Copyright 2010, Karl Swedberg
 * Dual licensed under the MIT and GPL licenses (just like jQuery):
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 *
 *
 *
*/
(function(b){function k(d){return d.replace(/^\//,"").replace(/(index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")}var l=k(location.pathname);b.fn.extend({scrollable:function(){var d=[],c=false;this.each(function(){if(!(this==document||this==window)){var a=b(this);if(a.scrollTop()>0)d.push(this);else{a.scrollTop(1);c=a.scrollTop()>0;a.scrollTop(0);c&&d.push(this)}}});return this.pushStack(d)},firstScrollable:function(){return this.scrollable().eq(0)},smoothScroll:function(d){var c=b.extend({},b.fn.smoothScroll.defaults,
d);this.die("click.smoothscroll").live("click.smoothscroll",function(a){var e=b(this),f=location.hostname===this.hostname||!this.hostname,g=c.scrollTarget||(k(this.pathname)||l)===l,i=this.hash,h=true;if(!c.scrollTarget&&(!f||!g||!i))h=false;else{f=c.exclude;g=0;for(var j=f.length;h&&g<j;)if(e.is(f[g++]))h=false;f=c.excludeWithin;g=0;for(j=f.length;h&&g<j;)if(e.closest(f[g++]).length)h=false}if(h){c.scrollTarget=c.scrollTarget||i;c.link=this;a.preventDefault();b.smoothScroll(c)}});return this}});
b.smoothScroll=function(d,c){var a,e,f,g=0;e="offset";var i={};if(typeof d==="number"){a=b.fn.smoothScroll.defaults;f=d}else{a=b.extend({},b.fn.smoothScroll.defaults,d||{});if(a.scrollElement){e="position";a.scrollElement.css("position")=="static"&&a.scrollElement.css("position","relative")}f=c||b(a.scrollTarget)[e]()&&b(a.scrollTarget)[e]()[a.direction]||0}a=b.extend({link:null},a);if(a.scrollElement){e=a.scrollElement;g=e.scrollTop()}else e=b("html, body").firstScrollable();i["scroll"+{top:"Top",
left:"Left"}[a.direction]]=f+g+a.offset;e.animate(i,{duration:a.speed,easing:a.easing,complete:function(){a.afterScroll&&b.isFunction(a.afterScroll)&&a.afterScroll.call(a.link,a)}})};b.smoothScroll.version="1.3";b.fn.smoothScroll.defaults={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,afterScroll:null,easing:"swing",speed:400}})(jQuery);
