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();")
			}
		}
	}

}


function TextScrollH(scrollname, div_name, lft_name, rgt_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.lft_name = lft_name;
    this.rgt_name = rgt_name;

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

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

	this.scrollLeft = 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.scrollLeft = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollLeft(0, "+speed+")", 50);
        }
    }

	this.scrollRight = function(bStop, speed) {
		if (bStop==1){this.stopScroll()}
		if (this.div_obj) {
			this.scrollCursor += speed;
			this.div_obj.scrollLeft = this.scrollCursor;
			if(this.div_obj.scrollLeft>=(this.div_obj.scrollWidth-this.div_obj.offsetWidth)){		
				this.resetScroll();
			}
			this.timeoutID = setTimeout(this.name + ".scrollRight(0, "+speed+")", 50);
		}
	}

	this.resetScroll = function() {
		if (this.div_obj) {
			this.div_obj.scrollLeft = 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 + ".scrollRight(0,"+this.low_speed+");");	
				var ls=this.low_speed;
				this.div_obj.onmouseover = function() {eval(scrollname + ".stopScroll();"); }
				this.div_obj.onmouseout = function() {eval(scrollname + ".scrollRight(0,"+ls+");");}
				this.goScroll();
			}
			div_lft_obj = document.getElementById(this.lft_name);
			var hs = this.high_speed;
			if (div_lft_obj) {               
				div_lft_obj.onmouseover = function() {eval(scrollname + ".scrollLeft(1,"+hs+");"); }
				div_lft_obj.onmouseout = function() {eval(scrollname + ".restartScroll();");}
				//div_lft_obj.setAttribute("onmouseover", scrollname + ".scrollLeft(1,"+this.high_speed+");");
				//div_lft_obj.setAttribute("onmouseout", scrollname + ".restartScroll();")
			}
			div_rgt_obj = document.getElementById(this.rgt_name);
			if (div_rgt_obj) {				
				div_rgt_obj.onmouseover = function() { eval(scrollname + ".scrollRight(1, "+hs+");"); }
				div_rgt_obj.onmouseout = function() { eval(scrollname + ".restartScroll();"); }
				//div_rgt_obj.setAttribute("onmouseover", scrollname + ".scrollRight(1, "+this.high_speed+");")
				//div_rgt_obj.setAttribute("onmouseout", scrollname + ".restartScroll();")
			}
		}
	}

}

