function fadeOut(id, time) {
	target = document.getElementById(id);
	alpha = 100;
	timer = (time)/50;
	var i = setInterval(
			function() {
				if (alpha <= 0)
					clearInterval(i);
				setAlpha(target, alpha);
				alpha -= 2;
			}, timer);
}

function fadeIn(id, time) {
	target = document.getElementById(id);
	alpha = 0;
	timer = (time)/50;
	var i = setInterval(
			function() {
				if (alpha >= 100)
					clearInterval(i);
				setAlpha(target, alpha);
				alpha += 2;
			}, timer);
}

function setAlpha(target, alpha) {
	target.style.filter = "alpha(opacity="+ alpha +")";
	target.style.opacity = alpha/100;
}

var str1,str2,str3;
var link1,link2,link3;
str1 = "Benefícios para Associados";
link1 = "internas.php?pg=beneficios";
var count = 1;

function f_in_out() {	

	fadeOut('news_right', 100);
	setTimeout("changeText()",1000);
	setTimeout("fadeIn('news_right', 100)",1000);
}

function doTimer() {
	
	document.getElementById('news_right').innerHTML = str1.link(link1);
	count = 2;
	setInterval("f_in_out()",4000);
}

function changeText(){
	
	str1 = "Benefícios para Associados";
	link1 = "internas.php?pg=beneficios";
	
	str2 = "Revista Ação Ergonômica: Última edição!";
	link2 = " http://www.abergo.org.br/revista/index.php/ae";

	
	if(count == 1){
		document.getElementById('news_right').innerHTML = str1.link(link1);
		count = 2; 
	} 
	else {
		if(count == 2){
			document.getElementById('news_right').innerHTML = str2.link(link2);
			count = 1; 
		} 
		else {
			if(count == 3){
				document.getElementById('news_right').innerHTML = str3.link(link3);
				count = 1; 
			}
			else {
				if(count == 4){
					document.getElementById('news_right').innerHTML = str4.link(link4);
					count = 1; 
				}
			}			
		}
	}
}


