// JavaScript Document

function abrepg(ref, para){
	$("#principal").hide();
	$("#estrutura").hide();
	$("#advogados").hide();
	$("#areasatuacao").hide();
	$("#contato").hide();
	$("#eventos").hide();
	$("#artigo").hide();
	$("#noticia").hide();
	$("#detalhes_evento").hide();
	$("#obrigado_fale").hide();
	
	var h=$("#"+ref).height();
	if (ref != 'contato')
	h=h+180;
	else
	{
	h=h+80;
	if (para != '')
	$("#para").val(""+para);
	}
	
	if (ref == 'eventos')
	h=h+80;

	$("#meio").css({ height: ""+h+"px" });
	$("#"+ref).show();

}

function mostra_evento(ref){
	var obj=document.getElementById('evento'+ref);
	if (obj.style.display=='block')
	{
	var h=$("#evento"+ref).height();
	var h2=$("#eventos").height();
	h=h2-h;
	h=h+210;
	$("#evento"+ref).hide();
	$("#meio").css({ height: ""+h+"px" });
	
	}
	else
	{
	var h=$("#evento"+ref).height();
	var h2=$("#eventos").height();
	if (h < 80)
	h=120;
	h=h+h2;
	h=h+80;
	$("#meio").css({ height: ""+h+"px" });
	$("#evento"+ref).show();
	}
	
}

function enviaemail(ref){
			
		$("#btnfale"+ref).hide();
		$("#loadfale").show();
		$.ajax({
		  url: "enviaemail.php",
		  data: "nome="+$("#nome"+ref).val()+"&email="+$("#email"+ref).val()+"&telefone="+$("#telefone"+ref).val()+"&mensagem="+$("#mensagem"+ref).val()+"&tipo="+ref,
		  cache: false,
		  success: function(html){
		 	$("#nome").val("");
			$("#email").val("");
			$("#telefone").val("");
			$("#mensagem").val("");
			$("#eventos").hide();
			$("#detalhes_evento").hide();
		   $("#contato").hide();
		   $("#btnfale"+ref).show();
			$("#obrigado_fale").show();
			window.scrollTo(0,0);
			
			
		  }
		});
		
	
	
}