var scrollStoped = true;
var frameRate    = 30;
var deslocamento = 5;
var res_id       = -1;
var qtrandon     = 0;

function scrollToRight(begin){
	var objDiv = document.fraGaleria.document.getElementById('divGaleria');
	var left_old = parseInt(objDiv.style.left.toString().substr(0,objDiv.style.left.toString().length-2));
	var left_new = left_old - deslocamento;

	if (left_old <= -190){ stopScroll(); return false; }
	if (begin){ scrollStoped = false; }

	objDiv.style.left = left_new + 'px';
	if (!scrollStoped){ setTimeout('scrollToRight(false)',frameRate); }
}


function scrollToLeft(begin){
	var objDiv = document.fraGaleria.document.getElementById('divGaleria');
	var left_old = parseInt(objDiv.style.left.toString().substr(0,objDiv.style.left.toString().length-2));
	var left_new = left_old + deslocamento;

	if (left_old >= 0){ stopScroll(); return false; }
	if (begin){ scrollStoped = false; }

	objDiv.style.left = left_new + 'px';
	if (!scrollStoped){ setTimeout('scrollToLeft(false)',frameRate); }
}

function stopScroll(){
	scrollStoped = true;
}
function comeca_e() {
	var maxx=document.getElementById('noticias').style.width.replace('px','');
	var tam=document.getElementById('noticias').scrollLeft;
	//alert(tam+'aa'+maxx);
	if(tam<=maxx) {
	document.getElementById('noticias').scrollLeft=tam-2;
	a=setTimeout('comeca_e()', 10);
	}
}
function comeca_d() {
	var maxx=document.getElementById('noticias').style.width.replace('px','');
	var tam=document.getElementById('noticias').scrollLeft;
	if(tam<maxx) {
	document.getElementById('noticias').scrollLeft=tam+2;
	a=setTimeout('comeca_d()', 10);
	}
}
function para() {
	var maxx=document.getElementById('noticias').style.width.replace('px','');
	var tam=document.getElementById('noticias').scrollLeft;
	if(tam<maxx) {
	clearTimeout(a);
	}
}
function comeca_ci() {
	var maxx=document.getElementById('ac').scrollTop;
	var tam=document.getElementById('ac').scrollHeight;
	//alert('top: '+maxx+' height: '+tam);
	if(maxx!=0) {
	document.getElementById('ac').scrollTop-=2;
	a=setTimeout('comeca_ci()', 10);
	}
}
function comeca_ba() {
	//document.getElementById('ac').scrollTop+=5;
	var maxx=document.getElementById('ac').scrollTop;
	var tam=document.getElementById('ac').scrollHeight;
	if(tam>maxx) {
	document.getElementById('ac').scrollTop+=2;
		a=setTimeout('comeca_ba()', 10);
	}
}
function para2() {
	var maxx=document.getElementById('ac').scrollTop;
	var tam=document.getElementById('ac').scrollLeft;
	if(tam<maxx) {
	clearTimeout(a);
	}
}