function confirmaLink(msg,hiperlink){
	if(confirm(msg)){
				location.href=hiperlink;
				} else {
				return false;
				};
}

function mudar_abas_inicial(total,atual) {
	for(i=0;i<total;i++){
		document.getElementById("aba_"+i).className="aba_off";
		}
		document.getElementById("aba_"+atual).className="aba_on";
}

function carregaAjax(url,alvo,carregando){
	$.ajax(
		{
		  url: url,
		  cache: false,
		  beforeSend: function(){
		  		$(carregando).show();
				$(alvo).hide();
		  		},
		  success: function(html){
		  		$(carregando).hide();
				$(alvo).show();
				$(alvo).html(html);
				//$("#conteudo").innerHTML(html); -> ADICIONAR AO CONTEUDO EXISTENTE
				}
			}
		);
	}


function somenteNumeros(e){
	
	<!--  onKeyPress="return somenteNumeros(event);" !-->
	
  if (e.keyCode) { // IE   
    tecla = e.keyCode;   
  }  else if (e.which) { // Firefox   
    tecla = e.which;   
  }  else { // Sei lá! :P   
    return false;   
  }   

  if(tecla > 44 && tecla < 58) // numeros de 0 a 9
    return true;
  else {
      if (tecla != 8) // backspace
        return false;
      else
        return true;
    }
}

function contarCaracteres(campo, contador, limite) {
	if (campo.value.length > limite) {
	campo.value = campo.value.substring(0, limite);
	} else {
	alvo = document.getElementById(contador)
	alvo.innerText = limite - campo.value.length;
	}
}

function ampliarFoto(foto,legenda){
			tabelafoto = document.getElementById("tabelatransparenciafotoampliada")
			tabelafoto1 = document.getElementById("basefotoampliada")
			tabelafoto1.style.paddingTop=document.body.scrollTop

			var alturatabela = document.body.scrollHeight ;
			tabelafoto.height = alturatabela;
			tabelafoto1.style.height = screen.availHeight-50;

			alvo = document.getElementById("fotoAmpliada")
			
			if(alvo.style.display=="inline"){
				
					alvo.style.display="none"	
					document.images["foto_ampliada"].src = "imagens/carregando.gif";
					document.getElementById("legendafotoampliada").childNodes[0].nodeValue = "";
				
					} else {
					
						alvo.style.display="inline"
						
						var imagem_preview = new Image(420,420)
						imagem_preview.src = foto;
					
						var intervalo_foto_ampliada = window.setInterval(
							
							function (){
						
								if(imagem_preview.complete){
									document.images["foto_ampliada"].src = foto;
									document.getElementById("legendafotoampliada").childNodes[0].nodeValue = legenda
									clearInterval(intervalo_foto_ampliada);
									}
									
							}
					,1000);
		
					}
			}

function mudaDisplay(alvo){
	alvo = document.getElementById(alvo)
	if((alvo.style.display=="block")||(alvo.style.display=="table")){
		alvo.style.display="none"
		} else {
		alvo.style.display="block"
		}
	}
	
function exibe(alvo){	
	alvo = document.getElementById(alvo)
	alvo.style.display="block"
	}
	
function oculta(alvo){
	alvo = document.getElementById(alvo)
	alvo.style.display="none"
	}
	
function mudarTexto(alvo,conteudo){
	document.getElementById(alvo).innerHTML = conteudo;
	}
	
function mudarSrcIframe(alvo,arquivo){
	document.getElementById(alvo).src= arquivo;
	}
	
function pos_x(posicao, alvo){
		$(document).ready(function() {
			$(alvo).animate({left: posicao}, "normal");
		});
	}
	
function pos_y(posicao, alvo){
		$(document).ready(function() {
			$(alvo).animate({top: posicao}, "normal");
		});
	}
	
function tam_x(posicao, alvo){
		$(document).ready(function() {
			$(alvo).animate({width: posicao}, "normal");
		});
	}
	
function tam_y(posicao, alvo){
		$(document).ready(function() {
			$(alvo).animate({height: posicao}, "normal");
		});
	}
	
function verificarCamposForm(campo,form){
	if (document.forms[form].elements[campo].value=="") {
	alert("Preencha o campo selecionado!")
		document.forms[form].elements[campo].focus();
		document.forms[form].elements[campo].className="erro";
		return false
		} else {
		document.forms[form].elements[campo].className="";
		return true
		}
	}

function mudarCorFundo(elem,cor) {
	if (elem.style) {
		elem.style.backgroundColor = cor
		}
	}
function mudarBorda(alvo,cor){
		alvo_borda = document.getElementById(alvo);
		alvo_borda.style.borderColor=cor;
		}