// Documento JavaScript de http://www.gearaguacu.com.br
// Todos os direitos reservados

function link_(endereco){
window.location = endereco;
};

function muda(elemento,bgcolor,color){
elemento.style.background=bgcolor;
elemento.style.color=color;
};

function subli(elemento,n){
if(n==1){elemento.style.textDecoration='underline'}
else{elemento.style.textDecoration='none'}
};

function fadeOut(id, time) {
	target = document.getElementById(id);
	alpha = 100;
	timer = time;
	var i = setInterval(
			function() {
				if (alpha <= 0)
					clearInterval(i);
				setAlpha(target, alpha);
				alpha -= 20;
			}, timer);
}
 
function fadeIn(id, time) {
	target = document.getElementById(id);
	alpha = 0;
	timer = time;
	var i = setInterval(
			function() {
				if (alpha >= 100)
					clearInterval(i);
				setAlpha(target, alpha);
				alpha += 20;
			}, timer);
}
 
function setAlpha(target, alpha) {
	target.style.filter = "alpha(opacity="+ alpha +")";
	target.style.opacity = alpha/100;
}

function define(numero,limite){
  a = numero;
  l = limite;
}

function banner(){
  if (a%l == 0){
    setTimeout("fadeOut('b" + l + "',1);",0);
    setTimeout("setTimeout(\"document.getElementById('b" + l + "').style.display = 'none'\",100);",0);
    setTimeout("setTimeout(\"document.getElementById('b1').style.display = 'block'\",49);",0);
    setTimeout("setTimeout('fadeIn(\"b1\",1)',50);",0);
	a++;
    }
  else{
    setTimeout("fadeOut('b" + a%l + "',1);",0);
    setTimeout("setTimeout(\"document.getElementById('b" + a%l + "').style.display = 'none'\",100);",0);
    setTimeout("setTimeout(\"document.getElementById('b" + parseInt(a%l+1) + "').style.display = 'block'\",49);",0);
    setTimeout("setTimeout('fadeIn(\"b" + parseInt(a%l+1) + "\",1)',50);",0);
	a++;
    }
}

function sobe(){
document.getElementById(sobe.arguments[1]).scrollTop-=sobe.arguments[0];
if (document.getElementById(sobe.arguments[1]).scrollTop!=368){
	swapImage('seta2','preload[2]');
	document.getElementById('seta2').style.cursor='pointer';
	}
if (document.getElementById(sobe.arguments[1]).scrollTop<=0){
	swapImage('seta1','preload[1]');
	document.getElementById('seta1').style.cursor='default';
	}
}

function desce(){
document.getElementById(desce.arguments[1]).scrollTop+=desce.arguments[0]
if (document.getElementById(desce.arguments[1]).scrollTop!=0){
	swapImage('seta1','preload[0]');
	document.getElementById('seta1').style.cursor='pointer';
	}
if (document.getElementById(desce.arguments[1]).scrollTop>=368){
	swapImage('seta2','preload[3]');
	document.getElementById('seta2').style.cursor='default';
	}
}

function preload(){
lista = Array('up_enable.png','up_disable.png','down_enable.png','down_disable.png');
qtd = lista.length;
  for (i = 0; i < qtd; i++) {
    preload[i] = new Image();
    preload[i].src = "images/"+lista[i];
    }
}

function swapImage(target,num){
document.images[target].src = eval(num+'.src');
}