//para cima flutuante
var SUA_CAMADA
var theTop = 0;
var old = theTop;
var pos

function moveSUA_CAMADA()
{
	if (window.innerHeight)
	{
		pos = window.pageYOffset
	}
	else if (document.documentElement && document.documentElement.scrollTop)
	{
	  pos = document.documentElement.scrollTop
	}
	else if (document.body)
	{
		pos = document.body.scrollTop
	}
	if (pos < theTop) pos = theTop;
	else pos += 0;
	if (pos == old)
	{
	  $('#rodape').css('bottom', pos)
	}
	old = pos;
	temp = setTimeout('moveSUA_CAMADA()',1);
}

//para cima flutuante fim







$(document).ready(function() {
						   
//aflutua o para_cima
moveSUA_CAMADA();	

$.NiceJForms.build()

//$("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]);
	})
*/

	//_________________________________________________________________________________
	



	
	
	
	
/*seguro viagem*/
$('#ver_seguro').click(function(){	
	window.location.hash="ancora2";
	
	$("#iframe_seguro").attr('src', 'http://www.seguroviagemgta.com.br/ewc_v4/auth/default.asp?id=10724&user=ewc10724&key=18310724');
	$("#seguro_visualizar").show("fast");

	$("#corpo").fadeTo("slow", 0.4);
	$("body").addClass('fundo_email');
	return false						  
})








/*email*/

$('#ver_mapa').click(function(){	
	window.location.hash="ancora";
	
	$("#iframe_mapa").attr('src', 'mapa.php');
	$("#envia_email").show("fast");

	$("#corpo").fadeTo("slow", 0.4);
	$("body").addClass('fundo_email');
	return false						  
})



$("a[@rel=email]").click(function(){
	window.location.hash="ancora";

	var email=$(this).attr('href');
	tam = email.length;
	email=email.substr(7,tam);
	
	$("#iframe_mapa").attr('src', 'envio_email.php?email='+email);
	
	$("#envia_email").show("fast");



	$("#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
})

$("#fechar_seguro").click(function(){
	$("#corpo").fadeTo("fast", 1);
	$("#seguro_visualizar").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;	
}
