// script issu de : http://www.webbricks.org/bricks/scroller/
function getPos(a){var b={'r':0,'l':0,'t':0,'b':0};var c=a;do{b.l+=c.offsetLeft;c=c.offsetParent}while(c!==null);b.r=b.l+a.offsetWidth;c=a;do{b.t+=c.offsetTop;c=c.offsetParent}while(c!==null);b.b=b.t+a.offsetHeight;return b}function winDim(){var w,h;if(window.innerWidth){w=window.innerWidth;h=window.innerHeight}else if(document.documentElement.clientWidth){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight}else if(document.body.clientWidth){w=document.body.clientWidth;h=document.body.clientHeight}else{alert("winDim() n'est pas parvenu à lire les dimentions de la fenêtre")}return{'w':w,'h':h}}function pageDim(){var w,h;h=document.documentElement.scrollHeight;w=document.documentElement.scrollWidth;if(document.documentElement.clientHeight>h){h=document.documentElement.clientHeight}if(document.documentElement.clientWidth>w){w=document.documentElement.clientWidth}if(document.body.scrollHeight>h){h=document.body.scrollHeight}if(document.body.scrollWidth>w){w=document.body.scrollWidth}return{'w':w,'h':h}}function scrolled(){var x,y;if(window.pageXOffset!==undefined){x=window.pageXOffset;y=window.pageYOffset}else{x=document.documentElement.scrollLeft?document.documentElement.scrollLeft:(document.body.scrollLeft?document.body.scrollLeft:0);y=document.documentElement.scrollTop?document.documentElement.scrollTop:(document.body.scrollTop?document.body.scrollTop:0)}return{'x':x,'y':y}}var scroller={nextStep:null,delay:1000/25,goTo:function(a){if(window.opera&&!a.innerHTML){a.innerHTML=' &nbsp; '}this.targetPos=getPos(a);if(window.opera&&!a.innerHTML==' &nbsp; '){a.innerHTML=''}var b=pageDim().h;if(this.targetPos.t+winDim().h>b){this.targetPos.t=b-winDim().h}var c=pageDim().w;if(this.targetPos.l+winDim().w>c){this.targetPos.l=c-winDim().w}clearTimeout(this.nextStep);this.frame()},frame:function(){this.lastPos=scrolled();var a={'x':Math.ceil((this.targetPos.l-scrolled().x)/3),'y':Math.ceil((this.targetPos.t-scrolled().y)/3)};this.proceeding=1;window.scrollBy(a.x,a.y);setTimeout(function(){scroller.proceeding=0},1);if((this.lastPos.x!=scrolled().x)||(this.lastPos.y!=scrolled().y)){clearTimeout(this.nextStep);this.nextStep=setTimeout(function(){scroller.frame()},this.delay)}else{}},stop:function(){if(!scroller.proceeding){clearTimeout(scroller.nextStep)}},applyTo:function(a){if(typeof a.length===undefined){a=[a]}var b,i,targetName,noHash,nbLinks=a.length,thisPage=window.location.href.replace(window.location.hash,'');for(i=0;i<nbLinks;i++){b=a[i];targetName=b.href.match(/#.+/);if(targetName){targetName=targetName[0].substring(1);noHash=b.href.replace(b.hash,'');if(noHash==thisPage){b.onclick=new Function("scroller.goTo(document.getElementsByName('"+targetName+"')[0]); return false;")}}}},auto:function(){this.applyTo(document.getElementsByTagName('a'))}};if(window.addEventListener){window.addEventListener('scroll',scroller.stop,false)}else{window.attachEvent('onscroll',scroller.stop)}
