﻿//script utilizado para tratar os textos do site.

//Funções para aumentar e diminuir o texto.

//Inicio
var min=9;var max=18;
function increaseFontSize()
{   
	var p = document.getElementsByTagName('p');
	for(i=0;i<p.length;i++)
	{      
		if(p[i].style.fontSize)
		{         
 		  var s = parseInt(p[i].style.fontSize.replace("px",""));
		} 
		else 
		{         
		  var s = 12;
		}      
		if(s!=max) 
		{         
		  s += 1;
		}
	p[i].style.fontSize = s+"px"
	}
}

function decreaseFontSize() 
	{   
	var p = document.getElementsByTagName('p');   
	for(i=0;i<p.length;i++) 
	{      
		if(p[i].style.fontSize) 
		{         
		  var s = parseInt(p[i].style.fontSize.replace("px",""));
		}
		else 
		{         
		  var s = 12;
		}      
		if(s!=min) 
		{         
		  s -= 1;      
		}     
	p[i].style.fontSize = s+"px"
	}   
}
//Fim 

// Início do código de Aumentar/ Diminuir a letra
 
// comando: "javascript:mudaTamanho('tag_ou_id_alvo', -1);" para diminuir
// comando: "javascript:mudaTamanho('tag_ou_id_alvo', +1);" para aumentar
 
var tagAlvo = new Array('p'); //pega todas as tags p//
 
// Especificando os possíveis tamanhos de fontes, poderia ser: x-small, small...
var tamanhos = new Array( '9px','10px','11px','12px','13px','14px','15px', '16px', '17px', '18px' );
var tamanhoInicial = 3;
 
function mudaTamanho( idAlvo, acao ){
  if (!document.getElementById) return
  var selecionados = null,tamanho = tamanhoInicial,i,j,tagsAlvo;
  tamanho += acao;
  if ( tamanho < 0 ) tamanho = 0;
  if ( tamanho > 9 ) tamanho = 9;
  tamanhoInicial = tamanho;
  if ( !( selecionados = document.getElementById( idAlvo ) ) ) selecionados = document.getElementsByTagName( idAlvo )[ 0 ];
  
  selecionados.style.fontSize = tamanhos[ tamanho ];
  
  for ( i = 0; i < tagAlvo.length; i++ ){
    tagsAlvo = selecionados.getElementsByTagName( tagAlvo[ i ] );
    for ( j = 0; j < tagsAlvo.length; j++ ) tagsAlvo[ j ].style.fontSize = tamanhos[ tamanho ];
  }
}
// Fim do código de Aumentar/ Diminuir a letra
