// JavaScript Document
//************************************************************************
// HTTP REQUEST **********************************************************
//************************************************************************
function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var AjaxA = getHTTPObject();

//************************************************************************
//************************************************************************
// POP-UPS ----------------------------------------------
function page_less(url, largura, altura) {
  var url;
  
  var esquerda = (screen.width - largura)/2;
  var topo = (screen.height - altura)/2;
  window.open(url,'win','height=' + altura + ', width=' + largura + ', top=' + topo + ', left=' + esquerda);
}
//*********************************************************************************

var carregando = '<span class="tahoma_preto_12"><p>Carregando...</p></span>';
//************************************************************************
// NOTÍCIAS ANTERIORES ----------------------------------------------
//************************************************************************
function noticias_col(not_atual,exib,page)
{
	
	document.getElementById("anteriores_col").innerHTML = carregando;
	AjaxA.open("GET", "noticias_ant.php?not_atual="+not_atual+'&exib='+exib+"&page="+page, true);
    AjaxA.onreadystatechange=function(){
        if(AjaxA.readyState==4){
	document.getElementById("anteriores_col").innerHTML = '';
	document.getElementById("anteriores_col").innerHTML = AjaxA.responseText;
        }
    }
    AjaxA.send(null)
}
//************************************************************************
//************************************************************************

//************************************************************************
// AÇÕES *****************************************************************
//************************************************************************

function acao_autoria(pg, a)
{
		// CARREGANDO...
		document.getElementById("acao_autoria").innerHTML = carregando;
		
		AjaxA.open("GET", "acao_autoria.php?pagina="+pg, true);
		
		AjaxA.onreadystatechange=function(){
			if(AjaxA.readyState==4){
				document.getElementById("acao_autoria").innerHTML = '';
				document.getElementById("acao_autoria").innerHTML = AjaxA.responseText;
        	}
		}
    	AjaxA.send(null)
	if(a==1){
		document.getElementById("acao_relato").innerHTML = carregando;
		setTimeout(function(){ acao_relato(pg); }, 1000);
	}
}


//->AÇÃO RELATO
function acao_relato(pg){
	

	// CARREGANDO...
	document.getElementById("acao_relato").innerHTML = carregando;
	
	AjaxA.open("GET", "acao_relato.php?pagina="+pg, true);
	
   	AjaxA.onreadystatechange=function(){
       	if(AjaxA.readyState==4){
			document.getElementById("acao_relato").innerHTML = '';
			document.getElementById("acao_relato").innerHTML = AjaxA.responseText;
       	}
   	}
   	AjaxA.send(null)
	
}

//========================================================================
function outras_acoes(acao_atual,filtro,exib,page)
{
	
	document.getElementById("outras_acoes").innerHTML = carregando;
	AjaxA.open("GET", "outras_acoes.php?id="+acao_atual+'&filtro='+filtro+'&exib='+exib+"&page="+page, true);
    AjaxA.onreadystatechange=function(){
        if(AjaxA.readyState==4){
	document.getElementById("outras_acoes").innerHTML = '';
	document.getElementById("outras_acoes").innerHTML = AjaxA.responseText;
        }
    }
    AjaxA.send(null)
}
//************************************************************************
//************************************************************************

//************************************************************************
// MULTIMIDIA ************************************************************
//************************************************************************

//->GALERIA DE FOTOS
function mult_fotos(pg, a)
{
		// CARREGANDO...
		document.getElementById("galeria_fotos").innerHTML = carregando;
		
		AjaxA.open("GET", "galeria_fotos.php?pagina="+pg, true);
		
		AjaxA.onreadystatechange=function(){
			if(AjaxA.readyState==4){
				document.getElementById("galeria_fotos").innerHTML = '';
				document.getElementById("galeria_fotos").innerHTML = AjaxA.responseText;
        	}
		}
    	AjaxA.send(null)
	if(a==1){
		document.getElementById("galeria_videos").innerHTML = carregando;
		setTimeout(function(){ mult_videos(pg); }, 1000);
	}
}


