// JScript source code

	


        function scrollingBrowseListObject () {}
        scrollingBrowseListObject.prototype = new baseObject ();

            scrollingBrowseListObject.prototype.start = function ( element, strClass, obContainer ) {
				
                this.outerElement = element;
                element.objectHandle = this.handle;
                element.hideFocus = true;
                this.localFocusElement = this.outerElement;
                this.bFoundTop = false;
                this.bFoundBottom = false;
                this.numPixelFill = 200;
                this.elBrowseList = this.outerElement;
                this.numBlocks = 0;
                this.strRequestExtra = this.outerElement.getAttribute ( this.manager.attributePrefix + "RequestExtra" );
                this.bPageMode = ( this.outerElement.getAttribute ( this.manager.attributePrefix + "PageBrowse" ) == "1" );
                this.allowBackSpace = true;
                if ( this.strRequestExtra == null ) this.strRequestExtra = "";
                this.bNoFocus = this.outerElement.getAttribute ( this.manager.attributePrefix + "NoFocus" ) == "1";
                this.bNoPreloadAbove = this.outerElement.getAttribute ( this.manager.attributePrefix + "NoPreloadAbove" ) == "1";
                this.bFixedContent = this.outerElement.getAttribute ( this.manager.attributePrefix + "FixedContent" ) == "1";
                if ( this.elBrowseList.firstChild != null ) {
                    var elDiv = this.elBrowseList.firstChild;
                    if ( elDiv.nodeType == 1 ) {
                        this.bFoundTop = ( elDiv.getAttribute ( "bFoundTop" ) == "1" );
                        this.bFoundBottom = ( elDiv.getAttribute ( "bFoundBottom" ) == "1" );
                    }
                }
                obContainer.traverseChildren ( element ); // Recurse binding to child elements.
                this.bNoScrollBar = this.outerElement.getAttribute ( this.manager.attributePrefix + "NoScrollBar" ) == "1";
                this.strMarkerClass = this.outerElement.getAttribute ( this.manager.attributePrefix + "StopBarClass" );
                this.elBrowseList.style.overflow = "hidden";//this.bNoScrollBar ? "hidden" : "auto";
                this.obAppServer = new cHttpFetcher ( this.manager.getUseScriptHTTPFetcher () );
                this.localFocusElement.onfocus = new Function ( "documentManager.controlGetsFocus(" + this.handle + ");" );
                this.localFocusElement.onblur = new Function ( "documentManager.controlLoosesFocus(" + this.handle + ");" );
                this.showFocus = false;
                this.manager.addTask ( this.createCallback ( "fnOnStart" ) );
                this.fnPollCallBack = this.createCallback ( "fnOnPoll" );
                this.strName = element.id;
                if ( this.bFixedContent ) {
                    this.bFoundTop = true;
                    this.bFoundBottom = true;
                }
            }
            scrollingBrowseListObject.prototype.fnOnStart = function () {
                trace("","scrollingBrowseListObject.fnOnStart called");
                if ( this.elBrowseList.parentNode == null ) {

                    // The page was unloaded before we got a chance to start.
                    trace("","scrollingBrowseListObject.thinks it's been unloaded");
                    return;
                }
                if ( document.body.offsetHeight < 20 ) {
                    trace("","scrollingBrowseListObject.thinks it needs to wait for more data ?");
                    this.manager.addTask ( this.createCallback ( "fnOnStart" ) );
                } else {
                    this.elBrowseList.style.pixelHeight = this.elBrowseList.offsetHeight;
                    trace("",this.elBrowseList.style.pixelHeight);
                    if ( ! this.bPageMode ) {
                        this.elBrowseList.style.pixelHeight = this.elBrowseList.offsetHeight;
                        this.elTopStop = document.createElement ( "div" );
                        this.elBottomStop = document.createElement ( "div" );
                        this.elPad = document.createElement ( "div" );
                        this.elTopStop.appendChild ( document.createElement ( "br" ) );
                        this.elBottomStop.appendChild ( document.createElement ( "br" ) );
                        this.elPad.appendChild ( document.createElement ( "br" ) );
                        this.elBrowseList.insertBefore ( this.elTopStop, this.elBrowseList.firstChild );
                        this.elBrowseList.appendChild ( this.elBottomStop );
                        this.elBrowseList.appendChild ( this.elPad );
                        if ( this.strMarkerClass != null ) {
                            this.elTopStop.className = this.strMarkerClass;
                            this.elBottomStop.className = this.strMarkerClass;
                        } else {
                            this.elTopStop.style.backgroundColor = "scrollbar";
                            this.elBottomStop.style.backgroundColor = "scrollbar";
                        }
                        this.fnColorMarkers ();
                        var strDisplay = ( this.bFoundTop && this.bFoundBottom ) ? "none" : "block";
                        this.elTopStop.style.display = strDisplay;
                        this.elBottomStop.style.display = strDisplay;
                        this.elBrowseList.scrollTop = this.elTopStop.offsetHeight;
                        this.fnDoResize ();
                        this.elBrowseList.onscroll = this.createCallback ( "fnOnScroll" );
                        this.elBrowseList.offsetParent.onresize = this.createCallback ( "fnOnResizeParent" );
                        if ( this.bNoScrollBar ) {
                            this.elBrowseList.onmousewheel = this.createCallback ( "fnOnMouseWheel" );
                        }
                    }
                    if ( ! this.bNoFocus ) {
                        this.fnSetFocus ();
                    }
                    this.fnFill ();
                }
            }
            scrollingBrowseListObject.prototype.fnGetSpareSpace = function () {
                var elOffsetParent = this.elBrowseList.offsetParent;
                var parentHeight = 0;
                if (elOffsetParent.style.pixelHeight) 
				{
					parentHeight =  elOffsetParent.style.pixelHeight;
				}
				else
				{
					parentHeight =  elOffsetParent.clientHeight;
				}

                trace("","fnGetSpareSpace called");
                trace("","elOffsetParent "+ elOffsetParent );
                trace("","parentHeight "+ parentHeight );
                trace("","elOffsetParent.scrollHeight "+ elOffsetParent.scrollHeight );
                var result = parentHeight - elOffsetParent.scrollHeight;
                trace("","fnGetSpareSpace return "+ result);
                return result;
                
            }
            
            function getBoundingClientRect( e )
            {
               var result1 = null;
               
               //debugger;
               // getting very stange results
               //if (e.getBoundingClientRect)  
               //{
               //   result1 = e.getBoundingClientRect();  
               //}
               
               // make a work-around
               var element = e;
               var coords = { left: 0, top: 0, width: element.offsetWidth, height:
                                element.offsetHeight, bottom: 0, right: 0 };

                while (element) {
                    coords.left += element.offsetLeft;
                    coords.top += element.offsetTop;
                    element = element.offsetParent;
                }
                
                coords.bottom = coords.top + coords.height;
                coords.right  = coords.left + coords.width;
                //trace("coords", "coords ("+ coords.left + "," + coords.top+ "," coords.width +","+ coords.height +")" );
                //if ( result1 != null) trace("coords", "brect ("+ result1.left + "," + result1.top+ "," result1.width +","+ result1.height +")" );

                return coords;
            }
            
            
            scrollingBrowseListObject.prototype.fnDoResize = function () {
                trace("","scrollingBrowseListObject.fnDoResize called");
				//fdebugger;
                var obRect = getBoundingClientRect( this.elBrowseList );
                var obRectScreen = getBoundingClientRect( document.body );
                var numScreenHeight = obRectScreen.bottom - obRectScreen.top;
                trace("","num screen height is "+ numScreenHeight);
                var numClientHeight = obRect.bottom - obRect.top;
                trace("","num client height is "+ numClientHeight);
                if ( obRect.bottom > obRectScreen.bottom ) {
                    numClientHeight = obRectScreen.bottom - obRect.top;
                }
                trace("","num client 2 height is "+ numClientHeight);
                
                this.elBrowseList.style.pixelHeight = numClientHeight;

				
				
                var numScroll = this.elBrowseList.scrollTop;

                this.elBrowseList.style.pixelHeight = this.elBrowseList.offsetHeight + this.fnGetSpareSpace ();

				trace("","get spare space  "+ this.fnGetSpareSpace ());

				trace("","then pixel height is set to  "+ this.elBrowseList.style.pixelHeight);
                
                this.elPad.style.pixelHeight = this.elBrowseList.offsetHeight - this.elBottomStop.offsetHeight;
                this.elBrowseList.scrollTop = numScroll;
                if ( this.bNoPreloadAbove ) {
                    if ( this.elBrowseList.scrollTop < this.elTopStop.offsetHeight ) {
                        this.elBrowseList.scrollTop = this.elTopStop.offsetHeight;
                    }
                }
            }
            scrollingBrowseListObject.prototype.fnOnResizeParent = function () {
                trace("","scrollingBrowseListObject.fnOnResizeParent called");

                if ( ! this.bUpdatingList ) {
                    var numPW = this.elBrowseList.offsetParent.offsetWidth;
                    var numPH = this.elBrowseList.offsetParent.offsetHeight;
                    if ( ( this.numPW != numPW ) || ( this.numPH != numPH ) ) {
                        this.numPW = numPW;
                        this.numPH = numPH;
                        if ( ! this.bScheduledResize ) {
                            this.bScheduledResize = true;
                            this.manager.addTask ( this.createCallback ( "fnActionResize" ) );
                        }
                    }
                }
            }
            scrollingBrowseListObject.prototype.fnActionResize = function () {
                trace("","scrollingBrowseListObject.fnActionResize called");

                this.fnDoResize ();
                this.fnFill ();
                this.bScheduledResize = false;
            }
            scrollingBrowseListObject.prototype.fnOnMouseWheel = function (e) {
                if (!e) var e = window.event;
//                var element = getTargetElement( e );
//                var code = getKeyCode( e );

                //var numMove = this.elBrowseList.clientHeight * 0.1;
                var numMove = this.elBrowseList.style.pixelHeight * 0.1;
                
                if ( numMove > 30 ) numMove = 30;
                if ( e.wheelDelta >= 120 ) {
                    if ( this.fnGetCanScrollUp () ) {
                        this.elBrowseList.scrollTop -= numMove;
                    }
                }
                if ( e.wheelDelta <= -120 ) {
                    if ( this.fnGetCanScrollDown () ) {
                        this.elBrowseList.scrollTop += numMove;
                    }
                }
                e.cancelBubble = true;
                if ( e.stopPropagation ) e.stopPropagation();
                e.returnValue = false;
                this.manager.activity ();
            }
            scrollingBrowseListObject.prototype.fnOnScroll = function () {
                if ( this.strPendingRequest != null ) {
                    if ( this.obAppServer.IsAsyncWaiting () ) {
                        if ( this.obAppServer.IsAsyncReady () ) {
                            this.fnProcessResponse ();
                        }
                    }
                } else {
                    if ( ! this.bUpdatingList ) {
                        if ( this.bNoPreloadAbove ) {
                            if ( this.elBrowseList.scrollTop < this.elTopStop.offsetHeight ) {
                                this.bNoPreloadAbove = false;
                            }
                        }
                        this.fnFill ();
                    }
                }
            }
            scrollingBrowseListObject.prototype.fnProcessResponse = function () {
                if ( ! this.obAppServer.IsParsedOK () ) {
                    this.bBadResponse = true;
                } else {
                    var bUp = ( this.strPendingRequest == "up" );
                    var elDiv = document.createElement ( "div" );
                    var bIsEmpty = false;
                    this.bUpdatingList = true;
                    if ( bUp ) {
                        this.elBrowseList.insertBefore ( elDiv, this.elTopStop.nextSibling );
                        elDiv.innerHTML = this.obAppServer.GetResponseBody ();
                        //children--childNodes
                        if ( elDiv.childNodes.length == 0 ) {
                            elDiv.removeNode ( true );
                            bIsEmpty = true;
                        } else {
                            this.elBrowseList.scrollTop += elDiv.scrollHeight;
                        }
                    } else {
                        this.elBrowseList.insertBefore ( elDiv, this.elBottomStop );
                        elDiv.innerHTML = this.obAppServer.GetResponseBody ();
                        //children--childNodes
                        if ( elDiv.childNodes.length == 0 ) {
                            elDiv.removeNode ( true );
                            bIsEmpty = true;
                        }
                    }
                    if ( ! bIsEmpty ) {
                        this.manager.bindChildElements ( elDiv );
                        elDiv.setAttribute ( "targetObject", this.obAppServer.RspGet ( "targetObject", "???" ) );
                        this.numBlocks++;
                        if ( this.obAppServer.RspGet ( "strStartHandle", "" ) != "" ) {
                            if ( this.obAppServer.RspGet ( "strEndHandle", "" ) != "" ) {
                                elDiv.strStartHandle = this.obAppServer.RspGet ( "strStartHandle", "" );
                                elDiv.strEndHandle = this.obAppServer.RspGet ( "strEndHandle", "" );
                            }
                        }
                    }
                    if ( this.obAppServer.RspGet ( "bFoundTop", "0" ) == 1 ) {
                        this.bFoundTop = true;
                    }
                    if ( this.obAppServer.RspGet ( "bFoundBottom", "0" ) == 1 ) {
                        this.bFoundBottom = true;
                    }
                    this.fnColorMarkers ();
                    delete this.bUpdatingList;
                    delete this.strPendingRequest;
                    this.fnFill ();
                }
            }
            scrollingBrowseListObject.prototype.fnOnPoll = function () {
                if ( this.elBrowseList.parentNode == null ) {
                    // The page was unloaded.
                    return;
                }
                if ( this.obAppServer.IsAsyncWaiting () ) {
                    if ( ! this.obAppServer.IsAsyncReady () ) {
                        window.setTimeout ( this.fnPollCallBack, 10 );
                    } else {
                        this.fnProcessResponse ();
                        if ( this.fnOnMoreCallback != null ) {
                            this.fnOnMoreCallback ();
                            this.fnOnMoreCallback = null;
                        }
                    }
                }
            }
            scrollingBrowseListObject.prototype.fnRequestMore = function ( bUp ) {
                if ( ( this.strPendingRequest == null ) && ( ! this.bBadResponse ) ) {
                    var el = bUp ? this.elTopStop.nextSibling : this.elBottomStop.previousSibling;
                    this.strPendingRequest = bUp ? "up" : "down";
                    this.obAppServer.ClearCmd ();
                    this.obAppServer.SetUseUTF8Request ( 1 );
                    this.obAppServer.SetCmdPrefix ( el.getAttribute ( "targetObject" ) + this.strRequestExtra + "&ResponseEncoding=utf-8" );
                    this.obAppServer.CmdSet ( "Method", bUp ? "FetchIncrementalBrowseUp" : "FetchIncrementalBrowseDown" );
                    this.obAppServer.SetUseMSXMLHTTPRequest ( 1 );
                    if ( this.numBlocks > 5 ) {
                        var elBlock = bUp ? this.elBottomStop.previousSibling : this.elTopStop.nextSibling;
                        var numStart = parseInt ( elBlock.getAttribute ( "strStartHandle" ) );
                        var numEnd = parseInt ( elBlock.getAttribute ( "strEndHandle" ) );
                        this.bUpdatingList = true;
                        if ( bUp ) {
                            this.bFoundBottom = false;
                        } else {
                            this.bFoundTop = false;
                        }
                        this.fnColorMarkers ();
                        if ( ! ( isNaN ( numStart ) || isNaN ( numEnd ) ) ) {
                            this.obAppServer.CmdSet ( "RemoveItemsStart", numStart.toString () );
                            this.obAppServer.CmdSet ( "RemoveItemsEnd", numEnd.toString () );
                            this.manager.removeChildElements ( elBlock );
                            if ( bUp ) {
                                elBlock.removeNode ( true );
                            } else {
                                var numCorrectedScrollTop = this.elBrowseList.scrollTop - elBlock.scrollHeight;
                                elBlock.removeNode ( true );
                                this.elBrowseList.scrollTop = numCorrectedScrollTop;
                            }
                            this.numBlocks--;
                        }
                        delete this.bUpdatingList;
                    }
                    this.obAppServer.DoCmdAsync ();
                    this.fnOnPoll ();
                }
            }
            scrollingBrowseListObject.prototype.fnExternalRequestMore = function ( bUp, fnCallback ) {
                if ( this.bPageMode ) {
                    return false;
                } else {
                    if ( bUp ) {
                        if ( this.bFoundTop ) return false;
                    } else {
                        if ( this.bFoundBottom ) return false;
                    }
                    if ( this.strPendingRequest != null ) {
                        return false;
                    }
                    this.bNoPreloadAbove = false;
                    this.fnRequestMore ( bUp );
                    this.fnOnMoreCallback = fnCallback;
                    return true;
                }
            }
            scrollingBrowseListObject.prototype.fnColorMarkers = function () {
                this.elTopStop.style.visibility = this.bFoundTop ? "visible" : "hidden";
                this.elBottomStop.style.visibility = this.bFoundBottom ? "visible" : "hidden";
            }
            scrollingBrowseListObject.prototype.fnGetCanScrollUp = function () {
                with ( this.elBrowseList ) {
                    var numAbove = scrollTop;
                    var numUp = 0;
                    if ( this.bFoundTop ) {
                        numUp = this.elTopStop.offsetHeight;
                    }
                    if ( numAbove > numUp ) trace("","can scroll up is true");
                    return numAbove > numUp;
                }
            }
            scrollingBrowseListObject.prototype.fnGetCanScrollDown = function () {
                with ( this.elBrowseList ) {
					//debugger;
					// changed clientHeight to style.pixelHeight to get more consistent behaviour
					// with Mozilla.
                    var numBelow = ( ( scrollHeight - this.elPad.offsetHeight ) - scrollTop ) - style.pixelHeight;
                    if ( numBelow > 0 ) trace("","can scroll down is true");
                    trace("","num below is "+ numBelow);
                    trace("","scrollHeight is "+ scrollHeight);
                    trace("","scrollTop is "+ scrollTop);
                    trace("","client height is " +clientHeight);
                    trace("","offset height is " +offsetHeight);
                    trace("","pixel height is " +style.pixelHeight);
                    return numBelow > 0;
                }
            }
            scrollingBrowseListObject.prototype.fnFill = function () {
                if ( this.strPendingRequest == null ) {
                    with ( this.elBrowseList ) {
                        if ( ! this.bPageMode ) {
                            var numAbove = scrollTop;
                            //var numBelow = ( ( scrollHeight - this.elPad.offsetHeight ) - scrollTop ) - clientHeight;
                            var numBelow = ( ( scrollHeight - this.elPad.offsetHeight ) - scrollTop ) - style.pixelHeight;
                            
                            var numPixelFill = this.numPixelFill;
                            if ( this.strName != null ) {
                                var obUpdate = new updateObject ();
                                var numUp = 0;
                                if ( this.bFoundTop ) {
                                    numUp = this.elTopStop.offsetHeight;
                                }
                                obUpdate.write ( this.strName, "canScrollUp", this.fnGetCanScrollUp () );
                                obUpdate.write ( this.strName, "canScrollDown", this.fnGetCanScrollDown () );
                                this.manager.oInterface.syncUpdate ( obUpdate );
                            }
                            if ( numBelow < numPixelFill ) {
                                if ( ! this.bFoundBottom ) {
                                    this.fnRequestMore ( false );
                                    return;
                                }
                            }
                            if ( numAbove < numPixelFill ) {
                                if ( this.bNoPreloadAbove != true ) {
                                    if ( ! this.bFoundTop ) {
                                        this.fnRequestMore ( true );
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            scrollingBrowseListObject.prototype.fnFindTopCandidate = function ( el, elOffsetParent, numTop, numBottom, fnTest ) {
                for ( var elChild = el.firstChild; elChild != null; elChild = elChild.nextSibling ) {
                    if ( elChild.nodeType == 1 ) {
                        var numChildTop = 0;
                        var elP = elChild;
                        while ( true ) {
                            numChildTop += elP.offsetTop;
                            elP = elP.offsetParent;
                            if ( elP == elOffsetParent ) break;
                            if ( elP == null ) return null;
                        }
                        if ( numChildTop < numBottom ) {
                            var numChildBottom = numChildTop + elChild.offsetHeight;
                            if ( numChildBottom > numTop ) {
                                var obResult = fnTest ( elChild );
                                if ( obResult == null ) {
                                    obResult = this.fnFindTopCandidate ( elChild, elOffsetParent, numTop, numBottom, fnTest );
                                }
                                if ( obResult != null ) {
                                    return obResult;
                                }
                            }
                        }
                    }
                }
                return null;
            }
            scrollingBrowseListObject.prototype.fnFindTopObject = function ( fnTest ) {
                var numTop = this.elBrowseList.scrollTop;
                var numBottom = numTop + this.elBrowseList.offsetHeight;
                return this.fnFindTopCandidate ( this.elBrowseList, this.elBrowseList, numTop, numBottom, fnTest );
            }
            scrollingBrowseListObject.prototype.fnGetTopListItemElement = function () {
                var obManager = this.manager;
                var fnTest = function ( el ) {
                    if ( el.objectHandle != null ) {
                        var ob = obManager.getObject ( el.objectHandle );
                        if ( ob != null ) {
                            if ( ob.selectable != null ) {
                                return ob;
                            }
                        }
                    }
                    return null;
                }
                return this.fnFindTopObject ( fnTest );
            }
            scrollingBrowseListObject.prototype.fnGetTopListItemIdentifier = function () {
                var strAttr = this.manager.attributePrefix + "ListItemIdentifier";
                var fnTest = function ( el ) {
                    if ( el.nodeType == 1 ) {
                        var str = el.getAttribute ( strAttr );
                        if ( str != null ) {
                            return el;
                        }
                    }
                    return null;
                }
                var el = this.fnFindTopObject ( fnTest );
                if ( el != null ) {
                    return el.getAttribute ( strAttr );
                }
                return null;
            }
            scrollingBrowseListObject.prototype.fnSelectTop = function () {
                if ( this.manager.selectedObject == null ) {
                    var elTop = this.fnGetTopListItemElement ();
                    if ( elTop != null ) {
                        this.manager.setSelectedObject ( elTop );
                    }
                }
            }
            scrollingBrowseListObject.prototype.fnSetFocus = function () {
                this.fnSelectTop ();
                this.elBrowseList.focus ();
            }
            scrollingBrowseListObject.prototype.fnDoScrollUp = function ( numPixels ) {
				trace("","fnDoScrollUp "+ numPixels );
				var temp = this.elBrowseList.scrollTop;
				temp -= numPixels; 
                this.elBrowseList.scrollTop = temp;
            }
            scrollingBrowseListObject.prototype.fnDoScrollDown = function ( numPixels ) {
				trace("","fnDoScrollDown "+ numPixels );
				var temp = this.elBrowseList.scrollTop;
				trace("","scrollTop "+ temp );
				temp += numPixels;
				trace("","try to set to "+ temp );
				//debugger;
                this.elBrowseList.scrollTop = temp;
                trace("","new scrollTop "+ this.elBrowseList.scrollTop );
            }
            scrollingBrowseListObject.prototype.fnGetPercentAsPixels = function ( numPercent ) {
                var numHeight = this.elBrowseList.style.pixelHeight;
                numPercent = parseFloat ( numPercent.toString () );
                return ( numPercent / 100.0 ) * numHeight;
            }
            scrollingBrowseListObject.prototype.fnDoScrollUpPercent = function ( numPercent ) {
                this.fnDoScrollUp ( this.fnGetPercentAsPixels ( numPercent ) );
            }
            scrollingBrowseListObject.prototype.fnDoScrollDownPercent = function ( numPercent ) {
                this.fnDoScrollDown ( this.fnGetPercentAsPixels ( numPercent ) );
            }
            //--------------------------------------------------------
            scrollingBrowseListObject.prototype.onKeyDown = function (e) {
//                if (!e) var e = window.event;
//                var element = getTargetElement( e );
//                var code = getKeyCode( e );

                return false;
            }
            scrollingBrowseListObject.prototype.onKeyPress = function (e) {
//                if (!e) var e = window.event;
//                var element = getTargetElement( e );
//                var code = getKeyCode( e );

                return false;
            }
            scrollingBrowseListObject.prototype.onKeyUp = function () {
            }
            scrollingBrowseListObject.prototype.focusIn = function () {
                if ( ! this.bActive ) {
                    this.fnSelectTop ();
                    this.bActive = true;
                }
            }
            scrollingBrowseListObject.prototype.focusOut = function () {
                this.bActive = true;
            }

//--------------------------------------------------------
        function browseListScrollButtonObject ()
        {
            this.showHover = true;
            this.disabled = false;
        }
        browseListScrollButtonObject.prototype = new baseObject ();

            browseListScrollButtonObject.prototype.start = function ( element ) {
                          
                this.outerElement = element;
                element.objectHandle = this.handle;
                this.localFocusElement = element;
                this.localFocusElement.onfocus = new Function ( "documentManager.controlGetsFocus(" + this.handle + ");" );
                this.localFocusElement.onblur = new Function ( "documentManager.controlLoosesFocus(" + this.handle + ");" );
                var tabIndex = this.getInheritedAttribute ( this.manager.attributePrefix + "TabIndex" );
                if ( tabIndex != null ) {
                    this.localFocusElement.tabIndex = tabIndex;
                }
                this.strListID = this.outerElement.getAttribute ( this.manager.attributePrefix + "ListID" );
                this.strType = this.outerElement.getAttribute ( this.manager.attributePrefix + "Type" );
                this.showHover = this.outerElement.getAttribute ( this.manager.attributePrefix + "ShowHover" ) == "1";
                this.showFocus = this.outerElement.getAttribute ( this.manager.attributePrefix + "ShowFocus" ) == "1";
                if ( this.strType != null ) {
                    this.bUp = this.strType.toLowerCase () == "up"
                }
                this.bDisabled = "unknown";
                this.manager.attatch ( this, false );
                //this.localFocusElement.onclick = this.createCallback ( "fnOnClick" );
                this.localFocusElement.onmousedown = this.createCallback ( "fnOnMouseDown" );
                this.localFocusElement.onmouseup = this.createCallback ( "fnOnMouseUp" );
                this.localFocusElement.onmouseout = this.createCallback ( "fnOnMouseUp" );
                this.fnScrollRepeatCallBack = this.createCallback ( "fnDoScrollRepeat" );
                this.numTickLength = 25;
                this.numTargetScrollPixels = parseFloat ( window.screen.height ) / 150.0;
            }
            browseListScrollButtonObject.prototype.fnGetBrowseListObject = function () {
                if ( this.strListID != null ) {
                    var elBrowseList = xGetElementById( this.strListID );//ddocument.all [ this.strListID ];
                    if ( elBrowseList != null ) {
                        var numHandle = elBrowseList.objectHandle;
                        return documentManager.getObject ( numHandle );
                    }
                }
                return null;
            }
            browseListScrollButtonObject.prototype.fnOnMouseUp = function () {
            
                this.bDown = false;
                this.updateButtonState ();
                return false;
            }
            browseListScrollButtonObject.prototype.fnOnMouseDown = function () {
                if ( ! this.bDown ) {
                    this.bDown = true;
                    this.updateButtonState ();
                    this.fnStartScrollRepeat ();
                }
                return false;
            }
            browseListScrollButtonObject.prototype.fnStartScrollRepeat = function () {
                if ( ! this.bPending ) {
                    this.numTime = null;
                    this.numScrollPixels = this.numTargetScrollPixels;
                    this.fnActionScrollRepeat ();
                    this.fnScheduleScrollRepeat ();
                }
            }
            browseListScrollButtonObject.prototype.fnScheduleScrollRepeat = function () {
                this.bPending = true;
                window.setTimeout ( this.fnScrollRepeatCallBack, this.numTickLength );
            }
            browseListScrollButtonObject.prototype.fnDoScrollRepeat = function () {
                this.fnActionScrollRepeat ();
                if ( this.bDown ) {
                    this.fnScheduleScrollRepeat ();
                } else {
                    this.bPending = false;
                }
            }
            browseListScrollButtonObject.prototype.fnActionScrollRepeat = function () {
                

                trace("","fnActionScrollRepeat");
                var numNewTime = new Date ().getTime ();
                var numScale = 1.0;
                if ( this.numTime != null ) {
                    var numDiff = numNewTime - this.numTime;
                    if ( numDiff > this.numTickLength ) {
                        numScale = 1.0 + ( ( numDiff - this.numTickLength ) / parseFloat ( this.numTickLength ) );
                    }
                }
                var numTargetScrollPixels = numScale * this.numTargetScrollPixels;
                if ( this.numScrollPixels < numTargetScrollPixels ) {
                    this.numScrollPixels += 1.0;
                } else {
                    this.numScrollPixels -= 1.0;
                }
                this.numTime = numNewTime;
                if ( this.bDown ) {
                    if ( this.outerElement == null ) {
                        // The page was unloaded.
                        trace("","we think the page was unloaded")
                    } else {
                        if ( ! this.bDisabled ) {
                            var obList = this.fnGetBrowseListObject ();
                            if ( obList != null ) {
                                if ( this.bUp ) {
									trace("","doScrollup");            
                                    obList.fnDoScrollUp ( this.numScrollPixels );
                                } else {
									trace("","doScrollup");
                                    obList.fnDoScrollDown ( this.numScrollPixels );
                                }
                            }
                        }
                    }
                }
            }
            browseListScrollButtonObject.prototype.notifyChange = function () {
                if ( this.strListID != null ) {
                    var bDisabled = false;
                    if ( this.bUp ) {
                        bDisabled = this.oInterface.read ( this.strListID, "canScrollUp" ) != true;
                    } else {
                        bDisabled = this.oInterface.read ( this.strListID, "canScrollDown" ) != true;
                    }
                    if ( this.bDisabled != bDisabled ) {
                        this.bDisabled = bDisabled;
                        this.updateButtonState ();
                    }
                }
            }

            browseListScrollButtonObject.prototype.updateButtonState = function () {
                if ( this.bDisabled ) {
                    this.localFocusElement.className = "sScrollButtonDisabled";
                } else {
                    this.localFocusElement.className = this.bDown ? "sScrollButtonDown" : "sScrollButtonEnabled";
                }
                this.manager.viewUpdated ();
            }

            
            function xDocManBrowse_Startup()
            {
                documentManager.registerClass ( "scrollButton", browseListScrollButtonObject );
                documentManager.registerClass ( "scrollingBrowseListOld", scrollingBrowseListObject );
            }

