function TextScroll(scrollname, div_name, up_name, down_name)
{
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.low_speed = 1;
    this.high_speed = 2;
    this.timeoutID = 0;
    this.div_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;

this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }

this.goScroll = function() {
       this.scrollDown(0, this.low_speed);
    }
this.stopScroll = function() {
        clearTimeout(this.timeoutID);
    }
this.restartScroll = function() {
        this.stopScroll();		
        this.timeoutID = setTimeout(this.name + ".scrollDown(0, "+this.low_speed+")", 1000);
    }

this.scrollUp = function(bStop, speed) {
	if (bStop==1){this.stopScroll()}
        if (this.div_obj) {
            this.scrollCursor = (this.scrollCursor - speed) < 0 ? 0 : this.scrollCursor - speed;
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollUp(0, "+speed+")", 60);
        }
    }

this.scrollDown = function(bStop, speed) {
	if (bStop==1){this.stopScroll()}
        if (this.div_obj) {
            this.scrollCursor += speed;
            this.div_obj.scrollTop = this.scrollCursor;
            if(this.div_obj.scrollTop>=(this.div_obj.scrollHeight-this.div_obj.offsetHeight)){		
	      this.resetScroll();
	    }
            this.timeoutID = setTimeout(this.name + ".scrollDown(0, "+speed+")", 60);
        }
    }

this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }

{
        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_obj = document.getElementById(this.div_name);
		this.div_obj = div_obj;
		this.div_obj.style.overflow = 'hidden';
		this.resetScroll();
		//this.div_obj.setAttribute("onmouseover", scrollname + ".stopScroll();");
		//this.div_obj.setAttribute("onmouseout",  scrollname + ".scrollDown(0,"+this.low_speed+");");	
		var ls=this.low_speed;
		this.div_obj.onmouseover = function() {eval(scrollname + ".stopScroll();"); }
		this.div_obj.onmouseout = function() {eval(scrollname + ".scrollDown(0,"+ls+");");}		
		this.goScroll();
            }
            div_up_obj = document.getElementById(this.up_name);
			var hs = this.high_speed;
            if (div_up_obj) {               
				div_up_obj.onmouseover = function() {eval(scrollname + ".scrollUp(1,"+hs+");"); }
				div_up_obj.onmouseout = function() {eval(scrollname + ".restartScroll();");}
				//div_up_obj.setAttribute("onmouseover", scrollname + ".scrollUp(1,"+this.high_speed+");");
                //div_up_obj.setAttribute("onmouseout", scrollname + ".restartScroll();")
			}
            div_dn_obj = document.getElementById(this.dn_name);
            if (div_dn_obj) {				
				div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown(1, "+hs+");"); }
				div_dn_obj.onmouseout = function() { eval(scrollname + ".restartScroll();"); }
				//div_dn_obj.setAttribute("onmouseover", scrollname + ".scrollDown(1, "+this.high_speed+");")
                //div_dn_obj.setAttribute("onmouseout", scrollname + ".restartScroll();")
            }
        }
    }

	
}

