function scrollerWidget(){this.startingScrollerPos=0;this.arrayOfMenuNodesPositions=null;this.totalMenuItems=0;this.currentScrollerPos=0;this.maxScrollerHeightToDisplay=0;this.totalScrollerHeight=0;this.animations=null;this.nodeToSlideID=null;this.nodeUpToHide=null;this.nodeDownToHide=null;this.init=initialize_Scroller;this.updateStyleScrollerCatButtons=updateStyleScrollerCatButtons;this.initializeScrollerArray=initializeScrollerArray;this.buttonEventOccured=buttonEventOccured;this.setCurrentScrollerPosition=setCurrentScrollerPosition;this.centerNAVAndShow=centerNAVAndShow;this.showNAV=showNAV;}function initialize_Scroller(buttonDown_ID,buttonUp_ID,defaultAnimationTime,fastestAnimationTime,animationTimeDecrement,nodeToSlideID,nodeUpToHide,nodeDownToHide,pixelOffSet){this.fastestAnimationTime=fastestAnimationTime;this.nodeUpToHide=nodeUpToHide;this.nodeDownToHide=nodeDownToHide;this.nodeToSlideID=nodeToSlideID;this.initializeScrollerArray();if(this.arrayOfMenuNodesPositions==null){return;}if(this.maxScrollerHeightToDisplay>=this.totalScrollerHeight){this.updateStyleScrollerCatButtons("none");this.centerNAVAndShow();}else{this.showNAV();this.updateStyleScrollerCatButtons("block");var buttentEventMonitor=new buttonEvent();buttentEventMonitor.init_buttonEvent(buttonUp_ID,buttonDown_ID,this);this.animations=new scrollerAnimation();this.animations.init_ScrollerAnimation(defaultAnimationTime,animationTimeDecrement,fastestAnimationTime,this.maxScrollerHeightToDisplay,this.totalScrollerHeight,this.arrayOfMenuNodesPositions,pixelOffSet);this.animations.doAnimation(this,"start",this.currentScrollerPos,this.nodeToSlideID);}}function showNAV(){var browser="";var version="";if(browser==""){if(navigator.appName.indexOf("Microsoft")!=-1){browser="IE";}else{if(navigator.appName.indexOf("Netscape")!=-1){browser="Netscape";}else{browser="IE";}}}if(browser=="IE"){var ua=navigator.userAgent;var msie=ua.indexOf("MSIE");version=parseInt(ua.substring(msie+5,ua.indexOf(".",msie)));}var scrollerNode=document.getElementById(this.nodeToSlideID);if((browser=="IE")&&(version>=6)){scrollerNode.parentNode.style.filter="";}else{scrollerNode.parentNode.style.opacity="";}}function centerNAVAndShow(){var browser="";var version="";if(browser==""){if(navigator.appName.indexOf("Microsoft")!=-1){browser="IE";}else{if(navigator.appName.indexOf("Netscape")!=-1){browser="Netscape";}else{browser="IE";}}}if(browser=="IE"){var ua=navigator.userAgent;var msie=ua.indexOf("MSIE");version=parseInt(ua.substring(msie+5,ua.indexOf(".",msie)));}var scrollerNode=document.getElementById(this.nodeToSlideID);scrollerNode.style.position="";scrollerNode.parentNode.style.position="";if((browser=="IE")&&(version>=6)){scrollerNode.style.overflow="visible";scrollerNode.style.position="relative";scrollerNode.style.top="-50%";scrollerNode.parentNode.style.overflow="visible";scrollerNode.parentNode.style.height="";scrollerNode.parentNode.style.position="absolute";scrollerNode.parentNode.style.top="50%";scrollerNode.parentNode.parentNode.style.position="relative";scrollerNode.parentNode.style.filter="";}else{scrollerNode.parentNode.style.opacity="";}scrollerNode.parentNode.style.verticalAlign="middle";if ((browser == 'IE') && (version >= 6)){scrollerNode.parentNode.style.display = "inline";}else{scrollerNode.parentNode.style.display = "table-cell";}}function buttonEventOccured(type){if(type!=null){if((type=="up")||(type=="down")){this.animations.doAnimation(this,type,this.currentScrollerPos,this.nodeToSlideID);}else{if(type=="reset"){this.animations.resetCurrentAnimationTime();}}}}function updateStyleScrollerCatButtons(newStyle){var buttonUpNode=document.getElementById(this.nodeUpToHide);var buttonDownNode=document.getElementById(this.nodeDownToHide);buttonUpNode.style.display=newStyle;buttonDownNode.style.display=newStyle;}function initializeScrollerArray(){this.arrayOfMenuNodesPositions=new Array();var menuItemNum=0;var currentPositionPixelCount=0;var slideNode=document.getElementById(this.nodeToSlideID);var arrayOfNodes=slideNode.getElementsByTagName("li");var currentNode;var lastGoodStartPos=0;this.maxScrollerHeightToDisplay=slideNode.parentNode.offsetHeight;this.totalScrollerHeight=slideNode.offsetHeight;for(;menuItemNum<arrayOfNodes.length;menuItemNum++){currentNode=arrayOfNodes[menuItemNum];this.arrayOfMenuNodesPositions[menuItemNum]=currentPositionPixelCount;if((currentPositionPixelCount+this.maxScrollerHeightToDisplay)<(this.totalScrollerHeight+currentNode.offsetHeight)){lastGoodStartPos=menuItemNum;}if(currentNode.className=="selected"){this.currentScrollerPos=lastGoodStartPos;}currentPositionPixelCount+=currentNode.offsetHeight;}this.totalScrollerHeight=currentPositionPixelCount;this.totalMenuItems=menuItemNum;}function setCurrentScrollerPosition(currentScrollerPos){this.currentScrollerPos=currentScrollerPos;}function buttonEvent(){this.buttonDownAction_timeout=null;this.buttonUpAction_timeout=null;this.eventCheckTime=25;this.scroller=null;this.init_buttonEvent=init_buttonEvent;this.downButton_StartEvent=downButton_StartEvent;this.downButton_StopEvent=downButton_StopEvent;this.upButton_StartEvent=upButton_StartEvent;this.upButton_StopEvent=upButton_StopEvent;}function init_buttonEvent(buttonUp_ID,buttowDown_ID,scroller){this.scroller=scroller;dojo.connect(dojo.byId(buttonUp_ID),"onmouseover",this,upButton_StartEvent);dojo.connect(dojo.byId(buttonUp_ID),"onmouseout",this,upButton_StopEvent);dojo.connect(dojo.byId(buttowDown_ID),"onmouseover",this,downButton_StartEvent);dojo.connect(dojo.byId(buttowDown_ID),"onmouseout",this,downButton_StopEvent);}function downButton_StartEvent(){if(this.buttonDownAction_timeout==null){this.scroller.buttonEventOccured("down");var selfobject=this;this.buttonDownAction_timeout=setInterval(function(){selfobject.scroller.buttonEventOccured("down");},this.eventCheckTime);}}function downButton_StopEvent(){if(typeof(this.buttonDownAction_timeout)!="undefined"){clearInterval(this.buttonDownAction_timeout);this.buttonDownAction_timeout=null;this.scroller.buttonEventOccured("reset");}}function upButton_StartEvent(){if(this.buttonUpAction_timeout==null){this.scroller.buttonEventOccured("up");var selfobject=this;this.buttonUpAction_timeout=setInterval(function(){selfobject.scroller.buttonEventOccured("up");},this.eventCheckTime);}}function upButton_StopEvent(){if(typeof(this.buttonUpAction_timeout)!="undefined"){clearInterval(this.buttonUpAction_timeout);this.buttonUpAction_timeout=null;this.scroller.buttonEventOccured("reset");}}function scrollerAnimation(){this.defaultAnimationTime=null;this.currentAnimationTime=null;this.animationTimeDecrement=null;this.startingPixelOffSet=0;this.currentAnimation=null;this.arrayOfPositions=null;this.maxScrollerHeightToDisplay=0;this.totalScrollerHeight=0;this.init_ScrollerAnimation=init_ScrollerAnimation;this.doAnimation=doAnimation;this.generateCombinedAnimation=generateCombinedAnimation;this.resetCurrentAnimationTime=resetCurrentAnimationTime;}function init_ScrollerAnimation(defaultAnimationTime,animationTimeDecrement,fastestAnimationTime,maxScrollerHeightToDisplay,totalScrollerHeight,arrayOfPositions,startingPixelOffSet){this.defaultAnimationTime=defaultAnimationTime;this.currentAnimationTime=defaultAnimationTime;this.animationTimeDecrement=animationTimeDecrement;this.startingPixelOffSet=startingPixelOffSet;this.fastestAnimationTime=fastestAnimationTime;this.arrayOfPositions=arrayOfPositions;this.maxScrollerHeightToDisplay=maxScrollerHeightToDisplay;this.totalScrollerHeight=totalScrollerHeight;}function doAnimation(scroller,index,currentScrollerIndex,navNodeID){var currentPixelPosition=this.arrayOfPositions[currentScrollerIndex];switch(index){case"up":if(currentPixelPosition>=1){if(this.currentAnimation&&this.currentAnimation.status()!="stopped"){}else{currentScrollerIndex--;scroller.setCurrentScrollerPosition(currentScrollerIndex);this.currentAnimation=this.generateCombinedAnimation(navNodeID,-this.arrayOfPositions[currentScrollerIndex]-this.startingPixelOffSet);if(this.currentAnimationTime>this.fastestAnimationTime){this.currentAnimationTime-=this.animationTimeDecrement;}}}break;case"down":if((currentPixelPosition+this.maxScrollerHeightToDisplay)<this.totalScrollerHeight){if(this.currentAnimation&&this.currentAnimation.status()!="stopped"){}else{currentScrollerIndex++;scroller.setCurrentScrollerPosition(currentScrollerIndex);this.currentAnimation=this.generateCombinedAnimation(navNodeID,-this.arrayOfPositions[currentScrollerIndex]-this.startingPixelOffSet);if(this.currentAnimationTime>this.fastestAnimationTime){this.currentAnimationTime-=this.animationTimeDecrement;}}}break;case"start":if(this.currentAnimation&&this.currentAnimation.status()!="stopped"){}else{this.currentAnimationTime*=2;this.currentAnimation=this.generateCombinedAnimation(navNodeID,-this.arrayOfPositions[currentScrollerIndex]-this.startingPixelOffSet);this.currentAnimationTime/=2;}break;}if(this.currentAnimation){dojo.connect(this.currentAnimation,"onEnd",function(){this.currentAnimation=null;});this.currentAnimation.play();}}function generateCombinedAnimation(navNodeID,amount){var slideAnimation=dojo.fx.slideTo({node:navNodeID,left:"0",top:amount,unit:"px",duration:this.currentAnimationTime});return dojo.fx.combine([slideAnimation]);}function resetCurrentAnimationTime(){this.currentAnimationTime=this.defaultAnimationTime;}