function rollover(id, image)
{
	document.getElementById(id).src = image;
	//$(id).src = image;
}

function goToPage(page, tp)
{
	if(tp == '0'){
		// Metodo por GET
		document.location = document.getElementById('url_link_page').value + 'page/'+page;
	}else{
		// Metodo por POST
		var botao = document.getElementById('submit_button_name').value;
		document.getElementById('page').value = page;
		document.getElementById(botao).click();
	}
}

function goToPageInput(id, tp)
{
	var pagina = document.getElementById(id).value;

	if(tp == '0'){
		// Metodo por GET
		document.location = document.getElementById('url_link_page').value + 'page/'+pagina;
	}else{
		// Metodo por POST
		var botao = document.getElementById('submit_button_name').value;
		document.getElementById('page').value = pagina;
		document.getElementById(botao).click();
	}
}


function goToResultPerPage(module)
{
	//document.location = "/"+module+'/list/maxperpage/'+document.getElementById('numero_registro_pagina').value;
	document.location = document.getElementById('urlLinkPage').value + 'maxperpage/'+document.getElementById('numero_registro_pagina').value;
}

/**
 * muda focus do campo
 * @param {Object} campo é passado o campo de origem
 * @param {Object} focus é passado o campo que quero focus
 * @param {Object} num é o número de caracteres que vai passar para outro campo o focu
 */
function mudaCampo(campo, focus, num){
  if(document.getElementById(campo).value.length == num){
    document.getElementById(focus).focus();
  }
}

function trocaImagem(id, img){
  document.getElementById(id).style.backgroundImage = 'url('+img+')';
}

function EnviaRastreamento(){
  var login = document.getElementById("txtlogin").value;
  var senha = document.getElementById("txtsenha").value;

  if((login == "" && senha == "") || login == "" || senha == ""){
    document.getElementById("label_login").style.color = "red";
    document.getElementById("label_senha").style.color = "red";
  }
  else{
    document.getElementById("rastreamento").submit();
    document.getElementById("rastreamento").reset();
  }
}

function EnviaTeste(){
  document.getElementById("txtlogin").value = "TESTE";
  document.getElementById("txtsenha").value = "#01102005";

  document.getElementById("rastreamento").submit();
  document.getElementById("rastreamento").reset();
}

function Compartilhar(){
  var share = document.getElementById("compartilhamento");

  if(share.style.display == 'block')
    share.style.display = 'none';
  else
    share.style.display = 'block';
}

// 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('p', 'div'); //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;
  if ( acao == 0 ) tamanho = 3;
  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


function alteraRegiao(valor){
  if(valor == 0){
    alert('Selecione uma região!');
    document.frmUser.regiao.focus();
  }
  if(valor == 1){
    document.frmUser.action="http://189.74.238.83/laudos/default.asp";
    document.frmUser.submit();   
  }     
  if(valor == 2){
    document.frmUser.action="http://200.96.108.65/laudos/default.asp";
    document.frmUser.submit();   
  }
}

