//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div');

//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','large','x-large','xx-large' );
var startSz = 2;
function nova_janela(obj) {
   if (obj.value!='0'){
      window.open(obj.value);
   }
}

function ts( trgt,inc ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;
sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 5 ) sz = 5;
startSz = sz;
if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0; i < tgs.length; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0; j < cTags.length; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}

/*var imgatual=0;
var basea="";
	var img = new Array();
	img[0] = "img0.png";
	img[1] = "img1.png";
	img[2] = "img2.png";
	img[3] = "img3.png";*/

function nextImage() {
	imgatual++;
	if(imgatual == 3) imgatual=0;
	document.getElementById("rand").innerHTML='<img id="imgtopo" style="margin-top: 3px;margin-right: 5px; opacity:0;" src="'+basea+'/'+img[imgatual]+'" />';
	fadeIn('imgtopo',5); 
}

function imgRand(base) {
	basea = base;
	var a = Math.floor(Math.random()*4);
	document.getElementById("rand").innerHTML='<img id="imgtopo" style="margin-top: 3px;margin-right: 5px; opacity:0;" src="'+base+'/'+img[a]+'" />';
	fadeIn('imgtopo',5); 
}
function fadeOut(id, time) {
	target = id; //document.getElementById(id);
	alpha = 100;
	timer = (time*1000)/50;
	var i = setInterval(
			function() {
				if (alpha <= 0) {
					clearInterval(i);
					if((img_noticia_atual+1) >= img.length) img_noticia_atual=0;
					else img_noticia_atual++;
					fadeIn('alvo', time);
				}
				setAlpha(target, alpha);
				alpha -= 2;
			}, timer);
}

function fadeIn(id, time) {
	target = document.getElementById(id);
	setAlpha(target, 0);
	target.src = img[img_noticia_atual];
	target.style.width= tamanhosW[img_noticia_atual]+"px" ;//largura+"px";
	target.height= tamanhosH[img_noticia_atual]+"px";//altura+"px";
	target.style.visibility="visible";
	cap = document.getElementById("caption");
	cap.innerHTML = caption[img_noticia_atual];
	cap.style.width= tamanhosW[img_noticia_atual]+"px";//largura+"px";
	alpha = 0;
	timer = (time*1000)/50;
	var i = setInterval(
			function() {
				if (alpha >= 100) {
					clearInterval(i);
					if(img.length==1) return 0;
					setTimeout(function() { fadeOut(target,time); },3000);
					//wait(target, time);
				}
				setAlpha(target, alpha);
				alpha += 2;
			}, timer);
}

function setAlpha(target, alpha) {
	target.style.filter = "alpha(opacity="+ alpha +")";
	target.style.opacity = alpha/100;
}

