/*
    (C) Copyright 2005 Bohumil Sladek (bobo@dotek.cz)
*/

    //  ScrollButton object (begin)
    //  Objekt definuje metody pro scrolovaci tlacitka
    function ScrollButton(name, direction)
    {
        this.Name = name;
        this.Direction = direction;

        this.OnMouseOver = ScrollButton_OnMouseOver;
        this.OnMouseOut = ScrollButton_OnMouseOut;
        this.OnMouseDown = ScrollButton_OnMouseDown;
        this.OnMouseUp = ScrollButton_OnMouseUp;
        this.OnClick = ScrollButton_OnClick;
        this.UpdateState = ScrollButton_UpdateState;
    }

    function ScrollButton_OnMouseOver()
    {
    }

    function ScrollButton_OnMouseOut()
    {
        objContent.AutoScrollOff();
    }

    function ScrollButton_OnMouseDown()
    {
        if (document.getElementById(this.Name).className == this.Name + "enabled")
            objContent.AutoScrollOn(this.Direction);
    }

    function ScrollButton_OnMouseUp()
    {
        objContent.AutoScrollOff();
    }

    function ScrollButton_OnClick()
    {
        //objContent.Scroll(this.Direction);
    }

    function ScrollButton_UpdateState()
    {
        var sb = document.getElementById(this.Name);
        if (sb != null)
        {
            var newName = this.Name + ((objContent.CanScroll(this.Direction)) ? "enabled" : "disabled");
            if (sb.className != newName)
                sb.className = newName;
        }
    }

    function UpdateScrollButtonsState()
    {
        objScrollButtonUp.UpdateState();
        objScrollButtonDown.UpdateState();
    }

    var objScrollButtonUp = new ScrollButton("scrollButtonU", "Up");
    var objScrollButtonDown = new ScrollButton("scrollButtonD", "Down");
    //  ScrollButton object (end)
