function addFav(url,titulo){
    if (window.sidebar) window.sidebar.addPanel(titulo, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',titulo);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, titulo);}
}

function mudarImagens(imagem,alvo){
	document.images[alvo].src = imagem;
	}
	
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 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;

			var alturaTelaCheia = screen.availHeight;
			if(alturaTelaCheia>alturatabela){
				alturatabela = alturaTelaCheia;
				}
				
			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="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;
		}