function TextScrollAdv(scrollname, div_name, scrollbar_name, padding, up_name, down_name)
{
    this.div_name = div_name;
    this.scrollbar_name = scrollbar_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 5;
    this.timeoutID = 0;
    this.div_obj = null;
    this.scrollbar_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;

	{

		if (document.getElementById) 
		{
			div_obj = document.getElementById(this.div_name);
			scrollbar_obj = document.getElementById(this.scrollbar_name);
			if (div_obj && scrollbar_obj) 
			{
				this.div_obj = div_obj;
				this.scrollbar_obj = scrollbar_obj;
				this.div_obj.style.overflow = 'hidden';
				var totalheight = padding;
				if (window.getComputedStyle) totalheight += 1;
				else totalheight += 3;
				var child;
				for (var i = 0; i < this.div_obj.parentNode.childNodes.length; i++)
				{
					child = this.div_obj.parentNode.childNodes[i];
					if (child && (child.tagName == "DIV") &&
							(child != this.div_obj) && (child != this.scrollbar_obj))
					{
						totalheight += child.offsetHeight;
					}
				}
				totalheight = this.div_obj.parentNode.clientHeight - totalheight;
				if (totalheight < this.div_obj.scrollHeight)
				{
					totalheight -= this.scrollbar_obj.offsetHeight;
					this.scrollbar_obj.style.visibility = "visible";
				}
				totalheight += "px";
				this.div_obj.style.height = totalheight;
			}
			div_up_obj = document.getElementById(this.up_name);
			div_dn_obj = document.getElementById(this.dn_name);
			if (div_up_obj && div_dn_obj) 
			{
				div_up_obj.onmouseover = function() { eval(scrollname + ".scrollUp();") };
				div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
				div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown();") };
				div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
			}
		}
    }

	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) {
			this.scrollCursor += this.speed;
			this.div_obj.scrollTop = this.scrollCursor;
			if (this.div_obj.scrollTop == this.scrollCursor) {
				this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
			} else {
				this.scrollCursor = this.div_obj.scrollTop;
			}
		}
	}
	
	this.resetScroll = function() {
		if (this.div_obj) {
			this.div_obj.scrollTop = 0;
			this.scrollCursor = 0;
		}
	}
	/*
	this.hideScroll = function() {
		if (this.div_obj.clientHeight > (this.div_obj.scrollHeight-this.div_obj.clientHeight)) {
			document.getElementById('scroll_up').style.display="none";
			document.getElementById('scroll_down').style.display="none";
		}
	}
	
	this.hideScroll();	
		*/	
}
