// JavaScript Document

// Início do código de Aumentar/ Diminuir a letra
 
// Para usar coloque o comando: "javascript:mudaTamanho('tag_ou_id_alvo', -1);" para diminuir
// e o comando "javascript:mudaTamanho('tag_ou_id_alvo', +1);" para aumentar
 
var tagAlvo = new Array('a','font','td','th'); //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','14px','16px','18px' );
var tamanhoInicial = 2;
 
function mudaTamanho( idAlvo,acao ){
  if (!document.getElementById) return
  var selecionados = null,tamanho = tamanhoInicial,i,j,tagsAlvo;
  tamanho += acao;
  if ( tamanho < 3 ) tamanho = 3;
  if ( tamanho > 6 ) tamanho = 5;
  tamanhoInicial = tamanho;
  if ( !( selecionados = document.getElementById( idAlvo ) ) ) selecionados = document.getElementsByTagName( idAlvo )[ 0 ];
  
  selecionados.style.fontSize = tamanhos[ tamanho ];
  

	for (var j=0;j<tagAlvo.length;j++){
		var e=document.getElementsByTagName(tagAlvo[j]);
		for(var i=0;i<e.length;i++){
			if(e[i].className!="imutable"){
			  e[i].style.fontSize = tamanhos[ tamanho ];
			}
		}
	}

		var e=document.getElementsByTagName(tagAlvo[1]);
			for(var i=0;i<e.length;i++){
			if(e[i].className!="imutable"){
				e[i].style.fontSize = tamanhos[ tamanho + 2 ];
			}
		}
}

// JavaScript Document

// Função que cria o cookie
function GerarCookie(strCookie, strValor, lngDias)
{
    var dtmData = new Date();

    if(lngDias)
    {
        dtmData.setTime(dtmData.getTime() + (lngDias * 24 * 60 * 60 * 1000));
        var strExpires = "; expires=" + dtmData.toGMTString();
    }
    else
    {
        var strExpires = "";
    }
    document.cookie = strCookie + "=" + strValor + strExpires + "; path=/";
}

// Função para ler o cookie.
function LerCookie(strCookie)
{
    var strNomeIgual = strCookie + "=";
    var arrCookies = document.cookie.split(';');

    for(var i = 0; i < arrCookies.length; i++)
    {
        var strValorCookie = arrCookies[i];
        while(strValorCookie.charAt(0) == ' ')
        {
            strValorCookie = strValorCookie.substring(1, strValorCookie.length);
        }
        if(strValorCookie.indexOf(strNomeIgual) == 0)
        {
            return strValorCookie.substring(strNomeIgual.length, strValorCookie.length);
        }
    }
    return null;
}

// Função para excluir o cookie desejado.
function ExcluirCookie(strCookie)
{
    GerarCookie(strCookie, '', -1);
}

// Função que verifica o cookie ao carregar a pagina
function VerificaCookie()
{
	verifica = LerCookie('Fonte')
	if (verifica != null && verifica != "")
	{}
	else
	{
		GerarCookie('Fonte', 0, 30);
	}
}

// Subtrai 1 ao valor do cookie
function subtrair()
{
	cook = LerCookie('Fonte');
	cook = --cook;
	if (cook < 1 ){ cook = 1 };
	GerarCookie('Fonte', cook, 30);
}

// Adiciona 1 ao valor do cookie
function adicionar()
{
	cook = LerCookie('Fonte');
	cook = ++cook;
	if (cook > 5 ){ cook = 4 };
	GerarCookie('Fonte', cook, 30);
}
