////
//		objektas gali buti sukurtas dar nepakrovus scroll'inimo konteinerių
//		init() kviečiame kai scroll'inimo konteineriai pakrauti
////
function ScrollCont_class(variableString_param)
{
	//	properties
	
	this.ready = false					//indikuoja, kad inincializuotas ir gali veikti
	this.variableString = variableString_param
	this.contCliped; this.contClipedCH; this.contMove; this.contMoveSH;
	this.repeatSpead = 30				//If you want it to move faster you can set this lower, it's the timeout:
	this.loop
	this.repeatingRef
	this.contMove_x = 0
	this.contMove_y = 0
	
	//	methods
	
	this.init = function(contCliped_param,contMove_param)
	{
		this.contCliped = findObj(contCliped_param)
		this.contClipedCH = this.contCliped.offsetHeight		// contClipedCH - Clip Height
		this.contMove = findObj(contMove_param)
		this.contMoveSH = this.contMove.offsetHeight				// contMoveSH - Scroll Height
		this.move(0,0)
		this.show()
		this.ready = true
	}
	
	this.show = function()
	{
		this.contCliped.style.visibility = "visible"
	}
	
	this.reset = function()
	{
		this.move(0,0)
		this.contMoveSH = this.contMove.offsetHeight
	}
	
	this.resetHeight = function()
	{
		this.contMoveSH = this.contMove.offsetHeight
		this.contClipedCH = this.contCliped.offsetHeight
	}

	this.up =  function(step) 
	{
		if (this.contMove_y < 0) this.move(0,this.contMove_y - step)
		else clearInterval(this.repeatingRef)
	}
	
	this.down =  function(step) 
	{
		if (this.contMove_y > this.contClipedCH - this.contMoveSH) this.move(0,this.contMove_y - step)
		else clearInterval(this.repeatingRef)
	}
	
	this.move =  function(x,y)
	{
		this.contMove_x = x; this.contMove_y = y
		this.contMove.style.left = this.contMove_x + 'px'
		this.contMove.style.top = this.contMove_y + 'px'
	}
	
	this.stop =  function()
	{
		clearInterval(this.repeatingRef)
	}
	
	this.scroll =  function(step)
	{
		if (this.ready)
		{
			clearInterval(this.repeatingRef)
			//if (step>0) this.repeatingRef = setInterval('RSstate.DZs['+RSstate.findDZindex(this.DZid)+'].scrollObj.down('+step+')',this.repeatSpead)
			//else this.repeatingRef = setInterval('RSstate.DZs['+RSstate.findDZindex(this.DZid)+'].scrollObj.up('+step+')',this.repeatSpead)
			if (step>0) this.repeatingRef = setInterval(this.variableString+'.down('+step+')',this.repeatSpead)
			else this.repeatingRef = setInterval(this.variableString+'.up('+step+')',this.repeatSpead)
		}
	}
}
