/******************************************
* Scrollable content script II- © Dynamic Drive (www.dynamicdrive.com)
* Visit http://www.dynamicdrive.com/ for full source code
* This notice must stay intact for use
******************************************/

iens6 = document.all||document.getElementById
ns4 = document.layers

//specify speed of scroll (greater = faster)
var speed = 4;
var crossobj;
var largura = 170;
var largura_hor = 139.5 //838;
var bloco = 1;
var lefttime = null;
var righttime = null;
var lefttime = null;
var righttime = null;

/* Rolagem Vertical */
function moveDown(total){
	crossobj = document.getElementById ? document.getElementById("content") : document.all.content
	if (iens6 && parseInt(crossobj.style.top) >= (largura*bloco*(-1))) {
		crossobj.style.top = parseInt(crossobj.style.top)-speed+"px";
		downtime = setTimeout('moveDown("' + total + '")',20);
	}
	else if (ns4 && crossobj.top >= (largura*(-1))) {
		crossobj.top -= speed;
		downtime = setTimeout('moveDown("' + total + '")',20);
	}
	else {
		if (downtime != null) { stopDown(total); }
	}
}


function moveUp(total){
	crossobj = document.getElementById ? document.getElementById("content") : document.all.content
	if (iens6 && parseInt(crossobj.style.top) <= ((largura*(bloco-2))*(-1))) {
		crossobj.style.top = parseInt(crossobj.style.top)+speed+"px"
		uptime = setTimeout('moveUp("' + total + '")',20)
	}
	else if (ns4&&crossobj.top < 0) {
		crossobj.top += speed
		uptime = setTimeout('moveUp("' + total + '")',20)
	}
	else {
		if (uptime != null) { stopUp(total); }
	}
}


function stopUp(total) {
	clearTimeout(uptime);
	bloco = bloco - 1;
	document.getElementById('mn_01_esquerda').style.visibility = bloco == 1 ? 'hidden' : 'visible';
	document.getElementById('mn_02_direita').style.visibility = bloco == total ? 'hidden' : 'visible';
}


function stopDown(total) {
	clearTimeout(downtime)
	bloco = bloco + 1;
	document.getElementById('mn_01_esquerda').style.visibility = bloco == 1 ? 'hidden' : 'visible';
	document.getElementById('mn_02_direita').style.visibility = bloco == total ? 'hidden' : 'visible';
}
/* FIM - Rolagem Vertical */


/* Rolagem Horizontal */
function moveRight(total){
	crossobj = document.getElementById ? document.getElementById("content") : document.all.content
	//contentheight = crossobj.offsetWidth

	if (iens6 && parseInt(crossobj.style.left) >= (largura_hor*total*(-1))) {
		crossobj.style.left = parseInt(crossobj.style.left)-speed+"px"
	}
	else if (ns4 && crossobj.left >= (largura_hor*total*(-1))) {
		crossobj.left -= speed
	}

	righttime = setTimeout('moveRight('+total+')',20)
}


function moveLeft(total){
	crossobj = document.getElementById ? document.getElementById("content") : document.all.content
	if (iens6 && parseInt(crossobj.style.left) < 0) {
		crossobj.style.left = parseInt(crossobj.style.left)+speed+"px"
	}
	else if (ns4&&crossobj.left < 0) {
		crossobj.left += speed
	}
	
	lefttime = setTimeout("moveLeft("+total+")",20)
}


function stopLeft() {
	clearTimeout(lefttime)
}


function stopRight() {
	clearTimeout(righttime)
}
/* FIM - Rolagem Horizontal */