/**
 *  by Thomas Theilig
 */
 
this.Scroll = function(inTable, inButton, inCaption)
{
	this.minOffset = 460;
	this.captionMove = 50;
	this.interval = 15;
	this.speed = 3;

	this.table = document.getElementById(inTable);
	if (this.table.offsetHeight > this.minOffset)
	{
		document.getElementById(inButton).style.visibility = 'visible';
		document.getElementById(inCaption).style.left = this.captionMove+'px';
	}
}

this.Scroll.prototype._startUp = function()
{
	var that = this;
	this.intScroll = setInterval(function() {that._up(); }, this.interval);
}

this.Scroll.prototype._stopUp = function()
{
	clearInterval(this.intScroll);
}

this.Scroll.prototype._startDown = function()
{
	var that = this;
	this.intScroll = setInterval(function() {that._down(); }, this.interval);
}

this.Scroll.prototype._stopDown = function()
{
	clearInterval(this.intScroll);
}

this.Scroll.prototype._up = function()
{
	this.table.style.top = (this.table.offsetTop + this.speed) + 'px';
	if (this.table.offsetTop >= 0)
	{
		clearInterval(this.intScroll);
		this.table.style.top = '0px';
	}
}

this.Scroll.prototype._down = function()
{
	this.table.style.top = (this.table.offsetTop - this.speed) + 'px';
	if (this.table.offsetTop <= this.minOffset - this.table.offsetHeight)
	{
		clearInterval(this.intScroll);
		this.table.style.top = (this.minOffset - this.table.offsetHeight) + 'px';
	}
}
