// JavaScript Document
//configure delay between changing messages (4000=4 seconds)
var delay=5000;
var ie4=document.all;
var curindex=0;
var totalcontent=0;
var timefoco = 0;
var timecroll = 0;
var over = 0;
var top = 0;
function contract_all(){
	for (y=0;y<totalcontent;y++){
		if (ie4){
			eval("document.all.content"+y).style.display="none";
		}else{
			document.getElementById("content"+y).style.display="none";
		}
	}
}
function expand_one(which){
	contract_all();
	if (ie4){
		eval("document.all.content"+which).style.display="";
	}else{
		document.getElementById("content"+which).style.display="";
	}
}
function rotate_content(){
	contract_all();
	expand_one(curindex);
	scroll_rotate(1);
	over = curindex;
	txtFoco = "";
	for(n=0; n<totalcontent; n++){
		txtFoco+=(n>0 ? "&nbsp;|&nbsp;" : "");
		if(n==curindex){
			txtFoco+="<span class='artigos-subtitulo'><strong>"+(n+1)+"</strong></span>";
		}else{
			txtFoco+="<a href='javascript:foca_rotate("+(n)+")'>"+(n+1)+"</a>";
		}
	}
	document.getElementById("txtNumScroll").innerHTML = txtFoco;
	curindex=(curindex<totalcontent-1)? curindex+1: 0;
}
function foca_rotate(op){
	curindex=op;
	clearTimeout(timefoco);
	clearTimeout(timecroll);
	rotate_content();
}
function scroll_rotate(op){
	obj_rotate = document.getElementById("content"+over);
	if(op==1){
		top=220;
		obj_rotate.style.top = top+"px";
		obj_rotate.style.height = (220-top)+"px";
		obj_rotate.style.clip = "rect(0px auto "+(220-top)+"px auto)"; 
		timecroll = setTimeout('scroll_rotate(0)',20);
		showWait(0);
	}else{
		top = top-3;
		if(top>0){
			obj_rotate.style.top = top+"px";
			obj_rotate.style.height = (220-top)+"px";
			obj_rotate.style.clip = "rect(0px auto "+(220-top)+"px auto)"; 
			timecroll = setTimeout('scroll_rotate(0)',20);
		}else{
			top = 220;
			obj_rotate.style.top = top+"px";
			obj_rotate.style.top = (220-top)+"px";
			timefoco = setTimeout("rotate_content()",delay);
			setTimeout('showWait(1)',delay/3);
		}
	}
}
function showWait(op){
	if(op==1){
		document.getElementById("w_rotate").innerHTML = '<img src="__img/waiting_pp.gif" align="absbottom"/>';
	}else{
		document.getElementById("w_rotate").innerHTML = '<img src="__img/spacer.gif" width="16" height="16" align="absbottom"/>';
	}
}
function rodaThumbCursos(){
	if(rodaThumb>0){
		zoomThumbCursos(rodaThumb);
		rodaThumb++;
		if(rodaThumb>maxThumb){
			rodaThumb = 1;
		}
	}
	setTimeout("rodaThumbCursos()","2500");
}
function zoomThumbCursos(nthumb){
	if(lastThumbCursos>0){
		document.getElementById("cursos_"+lastThumbCursos).style.display = "none";	
	}
	/*
	Destaque a imagem em Thumb
	*/
	document.getElementById("imgThumb_"+lastThumbCursos).style.border = "1px solid #666666";
	document.getElementById("imgThumb_"+nthumb).style.border = "1px solid #000000";
	hideThumb(nthumb);
	/*
	Exibe o curso
	*/
	document.getElementById("cursos_"+nthumb).style.display = "block";
	lastThumbCursos = nthumb;
}
function hideThumb(op){
	for(n=1;n<imgs.length;n++){
		if(n==op){
			MM_swapImage('imgThumb_'+n,'',imgs[n]+'&larg=30');
		}else{
			MM_swapImage('imgThumb_'+n,'',imgs[n]+'&larg=30&f=1');
		}
	}	
}
function stopThumbCursos(){
	rodaThumb = 0;
}
function startThumbCursos(){
	rodaThumb = lastThumbCursos;
}
