// Setando as variáveis de aumento de fonte

var defaultFontSize = 100;
var maximumFontSize = 300;
var currentFontSize = defaultFontSize;

function resetFontSize() {
	resetSize = defaultFontSize - currentFontSize;
	changeFontSize(resetSize);
}

function changeFontSize(sizeDifference) {
	currentFontSize = currentFontSize + sizeDifference;

	if(currentFontSize > maximumFontSize) { alert('Você já chegou ao tamanho máximo!'); currentFontSize = 300;  }
	else if(currentFontSize < 60) { alert('Você já chegou ao tamanho mínimo!'); currentFontSize = 60;  }

	setFontSize(currentFontSize);
}

function setFontSize(fontSize){ document.getElementById('areaTexto').style.fontSize = fontSize + '%'; }


function areaTexto(x) {
	if (x == "A") { changeFontSize(10); }
	else if (x == "D") { changeFontSize(-10); }
	else { resetFontSize(); }
}
	
var atual = 1; //esta var guarda o valor que tá sendo exibido agora.
var timeloop; //guardará o setInterval

function muda(qual){
        
	//divs que estão dentro do destaques colocadas num array
    var divs = document.getElementById("showIndice").getElementsByTagName("div");
	var lis = document.getElementById("boxIndices").getElementsByTagName("li");
    
	//formatando o qual
    var qual_num = Number(qual);
    if (qual_num < 1){ qual_num = divs.length; }
    else if (qual_num > divs.length) { qual_num = 1; }

    //colocando o zero antes se for necessário
    if (qual_num<10) {qual = "0" + qual_num} else { qual = qual_num };

    //voltando a classe de todas para o padrão que é vazio (resetando)
    for (var i = 0;i < divs.length;i++){ divs[i].className = ""; }
	for (var i = 0;i < lis.length;i++){ lis[i].className = ""; }

    //aplicando a classe exibe na que for pra exibir
    document.getElementById("ind_"+qual).className = "showIt";
	document.getElementById("item_"+qual).className = "on";
	
    //setando o atual
    atual = qual_num;
	
}

function iniciaAutomatico() {
    timeloop = setInterval("muda(Number(atual)+1)",3000);
}

function changeImg() {
	images = new Array(4);
	images[0] = '/imagens/imagem_01.gif';
	images[1] = '/imagens/imagem_02.gif';
	images[2] = '/imagens/imagem_03.gif';
	images[3] = '/imagens/imagem_04.gif';
	//images[4] = '/imagens/imagem_05.gif';
	//images[5] = '/imagens/imagem_06.gif';
	//images[6] = '/imagens/imagem_07.gif';
	//images[7] = '/imagens/imagem_08.gif';
	//images[8] = '/imagens/imagem_09.gif';
	//images[9] = '/imagens/imagem_10.gif';

	index = Math.floor(Math.random()*images.length);
	
	document.write('<img src="' + images[index] + '" />');
}

//Função para adicionar arquivos em Flash às páginas

function addFlash(_src,_w,_h,_version){
	var novoHtml = '';
 	novoHtml += '  <object height="'+_h+'" width="'+_w+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	novoHtml += '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+_version+'" ';
	novoHtml += '  align="">';
	novoHtml += '    <param name="movie"   value="'+_src+'" />';
	novoHtml += '    <param name="quality" value="high" />';
	novoHtml += '    <param name="wmode"   value="transparent" />';
	novoHtml += '    <param name="bgcolor" value="#FFFFFF" />';
	novoHtml += '    <embed wmode="transparent" src="'+_src+'" pluginspage="http://www.macromedia.com/go/getflashplayer" height="'+_h+'" width="'+_w+'"></embed>';
	novoHtml += '  </object>';
  document.write(novoHtml);
}


function dataDeHoje() {
	data = new Date();
	dia = data.getDate();
	mes = data.getMonth();
	ano = data.getFullYear();
	nomeMes = 'Janeiro,Fevereiro,Março,Abril,Maio,Junho,Julho,Agosto,Setembro,Outubro,Novembro,Dezembro'.split(',');
	document.write('' + dia + ' de ' + nomeMes[mes] + ' de ' + ano + '');
} 

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

objTimerBannerzao = setInterval('fncEsconderBanner()', 20000);

function fncEsconderBanner() { document.getElementById("bannerzao").style.display = 'none'; }

function open_center(url, name, params, Wwidth, Wheight) {
    Swidth = screen.width;
    Sheight = screen.height;

    Wleft = Math.floor((Swidth / 2) - (Wwidth / 2) - 8);
    Wtop = Math.floor((Sheight / 2) - (Wheight / 2) - 20);

    params = params+",left="+Wleft+",top="+Wtop+",width="+Wwidth+",height="+Wheight;

    window.open(url, name, params);
}
