function SetVScrollBtns(strContainer, strVScrollBtnUp, strVScrollBtnDown)

{
    var Container  = document.getElementById(strContainer);
    var VScrollBtnUp  = document.getElementById(strVScrollBtnUp);
    var VScrollBtnDown  = document.getElementById(strVScrollBtnDown);
    if (Container && VScrollBtnUp && VScrollBtnDown) 
    {
        if (Container.scrollHeight > Container.clientHeight)
        {
            VScrollBtnUp.style.visibility = 'visible';
            VScrollBtnDown.style.visibility = 'visible';
        }
        else
        {
            VScrollBtnUp.style.visibility = 'hidden';
            VScrollBtnDown.style.visibility = 'hidden';
        }
    }
}    

function DoBtnScroll(obj, direction)
{
  var TextComtainer = document.getElementById(obj);
  if (TextComtainer)
  {
      if (direction=="up")
      { 
         TextComtainer.scrollTop = TextComtainer.scrollTop - TextComtainer.clientHeight * 0.8;
      } 
      else
      { 
         TextComtainer.scrollTop = TextComtainer.scrollTop + TextComtainer.clientHeight * 0.8;
      }
  }
}

/* End VScrollButton */

/* VScrollBar */

function VScrollBar(strContainer, strVScrollBar)
{
    this.Container  = document.getElementById(strContainer);
    this.ScrollBar  = document.getElementById(strVScrollBar);
    this.ScrollBarTop = null;
    this.ScrollBarCenter = null;
    this.ScrollingCenter = null;
    this.ScrollBarBottom = null;
    if (this.Container && this.ScrollBar) 
    {
        this.Container.style.overflow = 'hidden';
        this.Container.style.display = 'inline';
        for (var i=0; i < this.ScrollBar.childNodes.length; i++)
        {
            if (this.ScrollBar.childNodes.item(i).tagName == "DIV")
            {
                if (!this.ScrollBarTop)
                {
                   this.ScrollBarTop = this.ScrollBar.childNodes.item(i);
                }
                else if (!this.ScrollBarCenter)
                {
                    this.ScrollBarCenter = this.ScrollBar.childNodes.item(i);                
                }
               else if (!this.ScrollBarBottom)
                {
                    this.ScrollBarBottom = this.ScrollBar.childNodes.item(i);                
                }
            }
        }
        for (var i=0; i < this.ScrollBarCenter.childNodes.length; i++)
        {
            if (this.ScrollBarCenter.childNodes.item(i).tagName == "DIV")
            {
                if (!this.ScrollingCenter)
                {
                    this.ScrollingCenter  = this.ScrollBarCenter.childNodes.item(i);
                }
            }
        }
        if (this.Container.scrollHeight > this.Container.clientHeight)
        {
            this.ScrollBarCenter.style.height = this.Container.clientHeight - this.ScrollBarTop.offsetHeight * 2;
            this.ScrollingCenter.style.height = this.ScrollBarCenter.clientHeight  * this.Container.clientHeight / this.Container.scrollHeight;
            this.ScrollBar.style.visibility = 'visible';
        }
        else
        {
            this.ScrollBar.style.visibility = 'hidden';    
        }
       
       /* this.ScrollBarBottom.onclick = 
        function () 
       { 
            alert(this.Container.clientHeight);
        };
        */
    }
}
function DoScroll(obj, direction)
{
  var scrollbar = eval(obj);
  var objContainer = scrollbar.Container;
  var objScrollBarCenter = scrollbar.ScrollBarCenter;
  var objScrollingCenter = scrollbar.ScrollingCenter;

  if (direction=="up")
  { 
     objContainer.scrollTop = objContainer.scrollTop - objContainer.clientHeight * 0.8;
  } 
  else
  { 
     objContainer.scrollTop = objContainer.scrollTop + objContainer.clientHeight * 0.8;
  }
  var MaxScroll = objContainer.scrollHeight - objContainer.clientHeight;
  objScrollingCenter.style.top = (objScrollBarCenter.offsetHeight - objScrollingCenter.offsetHeight) / MaxScroll * objContainer.scrollTop ;
}
/* End VScrollBar */
