

// JavaScript File



var ChatScroll = new Object();
ChatScroll.Pane =
    function(scrollContainerId)
    {
        this.bottomThreshold = 50;
        this.scrollContainerId = scrollContainerId;
    }

ChatScroll.Pane.prototype.resize =
    function()
    {
        var scrollDiv           = document.getElementById(this.scrollContainerId);
        scrollDiv.style.height  = (document.documentElement.clientHeight - 225) + 'px';
        scrollDiv               = null;

        this.scrollToEnd();
    }

ChatScroll.Pane.prototype.scrollToEnd =
    function()
    {
        var scrollDiv       = document.getElementById(this.scrollContainerId);
        scrollDiv.scrollTop = scrollDiv.scrollHeight;
        scrollDiv           = null;
    }

ChatScroll.Pane.prototype.isScrollable =
    function()
    {
        var scrollDiv = document.getElementById(this.scrollContainerId);
        var currentHeight = 0;

        if (scrollDiv.scrollHeight > 0)
            currentHeight = scrollDiv.scrollHeight;
        else
            if (scrollDiv.offsetHeight > 0)
                currentHeight = scrollDiv.offsetHeight;

        var Result = (currentHeight - scrollDiv.scrollTop - ((scrollDiv.style.pixelHeight) ? scrollDiv.style.pixelHeight : scrollDiv.offsetHeight) < this.bottomThreshold);
        scrollDiv  = null;

        return Result;
    }

var chatScroll = new ChatScroll.Pane("ChatWindow");