$(document).ready(function() {


//$("h1.toogle").next("table").hide();
$("h1.toogle_h").next("table").hide();
$("h1.toogle").click(function(){
	$(this).next("table").toggle();
})
$("h1.toogle_h").click(function(){
	$(this).next("table").toggle();
})
$(".tb_rep tr:nth-child(odd)").addClass("odd");




/*
//autoplete
	$("#suggest1").autocomplete("search.php",{scrollHeight:200}	);
	$("#suggest1").focus(function(){ 
	var valor = $(this).val();
	
	
	
	var dividir =valor.split("' /> ");
	
	var dividir_hider = dividir[0].split("alt='");
	
	$(this).val(dividir[1]);
	$("#pais_valor").val(dividir_hider[1]);
	})
*/

	//_________________________________________________________________________________
	
	
	
	








/*email*/




$("a[@rel=email]").click(function(){
	window.location.hash="ancora";
	
	var html_help=$('#email_cont_help').html();
	$('#email_cont').html( html_help);
	
	$('#mapa_cont').hide();
	$('#email_cont').show();
	//$("#iframe_mapa").attr('src', '');
	$("#envia_email").show("fast");
	var email=$(this).html()
	$("#para_email").val(email);
	$("#corpo").fadeTo("slow", 0.4);
	$("body").addClass('fundo_email');

	return false
})
/*
$("#cont_email").click(function(){
	window.location.hash="ancora";
	
	$('#mapa_cont').hide();
	$("#envia_email").show("fast");
	var email="celestino@celestinodesp.com.br"
	$("#para_email").val(email);
	$("#corpo").fadeTo("slow", 0.4);
	$("body").addClass('fundo_email');
	return false
})*/

$("#fechar_email").click(function(){
	$("#corpo").fadeTo("fast", 1);
	$("#envia_email").hide();
	$("body").removeClass('fundo_email')
	$('#mapa_cont').hide();
	//$("#iframe_mapa").attr('src', '');
	$('#email_cont').hide();
	return false
})









//envio de email	
$("#limpar_email_form").click(function(){
	var para_email=$("#para_email").val();
	$("#email_form")[0].reset();
	$("#para_email").val(para_email);
	$('#retorno').html("")
	return false
});//limpando o formulario


$("#submit_email_form").click(function(){

$.post("scripts/php/envio_email.php", 
	  		 {
			    para			:$("#para_email").val(),
			    nome			:$("#email_nome").val(),
			   email			:$("#email_email").val(),
			 assunto			:$("#email_assunto").val(),
		    	 msn			:$("#email_mensagem").val()
				},
	 		 function(retorno){
				 
/*se retorno ok*/		if(retorno =="ok"){
									$('#retorno').html("<img src='imagens/correto_alert.gif' /> Enviado Corretamente")
/*se retorno error*/	}else{		
									$('#retorno').html("<img src='imagens/atencao_alert.gif' /> Erro no envio")
									$("#form_mens")[0].reset();//limpando o formulario
						 };
				 
			 });//fecha .post	
return false
})


//envio de email fim













				
})

var req2;

function chama_news(evt2) {
	var url2 = "scripts/php/calendar/chamada.php?evento="+evt2;
	if(window.XMLHttpRequest) {
		req2 = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		req2 = new ActiveXObject("Microsoft.XMLHTTP");
	}
	req2.open("GET", url2, true);
	req2.onreadystatechange = callback2;
	req2.send(null);
}

function callback2() {	
	if(req2.readyState == 4) {
		var response2 = req2.responseXML;	
		var resp2 = response2.getElementsByTagName("response");
		getObject("noticias_news").innerHTML = resp2[0].getElementsByTagName("content")[0].childNodes[0].nodeValue;
	}
}

function getObject(obj) {
	var o;
	if(document.getElementById) o = document.getElementById(obj);
	else if(document.all) o = document.all.obj;	
	return o;	
}
