Scroller={speed:10,gy:function(b){gy=b.offsetTop;if(b.offsetParent){while(b=b.offsetParent){gy+=b.offsetTop}}return gy},scrollTop:function(){body=document.body;d=document.documentElement;if(body&&body.scrollTop){return body.scrollTop}if(d&&d.scrollTop){return d.scrollTop}if(window.pageYOffset){return window.pageYOffset}return 0},add:function(b,c,e){if(b.addEventListener){return b.addEventListener(c,e,false)}if(b.attachEvent){return b.attachEvent('on'+c,e)}},end:function(b){if(window.event){window.event.cancelBubble=true;window.event.returnValue=false;return}if(b.preventDefault&&b.stopPropagation){b.preventDefault();b.stopPropagation()}},scroll:function(b){i=window.innerHeight||document.documentElement.clientHeight;h=document.body.scrollHeight;a=Scroller.scrollTop();if(b>a){if(h-b>i){a+=Math.ceil((b-a)/Scroller.speed)}else{a+=Math.ceil((b-a-Math.abs(h-b-i))/Scroller.speed)}}else{a=a+(b-a)/Scroller.speed}window.scrollTo(0,a);if(a==b||Scroller.offsetTop==a){clearInterval(Scroller.interval)}Scroller.offsetTop=a},init:function(){Scroller.add(window,'load',Scroller.render)},render:function(){a=document.getElementsByTagName('a');Scroller.end(this);for(i=0;i<a.length;i++){l=a[i];if(l.href&&l.href.indexOf('#')!=-1&&((l.pathname==location.pathname)||('/'+l.pathname==location.pathname))){Scroller.add(l,'click',Scroller.end);l.onclick=function(){Scroller.end(this);jQuery('#navigation a').removeClass('active');jQuery(this).toggleClass('active');l=this.hash.substr(1);a=document.getElementsByTagName('a');for(i=0;i<a.length;i++){if(a[i].id==l||a[i].getAttribute('id')==l){clearInterval(Scroller.interval);Scroller.interval=setInterval('Scroller.scroll('+Scroller.gy(a[i])+')',10);break}}}}}loc=document.location.toString();if(loc.match('#')){anch='#'+loc.split('#')[1];jQuery('a[href="'+anch+'"]').click()}}};jQuery(document).ready(function(){if(jQuery.browser.msie&&jQuery.browser.version<7){return}Scroller.init()})
