(function(j,l,n){function s(a,d){var b,c={};for(b in d){c[b]=d[b]}for(b in a){c[b]=a[b]}return c}function t(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}}function u(a){var d=1,b=arguments.length,c=[];for(;d<b;d++)c.push(arguments[d]);return function(){a.apply(this,c)}}function o(a,d,b,c){if(a.addEventListener){a.addEventListener(d,b,c)}else{a.attachEvent("on"+d,b)}}function p(a,d,b,c,f,e){var g,h=d-a;g=a+(Math.pow(((1/b)*c),f)*h);return e?Math.round(g):g}function v(){var a=l,d=a.documentElement,b=a.body,c,f;f=d.scrollHeight;c=d.scrollWidth;if(d.clientHeight>f){f=d.clientHeight}if(d.clientWidth>c){c=d.clientWidth}if(b.scrollHeight>f){f=b.scrollHeight}if(b.scrollWidth>c){c=b.scrollWidth}return{'w':c,'h':f}}function w(){var a,d,b=j,c=l,f=c.documentElement,e=c.body;if(b.innerWidth){a=b.innerWidth;d=b.innerHeight}else if(f.clientWidth){a=f.clientWidth;d=f.clientHeight}else{a=e.clientWidth;d=e.clientHeight}return{w:a,h:d}}function x(){var a,d,b=j,c=l,f=c.documentElement,e=c.body;if(b.pageXOffset!==n){a=b.pageXOffset;d=b.pageYOffset}else{a=f.scrollLeft?f.scrollLeft:(e.scrollLeft?e.scrollLeft:0);d=f.scrollTop?f.scrollTop:(e.scrollTop?e.scrollTop:0)}return{'x':a,'y':d}}function y(a){var d={'r':0,'l':0,'t':0,'b':0},b=a;do{d.l+=b.offsetLeft;b=b.offsetParent}while(b!==null);d.r=d.l+a.offsetWidth;b=a;do{d.t+=b.offsetTop;b=b.offsetParent}while(b!==null);d.b=d.t+a.offsetHeight;return d}var z={defOpt:{ease:0.17,onStart:0,onFinish:0,onSrcoll:0,duration:function(a,d){a=Math.sqrt(Math.pow(a,2)+Math.pow(d,2));var b=0,c=0;while(b<a){c++;b=b+c*c}return c*50},rien:0},goTo:function(a,d){var b=this,c=j.opera,f=' &nbsp; ',e,g,h=w(),i=v(),k;b.opt=s(d||{},b.defOpt);k=b.opt;b.tgt=a;g=b.initPos=x();b.startTime=new Date().getTime();if(c&&!a.innerHTML){a.innerHTML=f}e=y(a);if(c&&a.innerHTML!=f){a.innerHTML=""}if(e.t+h.h>i.h){e.t=i.h-h.h}if(e.l+h.w>i.w){e.l=i.w-h.w}if(typeof k.duration=="function"){b.opt.duration=k.duration.call(b,e.t-g.y,e.l-g.x)||1}if(k.onStart){k.onStart.call(b)}b.tgtPos=e;clearTimeout(b.nextStep);b.frame()},frame:function(){var a=this,d=new Date(),b,c,f,e,g,h,i;c=a.opt;f=a.initPos;e=a.tgtPos;d=d.getTime();b=d-a.startTime;i=Math.min(b,c.duration);g=p(f.x,e.l,c.duration,i,c.ease);h=p(f.y,e.t,c.duration,i,c.ease);j.scrollTo(g,h);if(c.onScroll){c.onScroll.call(a,i/c.duration)}if(b>=c.duration||(g===e.l&&h===e.t)){j.scrollTo(e.l,e.t);if(c.onFinish){c.onFinish.call(a)}}else{clearTimeout(a.nextStep);a.nextStep=setTimeout(function(){a.frame()},1)}},applyTo:function(c,f){if(typeof c.length===n){c=[c]}var e=this,g,h,i,k,m,A=c.length,q=j.location,r="click",B=q.href.replace(q.hash,"");for(h=0;h<A;h++){g=c[h];i=g.href.match(/#.+/);if(i){i=i[0].substring(1);k=g.href.replace(g.hash,"");if(k==B){m=l.getElementsByName(i)[0];if(m){o(g,r,u(function(a,d,b){a.goTo(d,b)},e,m,f));o(g,r,function(a){t(a)})}}}}},auto:function(a){this.applyTo(l.getElementsByTagName("a"),a)}};j.scroller=z})(window,document);
