        !function(a,b,c,d){var e=function(d,e){this.elem=d,this.$elem=a(d),this.options=e,this.metadata=this.$elem.data("plugin-options"),this.$win=a(b),this.sections={},this.didScroll=!1,this.$doc=a(c),this.docHeight=this.$doc.height()};e.prototype={defaults:{navItems:"a",currentClass:"current",changeHash:!1,easing:"swing",filter:"",scrollSpeed:750,scrollThreshold:.5,begin:!1,end:!1,scrollChange:!1,offset:0},init:function(){return this.config=a.extend({},this.defaults,this.options,this.metadata),this.$nav=this.$elem.find(this.config.navItems),""!==this.config.filter&&(this.$nav=this.$nav.filter(this.config.filter)),this.$nav.on("click.onePageNavOm",a.proxy(this.handleClick,this)),this.getPositions(),this.bindInterval(),this.$win.on("resize.onePageNavOm",a.proxy(this.getPositions,this)),this},adjustNav:function(a,b){a.$elem.find("."+a.config.currentClass).removeClass(a.config.currentClass),b&&b.addClass(a.config.currentClass)},bindInterval:function(){var b,a=this;a.$win.on("scroll.onePageNavOm",function(){a.didScroll=!0}),a.t=setInterval(function(){b=a.$doc.height(),a.didScroll&&(a.didScroll=!1,a.scrollChange()),b!==a.docHeight&&(a.docHeight=b,a.getPositions())},250)},getHash:function(a){return a.attr("href").split("#")[1]},getPositions:function(){var c,d,e,b=this;b.$nav.each(function(){c=b.getHash(a(this)),e=a("#"+c),e.length&&(d=e.offset().top,b.sections[c]=Math.round(d))})},getSection:function(a){var b=null,c=Math.round(this.$win.height()*this.config.scrollThreshold);for(var d in this.sections)this.sections[d]-c<a&&(null==b||this.sections[d]>this.sections[b])&&(b=d);return b},handleClick:function(d){var e=this,f=a(d.currentTarget),g=f.parent(),h="#"+e.getHash(f),i=d.currentTarget.href.split("#");return""!=i[0]&&c.location.href.split("#")[0]!=i[0]&&c.location.pathname!=i[0]||(!a(h).length||(g.hasClass(e.config.currentClass)||(e.config.begin&&e.config.begin(),e.adjustNav(e,g),e.unbindInterval(),e.scrollTo(h,function(){e.config.changeHash&&(b.location.hash=h),e.bindInterval(),e.config.end&&e.config.end()})),void d.preventDefault()))},scrollChange:function(){var d,a=this.$win.scrollTop(),b=this.getSection(a);if(null!==b){d=this.$elem.find('a[href$="#'+b+'"]').filter(function(a){var b=this.href.split("#");return""==b[0]||c.location.href.split("#")[0]==b[0]||c.location.pathname==b[0]}).parent(),d.hasClass(this.config.currentClass)||(this.adjustNav(this,d),this.config.scrollChange&&this.config.scrollChange(d))}else this.adjustNav(this,null)},scrollTo:function(b,c){var d=a(b).offset().top;d-="function"==typeof this.config.offset?this.config.offset():this.config.offset,a("html, body").animate({scrollTop:d},this.config.scrollSpeed,this.config.easing,c)},unbindInterval:function(){clearInterval(this.t),this.$win.unbind("scroll.onePageNavOm")}},e.defaults=e.prototype.defaults,a.fn.onePageNavOm=function(a){return this.each(function(){new e(this,a).init()})}}(jQuery,window,document);