/**
 * _ti - id elementu, ktery chci zkrolovat
 * _bb - tlacitko zpet
 * _bb - tlacitko dopredu
 */
function SimpleVerticalScroller (_ti, _bb, _bf) {
	var ref = this;
	this.ti = SJEL.$(_ti); SJEL.SStyle(this.ti, {overflow: "hidden"});
	this.bb = SJEL.$(_bb);
	this.bf = SJEL.$(_bf);
	this.tii = SJEL.CE("div");
	this.tii.innerHTML = this.ti.innerHTML;
	this.ti.innerHTML = "";
	this.ti.appendChild(this.tii);
	this.max = this.ti.offsetHeight - this.tii.offsetHeight;
	this.step = 4;
	this.mt = 0;  // margin-top
	this.bfe = this.bbe = false;
	
	if (this.max >= 0)  // vyska this.ti je vetsi jak vnitrek this.ti
		return;

	SJEL.AddClass(this.bb, "bw_but");
	SJEL.AddClass(this.bf, "fw_but");
	
	this.bfe = true; 
	SJEL.AddClass(this.bf, "fw_but_on");

	this.OnButBTimer = function () {
		ref.mt += ref.step;
		if (ref.mt > 0) {
			ref.mt = 0;
			ref.tab.Stop();
			SJEL.RemoveClass(ref.bb, "bw_but_on");
			ref.bbe = false;
		}
		/*if (SJEL.ie && !ref.mt)
			ref.mt = 0;*/
		SJEL.SStyle(ref.tii, {marginTop: ref.mt + "px"});
		if (!ref.bfe) {
			SJEL.AddClass(ref.bf, "fw_but_on");
			ref.bfe = true;
		}
	}

	this.OnButFTimer = function () {
		ref.mt -= ref.step;
		if (ref.mt < ref.max) {
			ref.mt = ref.max;
			ref.taf.Stop();
			SJEL.RemoveClass(ref.bf, "fw_but_on");
			ref.bfe = false;
		}
		/*if (SJEL.ie && !ref.mt)
			ref.mt = 0;*/
		SJEL.SStyle(ref.tii, {marginTop: ref.mt + "px"});
		if (!ref.bbe) {
			SJEL.AddClass(ref.bb, "bw_but_on");
			ref.bbe = true;
		}
	}
	
	this.tab = new SJEL.Timer(this.OnButBTimer);
	this.taf = new SJEL.Timer(this.OnButFTimer);
	
	this.bb.onmouseover = function () {
		ref.tab.Start(true);
	}
	this.bb.onmouseout = function () {
		ref.tab.Stop();
	}

	this.bf.onmouseover = function () {
		ref.taf.Start(true);
	}
	this.bf.onmouseout = function () {
		ref.taf.Stop();
	}	
}
