function linkVisibility(t){var t=String(t),o=t.substr(t.indexOf("#")),e=".ahead, .rewind",l=".ahead, .rewind";jQuery(e).hide(),jQuery(o).siblings(l).show()}function showNavForClosestAnchor(){var t;t=jQuery(window).scrollLeft()+jQuery(window).width()>=jQuery(document).width()-20?"#next-chapter":"#"+findClosestAnchor(anchors).getAttribute("id"),linkVisibility(t)}!function($){function t(t){return t.replace(/(:|\.)/g,"\\$1")}var o="1.4.13",e={},l={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficent:2,preventDefault:!0},r=function(t){var o=[],e=!1,l=t.dir&&"left"==t.dir?"scrollLeft":"scrollTop";return this.each(function(){if(this!=document&&this!=window){var t=$(this);t[l]()>0?o.push(this):(t[l](1),e=t[l]()>0,e&&o.push(this),t[l](0))}}),o.length||this.each(function(t){"BODY"===this.nodeName&&(o=[this])}),"first"===t.el&&o.length>1&&(o=[o[0]]),o},n="ontouchend"in document;$.fn.extend({scrollable:function(t){var o=r.call(this,{dir:t});return this.pushStack(o)},firstScrollable:function(t){var o=r.call(this,{el:"first",dir:t});return this.pushStack(o)},smoothScroll:function(o,e){if(o=o||{},"options"===o)return e?this.each(function(){var t=$(this),o=$.extend(t.data("ssOpts")||{},e);$(this).data("ssOpts",o)}):this.first().data("ssOpts");var l=$.extend({},$.fn.smoothScroll.defaults,o),r=$.smoothScroll.filterPath(location.pathname);return this.unbind("click.smoothscroll").bind("click.smoothscroll",function(o){var e=this,n=$(this),i=$.extend({},l,n.data("ssOpts")||{}),s=l.exclude,c=i.excludeWithin,a=0,f=0,u=!0,h={},d=location.hostname===e.hostname||!e.hostname,p=i.scrollTarget||($.smoothScroll.filterPath(e.pathname)||r)===r,m=t(e.hash);if(i.scrollTarget||d&&p&&m){for(;u&&ai?-1:i>s?1:0};return Array.prototype.slice.call(t).sort(o)[0]},lastSmoothScroll=Date.now()-20,isScrolling=!1;jQuery(".ahead, .rewind, .firstlink").click(function(){}).smoothScroll({direction:"left",beforeScroll:function(){isScrolling=!0},afterScroll:function(){linkVisibility(this),isScrolling=!1,lastSmoothScroll=Date.now()}});var anchors=document.body.querySelectorAll("article a[id]");jQuery(".ahead, .rewind").hide(),showNavForClosestAnchor(),jQuery(window).scrollStopped(function(){0==isScrolling&&Date.now()-lastSmoothScroll>5&&showNavForClosestAnchor()});