// JavaScript Document
var rolou = 0;
var rolou_total = 0;
var tamanho_max = 13500;
var rolar_ate = 0;
function verScroll(dir, spd, loop) {
	loop = true;
	rolar = true;
	if (document.layers) {
		var page = eval(document.Cenas_layer);
	}	else {
		if (document.getElementById) {
			var page = eval("document.getElementById('Cenas_layer').style");
		}	else {
			if (document.all) {
				var page = eval(document.all.Cenas_layer.style);
			}
		}
	}

	direction = "up";
	speed = 20;
	scrolltimer = null;
	direction = dir;
	speed = parseInt(spd);
	var y_pos = parseInt(page.left);
	if (rolou_total >= tamanho_max) {
		rolar_ate = rolou;
	}
	//document.getElementById('texto').innerHTML = 'rolou_total = ' + rolou_total + '<br>tamanho_max: '+ tamanho_max;
	if (loop == true) {
		if (direction == "dn" && rolou_total < tamanho_max) {
			page.left = (y_pos - (speed));
			rolou_total += speed;
		} else {
			if (direction == "up" && y_pos < 0) {
				page.left = (y_pos + (speed));
				rolou_total -= speed;
			}
		}
		rolou += speed;
		if (rolar_ate > 0) {
			rolar_ate -= speed;
			if (rolar_ate == 0) {
				rolar = false;
				stopScroll();
				rolou = 0;			
			}
		}
		if (rolou >= 660)  {
			rolar = false;
			stopScroll();
			rolou = 0;
		}
		if (rolar) {
			scrolltimer = setTimeout("verScroll(direction,speed)", 1);
		}
	}
}
function stopScroll() {
	loop = false;
	clearTimeout(scrolltimer);
}
