function ScrollManager(){var i={};var g=null;var z=this;var n=null;this.init=function(){var v=arguments.length;for(var F=0;F<v;F++){i[arguments[F]]=new Scroller(arguments[F]);i[arguments[F]].getComponents().mainBox.wheelEnabled=true;EventUtils.addListener(i[arguments[F]].getComponents().mainBox,"mouseover",z.setWheelTarget);EventUtils.addListener(i[arguments[F]].getComponents().mainBox,"mousewheel",z.mouseWheel);}};this.reset=function(F){z.release(null);g=null;if(i[F]!=null){i[F].finishListeners();}i[F]=null;i[F]=new Scroller(F);var v=i[F].getComponents();v.button_track.Controller=i[F];};this.getCurrent=function(){return g;};this.getTargets=function(){return i;};this.getTarget=function(F){return i[F]!=null?i[F]:null;};this.setWheelTarget=function(F){var v=F.target!=null?F.target:F.srcElement;while(v!=null&&v.parentNode!=null){if(v.wheelEnabled!=null){break;}v=v.parentNode;}if(v.wheelEnabled!=null){n=v;}};this.setCurrent=function(F,v){z.release(F);g=i[v.getControlID()];g.setScrolling(true);this.startListener(F);};this.mouseMove=function(m){if(g==null||!g.isEnableBar()){z.release(m);return;}var Y=g.getProperty("offsetY");if(Y==null){Y=0;}var B=g.getComponents();var Q=g.getProperty("trackMin");var v=g.getProperty("trackMax");var F="";var I=(m.clientY+Q)-Y;if(I<Q){I=Q;}else{if(I>v){I=v;}}B.button_track.style.top=I+"px";z.move(I);};this.mouseUp=function(F){z.release(F);};this.mouseOut=function(F){var v=F.target!=null?F.target:F.srcElement;if(v==document.body){z.release(F);}};this.mouseWheel=function(F){var I=0;if(F.wheelDelta){I=F.wheelDelta/120;}else{if(F.detail){I=-F.detail/3;}}if(n==null){return;}g=i[n.id];if(g==null||!g.isEnableBar()){return;}var B=g.getComponents().content.measures.height;var Q=g.getComponents().button_track.measures.height;var m=Math.round(7*(Q/B));if(m<=2.5){m=3;}if(m>=5){m=5;}var v=(m*-I);z.moveBy(g,v);g=null;if(F.preventDefault){F.preventDefault();}F.returnValue=false;return false;};this.click=function(F,I){if(g!=null&&g.isScrolling()){return;}g=i[n.id];var B=g.getComponents().content.measures.height;var Q=g.getComponents().button_track.measures.height;var m=Math.round(7*(Q/B));if(m<=2.5){m=2.5;}if(m>=5){m=5;}var v=0;if(I=="up"){v=-m;}else{v=m;}z.moveBy(g,v);g.timeout=window.setTimeout("scrollManager.click(null,\""+I+"\")",60);return false;};this.releaseClick=function(F){if(g!=null&&g.timeout!=null){window.clearTimeout(g.timeout);}g=null;};this.moveBy=function(B,m){var v=parseInt(B.getProperty("trackMin"));var F=parseInt(B.getProperty("trackMax"));var I=parseInt(B.getProperty("offsetY"));var Q=parseInt(B.getComponents().button_track.style.top);if(isNaN(I)){I=0;}if(isNaN(Q)){Q=0;}Q+=m;if(Q<=v){Q=v;}else{if(Q>=F){Q=F;}}B.getComponents().button_track.style.top=Math.round(Q)+"px";z.move(Q);if(B.getComponents().button_up!=null){Q-=B.getComponents().button_up.measures.height;}B.setProperty("offsetY",Q);};this.startListener=function(v){var m=v.target!=null?v.target:v.srcElement;m=m.Controller;var F=parseInt(m.getProperty("offsetY"));if(isNaN(F)){F=0;}m.setProperty("offsetY",v.clientY-F);EventUtils.addListener(document,"mousemove",scrollManager.mouseMove);EventUtils.addListener(document,"mouseup",scrollManager.mouseUp);EventUtils.addListener(document.body,"mouseout",scrollManager.mouseOut);};this.release=function(v){if(g!=null&&v!=null){var m=parseInt(g.getComponents().button_track.style.top);if(isNaN(m)){m=0;}var F=isNaN(g.getProperty("offsetY"))?0:parseInt(g.getProperty("offsetY"));g.setProperty("offsetY",v.clientY-F);g.setScrolling(false);}g=null;EventUtils.removeListener(document,"mousemove",scrollManager.mouseMove);EventUtils.removeListener(document,"mouseup",scrollManager.mouseUp);EventUtils.removeListener(document.body,"mouseout",scrollManager.mouseOut);};this.move=function(Y){var I=null;var v=g.getProperty("trackMin")*1;var F=g.getProperty("trackMax")*1;Y-=v;var Q=z.getCurrent().getComponents();var m=Q.button_up!=null?Q.button_up.measures:{"height":0};var B=Math.round(Y*z.getCurrent().getProperty("ratio"));B*=-1;if(window.getSelection){I=window.getSelection();}else{if(document.getSelection){I=document.getSelection();}else{if(document.selection){I=document.selection;}}}if(I!=null&&I.empty){I.empty();}else{if(I!=null&&I.removeAllRanges){I.removeAllRanges();}}Q.content.style.top=B+"px";};}