function TextScroll(scrollname, div_name, up_name, down_name, scrollheight)
{
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 8;
    this.timeoutID = 0;
    this.div_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;
    this.scrollheight = scrollheight;

{
        if (document.getElementById) {
            div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';

            }
            div_up_obj = document.getElementById(this.up_name);
            div_dn_obj = document.getElementById(this.dn_name);
            
        }
    }

this.stopScroll = function() {
        clearTimeout(this.timeoutID);

    }

this.scrollUp = function() {
        if (this.div_obj) {
            this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
        }
    }

this.scrollDown = function() {
        if (this.div_obj) {
            var x = this.scrollCursor + this.speed;
            if(x < this.div_obj.scrollHeight - this.scrollheight)
              this.scrollCursor += this.speed;
            else
              this.scrollCursor = this.div_obj.scrollHeight - this.scrollheight;

            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
        }
    }

this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }
}

function gih(strElem) {
  var obj = $(strElem);
  return(obj.getSize().size.y + obj.getStyle('padding-top').toInt() + obj.getStyle('padding-bottom').toInt());
}
function gih2(strElem) {
  var obj = $(strElem);
  return(obj.getSize().size.y + obj.getStyle('margin-top').toInt() + obj.getStyle('margin-bottom').toInt());
}



function checkContentHeight(strDiv, maxHeight) {
  var x = $(strDiv);
  if(x.scrollHeight > maxHeight)
    return false;
  return true;
}
