// Rotina para Aumentar/ Diminuir a fonte
 
// Para diminuir use o comando: "javascript:mudaTamanho('tag_ou_id_alvo', -1);"
// Para aumentar use o comando: "javascript:mudaTamanho('tag_ou_id_alvo', +1);"
 
var tagAlvo = new Array('p'); //pega todas as tags p//
 
// Especificar os possíveis tamanhos de fontes, poderia ser: x-small, small... e tamanho default
var tamanhos = new Array('09px','10px','11px','12px','13px','14px','15px', '17px', '18px' );
var tamanhoInicial = 5;
 
function mudaTamanho( idAlvo,acao )
{

  // verificar se os parametros foram informados
  if (!document.getElementById) return

  // inicializar variaveis
  var selecionados = null,tamanho = tamanhoInicial,i,j,tagsAlvo;
  tamanho += acao;

  // verificar se o tamanho mínimo foi atingido
  if ( tamanho < 0 ) tamanho = 0;
  
  // verificar se o tamanho máximo foi atingido
  if ( tamanho > 8 ) tamanho = 8;
  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 ];
  }
}