//->GALERIA DE VIDEOS
function mult_videos(pg){
	

	// CARREGANDO...
	document.getElementById("galeria_videos").innerHTML = carregando;
	
	AjaxA.open("GET", "galeria_video.php?pagina="+pg, true);
	
   	AjaxA.onreadystatechange=function(){
       	if(AjaxA.readyState==4){
			document.getElementById("galeria_videos").innerHTML = '';
			document.getElementById("galeria_videos").innerHTML = AjaxA.responseText;
       	}
   	}
   	AjaxA.send(null)
	
}

//************************************************************************
//************************************************************************

// VALIDAR - INDICAR------------------------------------
function validar_indicar(){

if(document.form1.nome.value == ""){
		alert("Informe o seu nome!");
		document.form1.nome.focus();
		return false;
	};
	
	strEmail = document.form1.email.value;
	if(strEmail == ""){
		alert("Informe seu e-mail!");
		document.form1.email.focus();
		return false;
	};
	
	if(strEmail.indexOf("@",0) == -1 || strEmail.indexOf(".",0) == -1){ 
		alert("Informe um email válido !"); 
		document.form1.email.select();
		return false; 
	};
	
	if(document.form1.nome_para.value == ""){
		alert("Informe o do para quem você deseja fazer a indicação!");
		document.form1.nome_para.focus();
		return false;
	};
	
	strEmail2 = document.form1.email_para.value;
	if(strEmail2 == ""){
		var nomepara = document.form1.nome_para.value;
		alert("IInforme o e-mail de "+nomepara+"!");
		document.form1.email_para.focus();
		return false;
	};
	
	if(strEmail2.indexOf("@",0) == -1 || strEmail2.indexOf(".",0) == -1){ 
		alert("Informe um email válido !"); 
		document.form1.email_para.select();
		return false; 
	};
	
	if(document.form1.mensagem.value == ""){
		alert("Informe sua mensagem!");
		document.form1.mensagem.focus();
		return false;
	};
	
}

// -> NEWSLETTER
function validar_newsletter(){
	
	if(document.form_newsletter.nome.value == ""){
		alert("Informe o seu nome!");
		document.form_newsletter.nome.focus();
		return false;
	};
	
	strEmail = document.form_newsletter.email.value;
	if(strEmail == ""){ 
		alert("Informe o email de contato !");
		document.form_newsletter.email.focus(); 
		return false;
	};
	
	if(strEmail.indexOf("@",0) == -1 || strEmail.indexOf(".",0) == -1){ 
		alert("Informe um email válido !"); 
		document.form_newsletter.email.select();
		return false; 
	};

	return true;
}

// -> CONTATO
function validar_contato(){
	
	if(document.form_contato.nome.value == ""){
		alert("Informe o seu nome!");
		document.form_contato.nome.focus();
		return false;
	};
	
	strEmail = document.form_contato.email.value;
	if(strEmail == ""){ 
		alert("Informe o email de contato !");
		document.form_contato.email.focus(); 
		return false;
	};
	
	if(strEmail.indexOf("@",0) == -1 || strEmail.indexOf(".",0) == -1){ 
		alert("Informe um email válido !"); 
		document.form_contato.email.select();
		return false; 
	};

	if(document.form_contato.telefone.value == ""){
		alert("Informe um número de telefone para contato!");
		document.form_contato.telefone.focus();
		return false;
	};
	
	if(document.form_contato.mensagem.value == ""){
		alert("Informe sua mensagem!");
		document.form_contato.mensagem.focus();
		return false;
	};
		return true;
}


// -> BUSCA TOPO
function validar_busca_topo(){
	
	if(document.form_busca_topo.busca.value == ""){
		alert("Informe sobre o que deseja pesquisar!");
		document.form_busca_topo.busca.focus();
		return false;
	};
}