var reDate = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;
function doDate(data_formulario){
	if (!reDate.test(data_formulario)) {
		return false;
	}else{
		return true;
	}
} 

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function validaNewsletter(){
	if(tiraEspaco(document.getElementById('nomeNews').value) == ""){	
		alert("Informe o seu nome.");
		document.getElementById('nomeNews').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('emailNews').value) == ""){
		alert("Informe o e-mail.");
		document.getElementById('emailNews').focus();
		return ;	
	}else{	
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('emailNews').value))){ 
			alert("Email invÃ¡lido.");
	        document.getElementById('emailNews').focus(); 
	   	    return;
	    }
	}	
	campos = "pagina=1&newsletter=1&email="+encodeURI(document.getElementById('emailNews').value)+"&nome="+encodeURI(document.getElementById('nomeNews').value);
	enviaRequisicao('formEmail','ler_pagina_remota.php?'+campos,'<div style="height:45px"><br/>&nbsp;Enviando...</div>');	
}

function carregaMenu(tipo){
	if (tipo==1){
		document.getElementById('menu').style.display='block';
	}else{
		document.getElementById('menu2').style.display='block';		
	}
}
function descarregaMenu(tipo){
	if (tipo==1){
		document.getElementById('menu').style.display='none';
	}else{
		document.getElementById('menu2').style.display='none';		
	}
}

function vota(){
	valor_id = 0;
	campoProcurado = document.getElementsByName('id_resp');
	total_respostas = document.getElementById('total_resp').value;
    encontrou = false;
	for (var i=0;i<total_respostas;i++){
  		if (campoProcurado[i].checked == true){
			valor_id = campoProcurado[i].value;
			encontrou = true;
			
		}
	}
	if (!encontrou){
	  	alert("Selecione um item.");
	  	campoProcurado[0].focus();
        return;
	}
	enviaRequisicao4('result','ler_pagina_remota.php?pagina=1&enqResultado='+valor_id,mensagem);
	document.getElementById('bottomenq').style.background = "url(img/enquetebot3.jpg) no-repeat";
	document.getElementById('bottomenq').style.height = "26px";
	//temp = "http://localhost/insertblog/template/danielcoelho/enquete_resultado.php?id=" + valor_id;
	//temp = "http://localhost/insertblog/template/juventudeVerdePe/enquete_resultado.php?id=" + valor_id;
	//window.open(temp, 'clo3', 'toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=no,width=500,height=385');
}



function abreEnviarAmigo(divSelecionado,id, menor, maior){
	valorAtual = id;
	for (i=menor;i<=maior;i++){
		if (parseInt(i)!=parseInt(id)){
			if (eval("document.getElementById('divEnviarParaAmigoStatus"+i+"')")!=null){
				eval("document.getElementById('divEnviarParaAmigoStatus"+i+"').value=0");
				eval("document.getElementById('divEnviarParaAmigo"+i+"').innerHTML = ''");
			}
		}
	}
	status = eval("document.getElementById('divEnviarParaAmigoStatus"+id+"').value");
	if (parseInt(status)==0){
		eval("document.getElementById('divEnviarParaAmigoStatus"+id+"').value=1");
		mensagem = '<div align=center style="font-family:Arial, Helvetica;font-size:10px;height:130px;float:center/position:relative;left:-180px"><br><br><br><br><img src=img/loading.gif border=0><br>Carregando...</div>'
		enviaRequisicao4(divSelecionado,'enviarAmigo.php',mensagem);
	}else{
		eval("document.getElementById('divEnviarParaAmigoStatus"+id+"').value=0");
		document.getElementById(divSelecionado).innerHTML = '';
	}
}

function abreComentario(valor,pag){
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao4('colLeft','ler_pagina_remota.php?pagina='+pag+'&fazerComentario='+valor,mensagem);
}
function abreProjetos(){
	document.getElementById("colunaTwitter").style.display='none';
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao4('colLeft','ler_pagina_remota.php?pagina=1&projetos=1',mensagem);
	var pagId = "projetos";
	var ids = new Array('noticias','agendaTodas','filiese','bandeiras','contato','galeriaM','perfil'); 
	for(i=0;i<ids.length;i++){     	
     	document.getElementById(ids[i]).className = "";
       	if(pagId=="projetos"){
     		document.getElementById(pagId).className = "active";     		
     	}
     }
}
function abrePerfil(valor){
	document.getElementById("colunaTwitter").style.display='none';
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao4('colLeft','perfil.php',mensagem);
	var pagId = "perfil";
	var ids = new Array('noticias','agendaTodas','filiese','bandeiras','contato','galeriaM'); 
	for(i=0;i<ids.length;i++){     	
     	document.getElementById(ids[i]).className = "";
       	if(pagId=="perfil"){
     		document.getElementById(pagId).className = "active";     		
     	}
     }
}
function abreFiliese(valor){
	document.getElementById("colunaTwitter").style.display='none';
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao4('colLeft','filiese.php',mensagem);
	var pagId = "filiese";
	var ids = new Array('noticias','agendaTodas','projetos','bandeiras','contato','galeriaM','perfil'); 
	for(i=0;i<ids.length;i++){     	
     	document.getElementById(ids[i]).className = "";
       	if(pagId=="filiese"){
     		document.getElementById(pagId).className = "active";     		
     	}
     }
}
function abreContato(valor){
	document.getElementById("colunaTwitter").style.display='none';
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao4('colLeft','contato.php',mensagem);
	var pagId = "contato";
	var ids = new Array('noticias','agendaTodas','projetos','bandeiras','filiese','galeriaM','perfil'); 
	for(i=0;i<ids.length;i++){     	
     	document.getElementById(ids[i]).className = "";
       	if(pagId=="contato"){
     		document.getElementById(pagId).className = "active";     		
     	}
     }
}
function chamaDownload(){
	document.getElementById("colunaTwitter").style.display='none';
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao4('colLeft','ler_pagina_remota.php?pagina=1&download=1',mensagem);
	var pagId = "galeriaM";
	var ids = new Array('noticias','agendaTodas','projetos','bandeiras','filiese','galeriaM','perfil'); 
	for(i=0;i<ids.length;i++){     	
     	document.getElementById(ids[i]).className = "";
       	if(pagId=="galeriaM"){
     		document.getElementById(pagId).className = "active";     		
     	}
     }
}
function chamaBandeiras(valor){
	document.getElementById("colunaTwitter").style.display='none';
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao4('colLeft','bandeiras.php',mensagem);
	var pagId = "bandeiras";
	var ids = new Array('noticias','agendaTodas','projetos','filiese','contato','galeriaM','perfil'); 
	for(i=0;i<ids.length;i++){     	
     	document.getElementById(ids[i]).className = "";
       	if(pagId=="bandeiras"){
     		document.getElementById(pagId).className = "active";     		
     	}
     }
}
function abrePostSelecionado(valor){
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao4('conteudo','ler_pagina_remota.php?pagina=1&fazerComentario='+valor,mensagem);
}

function chamaVideo(pagina){
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando Video...</div>'
	enviaRequisicao('conteudo','ler_pagina_remota.php?video=1&pagina='+pagina,mensagem);
}

function verTodos(pagina,pesquisa){
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao('conteudo','ler_pagina_remota.php?todos='+pesquisa+'&pagina='+pagina,mensagem);
}

function buscaVoltar(pesquisa){
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Voltando ao Resultado da Busca...</div>'
	enviaRequisicao('meioPagina','ler_pagina_remota.php?pesquisa='+encodeURI(pesquisa)+'&pagina=1',mensagem);
}
function buscaPostPalavra(){
	if (document.getElementById('busca').value.length >= 4){
		mensagem = '<div align=center style="font-family:Arial, Helvetica;font-size:10px;height:110px;float:center"><br><br><br><br><br><br><img src=img/loading.gif border=0><br>Efetuando Busca por Palavra...</div>'
		enviaRequisicao('conteudo','ler_pagina_remota.php?pesquisa='+encodeURI(document.getElementById('busca').value)+'&pagina=1',mensagem);
	}else{
		document.getElementById('busca').focus();
		alert("A palavra pesquisada deve ter no mÃ­nimo 4 caracteres.");
	}
}
function abrePageImpresao(valor){
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'	
	//window.open ("http://localhost/insertblog/template/danielcoelho/imprimir.php?id="+valor,"imprimir","menubar=no,resizable=yes,scrollbars=yes,width=615,height=650"); 
	window.open ("http://www.4dimensao.net/insertblog.com.br/template/danielcoelho/imprimir.php?id="+valor,"imprimir","menubar=no,resizable=yes,scrollbars=yes,width=625,height=650"); 
}


//var tamanho = "11px";
function aumentarLetra(i){
	tamanho = document.getElementById("tamanho_"+i).value;
	switch (tamanho) {
		case "17px":
			tamanho = "17px";
			break;
		case "15px":
			tamanho = "17px";
			break;
		case "13px":
			tamanho = "15px";
			break;
		case "11px":				
			tamanho = "13px";
			break
		case "9px":
			tamanho = "11px";
			break
	}
	elemento = document.getElementById("letra_"+i);
	document.getElementById("tamanho_"+i).value = tamanho;
	elemento.style.fontSize = tamanho;
}

// diminuir o tamanho da letra
function diminuirLetra(i){
	tamanho = document.getElementById("tamanho_"+i).value;
	switch (tamanho) {
		case "9px":
			tamanho = "9px";
			break
		case "11px":				
			tamanho = "9px";
			break
		case "13px":
			tamanho = "11px";
			break
		case "15px":
			tamanho = "13px";
			break
		case "17px":
			tamanho = "15px";
			break
	}
	elemento = document.getElementById("letra_"+i);
	document.getElementById("tamanho_"+i).value = tamanho;
	elemento.style.fontSize = tamanho;
}

function tiraEspaco(texto){
	while(texto.indexOf(" ") != -1){
	  texto = texto.replace(" ","");
	}
    return texto;
}

function chamaEnquete(){
	mensagem = '<div align="center" style="padding-top:20px;font-family:Arial, Helvetica;font-size:10px;height:110px;float:center;"><img src=img/loading.gif border=0><br>Carregando...</div>';
	enviarForm('ler_pagina_remota.php?pagina=1&enquete=1','','enquete',mensagem);
}
function chamaTodasNoticias(pagina){
	document.getElementById("colunaTwitter").style.display='block';
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando Posts...</div>'
	enviaRequisicao4('colLeft','ler_pagina_remota.php?pagina='+pagina+'&noticiaTodas=1',mensagem);
	var pagId = "noticias";
	var ids = new Array('projetos','agendaTodas','filiese','bandeiras','contato','galeriaM','perfil'); 
	for(i=0;i<ids.length;i++){     	
     	document.getElementById(ids[i]).className = "";
       	if(pagId=="noticias"){
     		document.getElementById(pagId).className = "active";     		
     	}
     }
}
function chamaTodasMidias(pagina){
	document.getElementById("colunaTwitter").style.display='block';
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando Posts...</div>'
	enviaRequisicao4('colLeft','ler_pagina_remota.php?pagina='+pagina+'&midias=1',mensagem);
	var pagId = "noticias";
	var ids = new Array('projetos','agendaTodas','filiese','bandeiras','contato','galeriaM','perfil'); 
	for(i=0;i<ids.length;i++){     	
     	document.getElementById(ids[i]).className = "";
       	if(pagId=="noticias"){
     		document.getElementById(pagId).className = "active";     		
     	}
     }
}
function chamaVideos(pagina){
	document.getElementById("colunaTwitter").style.display='block';
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao4('colLeft','ler_pagina_remota.php?pagina='+pagina+'&videos=1',mensagem);
	var pagId = "galeriaM";
	var ids = new Array('projetos','agendaTodas','filiese','bandeiras','contato','galeriaM','perfil'); 
	for(i=0;i<ids.length;i++){     	
     	document.getElementById(ids[i]).className = "";
       	if(pagId=="galeriaM"){
     		document.getElementById(pagId).className = "active";     		
     	}
     }
}
function abreNoticias(){
	mensagem = '<div align="center" style="margin-left:-250px" style="position:relative;left:-180px" id="loading"><img src=img/loading.gif border=0><br>Carregando Posts...</div>'
	enviaRequisicao('boxNoticias2','ler_pagina_remota.php?pagina=1&noticiaIndex=1',mensagem);
}
function abreAgenda(){
	mensagem = '<div align="center" style="position:relative;left:-200px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>';
	enviaRequisicao2('agenda','ler_pagina_remota.php?pagina=1&agenda=1',mensagem);
}
function abreAgendaTodas(pag){
	document.getElementById("colunaTwitter").style.display='none';
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>';
	enviaRequisicao2('colLeft','ler_pagina_remota.php?pagina='+pag+'&agendaTodas=1',mensagem);		
	var pagId = "agendaTodas";
	var ids = new Array('projetos','noticias','filiese','bandeiras','contato','galeriaM','perfil'); 
	for(i=0;i<ids.length;i++){     	
     	document.getElementById(ids[i]).className = "";
       	if(pagId=="agendaTodas"){
     		document.getElementById(pagId).className = "active";     		
     	}
     }
}
function abreGaleriaInterna(){
	mensagem = '<div align="left" style="margin-left:-150px" style="padding-left:-200px;position:relative;left:-200px;font-family:Arial, Helvetica;font-size:10px;height:110px;float:center;" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>';
	enviaRequisicao3('galeria','ler_pagina_remota.php?pagina=1&galeriaIndex=1',mensagem);		
}
function chamaAcesso(){
	enviaRequisicao4('divAcesso','ler_pagina_remota.php?pagina=1&acesso=1');
}
function chamaGaleriaInterna(galeriaId){
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao('colLeft','ler_pagina_remota.php?pagina=1&galeriaInternas='+galeriaId,mensagem);
}
function chamaNoticiaDetalhe(noticiaId){
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	document.getElementById("colunaTwitter").style.display='none';	
	enviaRequisicao('colLeft','ler_pagina_remota.php?pagina=1&noticiaDetalhe='+noticiaId,mensagem);
}

function chamaPaginadorGaleria(pagina){
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando Fotos...</div>'
	enviaRequisicao('colLeft','ler_pagina_remota.php?paginadorGaleria=1&pagina='+pagina,mensagem);
}
function chamaGaleria(){
	document.getElementById("colunaTwitter").style.display='block';
	mensagem = '<div align="center" style="margin-left:-250px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>'
	enviaRequisicao('colLeft','ler_pagina_remota.php?galeria=1&pagina=1',mensagem);
	var pagId = "galeriaM";
	var ids = new Array('noticias','agendaTodas','projetos','filiese','contato','bandeiras'); 
	for(i=0;i<ids.length;i++){     	
     	document.getElementById(ids[i]).className = "";
       	if(pagId=="galeriaM"){
     		document.getElementById(pagId).className = "active";     		
     	}
     }
}
function abreGaleriaRetrospectiva(){
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando ...</div>'
	enviaRequisicao('conteudo','ler_pagina_remota.php?retrospectiva=1&pagina=1',mensagem);
}
function chamaRetrospectiva(pagina){
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando ...</div>'
	enviaRequisicao('conteudo','ler_pagina_remota.php?retrospectiva=1&pagina='+pagina,mensagem);
}


function submeterContato(){
	if(tiraEspaco(document.getElementById('nomeContato').value) == ""){	
		alert("Informe o nome.");
		document.getElementById('nomeContato').focus();
		return;
	}
	if(document.getElementById('emailContato').value == ""){
		alert("Informe o e-mail.");
		document.getElementById('emailContato').focus();
		return;	
	}else{	
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('emailContato').value))){ 
			alert("Formato de email incorreto.");
	        document.getElementById('emailContato').focus(); 
	   	    return;
	    }
	} 	
	if(tiraEspaco(document.getElementById('comentarioContato').value) == ""){	
		alert("Informe a mensagem.");
		document.getElementById('comentarioContato').focus();
		return;
	}	
	setarCamposContato();
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>';
	enviaRequisicao3('colLeft','ler_pagina_remota_post.php?'+campos,mensagem);
}
function setarCamposContato(){
	campos = "nomeContato="+encodeURI(document.getElementById('nomeContato').value);
	campos += "&emailContato="+encodeURI(document.getElementById('emailContato').value);
	campos += "&telefoneContato="+encodeURI(document.getElementById('telefoneContato').value);
	campos +="&comentarioContato="+encodeURI(document.getElementById('comentarioContato').value);
}

function submeterComentario(){
	if(tiraEspaco(document.getElementById('nomeComentario').value) == ""){	
		alert("Informe o nome");
		document.getElementById('nomeComentario').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('emailComentario').value) == ""){
		alert("Informe o email");
		document.getElementById('emailComentario').focus();
		return;	
	}else{	
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('emailComentario').value))){ 
			alert("Informe o email");
	        document.getElementById('emailComentario').focus(); 
	   	    return;
	    }
	} 	
	if(tiraEspaco(document.getElementById('comentarioTexto').value) == ""){
		alert("Informe o comentÃ£¡rio");
		document.getElementById('comentarioTexto').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('palavra').value) == ""){	
		alert("Palavra incorreta");
		document.getElementById('palavra').focus();
		return;
	}	
	setarCamposComentarios();
	mensagem = '<div align="center" style="position:relative;left:-180px" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>';
	enviaRequisicao3('boxIntern','ler_pagina_remota_post.php?'+campos,mensagem);
}

function setarCamposComentarios(){
	campos = "nome="+encodeURI(document.getElementById('nomeComentario').value);
	campos += "&email="+encodeURI(document.getElementById('emailComentario').value);
	campos +="&comentario="+encodeURI(document.getElementById('comentarioTexto').value);
	campos +="&palavra="+document.getElementById('palavra').value;
	campos +="&noticia="+document.getElementById('noticia').value;
}
function submeterPesquisa(){
	

	if(tiraEspaco(document.getElementById('palavraBuscaAvancada').value) == ""){	
		alert("Informe a palavra a pesquisar.");
		document.getElementById('palavraBuscaAvancada').focus();
		return;
	}else{
		if (document.getElementById('palavraBuscaAvancada').value.length < 4){
			alert("A palavra pesquisada deve ter no mÃ­nimo 4 caracteres.");
			document.getElementById('palavraBuscaAvancada').focus();
			return;
		}
	}
	if (!doDate(document.getElementById('dtInicial').value)){
		alert("Data inicial invÃ¡lida.");
		document.getElementById('dtInicial').focus();
		return;
	}
	if (!doDate(document.getElementById('dtFinal').value)){
		alert("Data final invÃ¡lida.");
		document.getElementById('dtFinal').focus();
		return;
	}
	setarCamposPesquisa();
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>';
	enviaRequisicao3('conteudo','ler_pagina_remota_post.php?'+campos,mensagem);
}
function setarCamposPesquisa(){
	campos = "palavraBuscaAvancada="+encodeURI(document.getElementById('palavraBuscaAvancada').value);
	campos += "&dtInicial="+encodeURI(document.getElementById('dtInicial').value);
	campos += "&dtFinal="+encodeURI(document.getElementById('dtFinal').value);
	campos += "&categoriasBuscaAvancada="+encodeURI(document.getElementById('categoriasBuscaAvancada').value);
}

function submeterEnviarEmailAmigo(){
	if(tiraEspaco(document.getElementById('nomeRemetente').value) == ""){	
		alert("Informe o nome do remetente.");
		document.getElementById('nomeRemetente').focus();
		return;
	}
	if(document.getElementById('emailRemetente').value == ""){
		alert("Informe o e-mail do remetente");
		document.getElementById('emailRemetente').focus();
		return;	
	}else{	
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('emailRemetente').value))){ 
	       	alert("Email incorreto.");
	        document.getElementById('emailRemetente').focus(); 
	   	    return;
	    }
	}
	if(tiraEspaco(document.getElementById('nomeDestinatario').value) == ""){	
		alert("Informe o nome do destinatÃ£¡rio.");
		document.getElementById('nomeDestinatario').focus();
		return;
	}
	if(document.getElementById('emailDestinatario').value == ""){
		alert("Informe o e-mail do destinatÃ£¡rio");
		document.getElementById('emailDestinatario').focus();
		return;	
	}else{	
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('emailDestinatario').value))){ 
	       	alert("Email incorreto.");
	        document.getElementById('emailDestinatario').focus(); 
	   	    return;
	    }
	} 	
	
	if(tiraEspaco(document.getElementById('palavra').value) == ""){	
		alert("Palavra invÃ£¡lida.");
		document.getElementById('palavra').focus();
		return;
	}	
	setarEnviarEmailAmigo();
	carregaNoDivCerto = 'divEnviarParaAmigo'+valorAtual;
	mensagem = '<div align="center" id="loading" style="position:relative;left:-180px;><img src=img/loading.gif border=0><br>Carregando...</div>';
	enviaRequisicao3(carregaNoDivCerto,'ler_pagina_remota_post.php?'+campos,mensagem); 
}

function setarEnviarEmailAmigo(){
	campos = "nomeRemetente="+encodeURI(document.getElementById('nomeRemetente').value);
	campos += "&emailRemetente="+encodeURI(document.getElementById('emailRemetente').value);
	campos += "&nomeDestinatario="+encodeURI(document.getElementById('nomeDestinatario').value);
	campos += "&emailDestinatario="+encodeURI(document.getElementById('emailDestinatario').value);
	campos += "&palavra="+document.getElementById('palavra').value;
	campos += "&noticiaId="+eval("document.getElementById('noticiaIdEnviar"+valorAtual+"').value");
}

function caixa_alta(palavra){
	document.getElementById('palavra').value = palavra.value.toUpperCase();
}
function chamaRetornoEnvioAmigo(divSelecionado){
	alert("Enviado com sucesso.");
	eval("document.getElementById('divEnviarParaAmigoStatus"+valorAtual+"').value=0");
	eval("document.getElementById('divEnviarParaAmigo"+valorAtual+").innerHTML = ''");
}

function selecinaDataEventoAgenda(dia,mes,ano){
	mensagem = '<center><img src=img/loading.gif border=0><br>Carregando...</center>';
	enviaRequisicao5('boxIntern','ler_pagina_remota.php?pagina=1&agenda=1&dia='+dia+'&mes=0'+mes+'&ano='+ano,mensagem);		
}
function chamaCicloVida(){
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando categoria...</div>';
	enviaRequisicao('conteudo','ler_pagina_remota.php?secao=29&pagina=1',mensagem);
}
function mudaCategoria(valor){
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando categoria...</div>';
	if(valor.value == ""){
		enviaRequisicao('conteudo','ler_pagina_remota.php?todos='+valor.value+'&pagina=1',mensagem);
	}else{
		enviaRequisicao('conteudo','ler_pagina_remota.php?secao='+ valor.value +'&pagina=1',mensagem);
	}	
}
function mudaCategoriaPaginador(secao,pagina,pesquisa){
	
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando ...</div>'
	if (secao != ''){
		enviaRequisicao('conteudo','ler_pagina_remota.php?secao='+ secao +'&pagina='+pagina,mensagem);
	}else{
		enviaRequisicao('conteudo','ler_pagina_remota.php?pesquisa='+ pesquisa +'&pagina='+pagina,mensagem);
	}
}


var counter = 0;

function Update() {
   counter ++;
   if (counter>13){
   	counter =1;
   }
   valor = 'Carregando...';
   texto = valor.substr(0,counter);
   newoption = new Option(texto, '', false, false);
   document.getElementById('categoriasInicio').options[0] = newoption;	

   ID=window.setTimeout("Update();",200);

}

function abreGaleriaVideos(pagina){	
	if (pagina==undefined){
		paginaAtual = 1;
	}else{
		paginaAtual = parseInt(pagina);
	}
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando Video...</div>'
	enviaRequisicao('conteudo','ler_pagina_remota.php?video=1&pagina='+paginaAtual,mensagem);
}

function abreGaleriaImagens(){
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando ...</div>'
	enviaRequisicao('conteudo','ler_pagina_remota.php?galeria=1&pagina=1',mensagem);
	
}
function mascaraData(campoData, id){
	
  var data = campoData.value;
  if (data.length == 2){
      data = data + '/';
      document.getElementById(id).value = data;
      return true;              
  }
  if (data.length == 5){
      data = data + '/';
      document.getElementById(id).value = data;
      return true;
  }
}
function sonumeros(numero){
	//verifica o enter (13), o delete (46), o backspace (8), o end (35), o home (36) e as setas (37,38,39,40)
	if ((numero.keyCode >= 35 && numero.keyCode <= 40) || (numero.keyCode == 46) ||
		(numero.keyCode == 8) || (numero.keyCode == 13) || (numero.keyCode == 9) ||
		(numero.keyCode >= 48 && numero.keyCode <= 57) || (numero.keyCode >= 96 && numero.keyCode <= 105)){
		return true;
	}else{
		return false;
	}
}

function submeterFiliese(){
	if(tiraEspaco(document.getElementById('nomeFiliese').value) == ""){	
		alert("Informe o nome.");
		document.getElementById('nomeFiliese').focus();
		return;
	}
	if (!doDate(document.getElementById('dtNascFiliese').value)){
		alert("Data de Nascimento invÃ¡lida.");
		document.getElementById('dtNascFiliese').focus();
		return;
	}	
	if ((!document.getElementById('sexoMFiliese').checked) && (!document.getElementById('sexoFFiliese').checked)){
		alert("Sexo invÃ¡lido.");
		return;
	}
	if(tiraEspaco(document.getElementById('enderecoFiliese').value) == ""){	
		alert("Informe o EndereÃ§o.");
		document.getElementById('enderecoFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('bairroFiliese').value) == ""){	
		alert("Informe o Bairro.");
		document.getElementById('bairroFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('municipioFiliese').value) == ""){	
		alert("Informe o MunicÃ­pio.");
		document.getElementById('municipioFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('estadoFiliese').value) == ""){	
		alert("Informe o Estado.");
		document.getElementById('estadoFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('cepFiliese').value) == ""){	
		alert("Informe o Cep.");
		document.getElementById('cepFiliese').focus();
		return;
	}
	if(document.getElementById('emailFiliese').value != ""){
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('emailFiliese').value))){ 
			alert("E-mail invÃ£¡lido.");
	        document.getElementById('emailFiliese').focus(); 
	   	    return;
	    }
	} 	
	if(tiraEspaco(document.getElementById('escolaridadeFiliese').value) == ""){	
		alert("Informe a Escolaridade.");
		document.getElementById('escolaridadeFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('naturalidadeFiliese').value) == ""){	
		alert("Informe a Naturalidade.");
		document.getElementById('naturalidadeFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('religiaoFiliese').value) == ""){	
		alert("Informe a ReligiÃ£o.");
		document.getElementById('religiaoFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('profissaoFiliese').value) == ""){	
		alert("Informe sua ProfissÃ£o.");
		document.getElementById('profissaoFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('numTituloFiliese').value) == ""){	
		alert("Informe o nÃºmero do TÃ­tulo.");
		document.getElementById('numTituloFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('zonaFiliese').value) == ""){	
		alert("Informe a zona do TÃ­tulo.");
		document.getElementById('zonaFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('secaoFiliese').value) == ""){	
		alert("Informe a seÃ§Ã£o do TÃ­tulo.");
		document.getElementById('secaoFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('munTitFiliese').value) == ""){	
		alert("Informe o MunicÃ­pio do TÃ­tulo.");
		document.getElementById('munTitFiliese').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('estadoTitFiliese').value) == ""){	
		alert("Informe o Estado do TÃ­tulo.");
		document.getElementById('estadoTitFiliese').focus();
		return;
	}
	setarCamposFiliese();
	mensagem = '<div align="center" id="loading"><img src=img/loading.gif border=0><br>Carregando...</div>';
	enviaRequisicao3('colLeft','ler_pagina_remota_post.php?'+campos,mensagem);
	
}
function setarCamposFiliese(){
	campos = "nomeFiliese="+encodeURI(document.getElementById('nomeFiliese').value);
	campos += "&dtNascFiliese="+encodeURI(document.getElementById('dtNascFiliese').value);
	if (document.getElementById('sexoMFiliese').checked){
		campos += "&sexo=M";
	}else{
		campos += "&sexo=F";
	}
	campos += "&enderecoFiliese="+document.getElementById('enderecoFiliese').value;
	campos +="&complementoFiliese="+encodeURI(document.getElementById('complementoFiliese').value);
	campos +="&bairroFiliese="+encodeURI(document.getElementById('bairroFiliese').value);
	campos +="&municipioFiliese="+encodeURI(document.getElementById('municipioFiliese').value);
	campos +="&estadoFiliese="+encodeURI(document.getElementById('estadoFiliese').value);
	campos +="&cepFiliese="+encodeURI(document.getElementById('cepFiliese').value);
	campos +="&telFixoFiliese="+encodeURI(document.getElementById('telFixoFiliese').value);
	campos +="&celFiliese="+encodeURI(document.getElementById('celFiliese').value);
	campos +="&emailFiliese="+encodeURI(document.getElementById('emailFiliese').value);
	campos +="&escolaridadeFiliese="+encodeURI(document.getElementById('escolaridadeFiliese').value);
	campos +="&naturalidadeFiliese="+encodeURI(document.getElementById('naturalidadeFiliese').value);
	campos +="&religiaoFiliese="+encodeURI(document.getElementById('religiaoFiliese').value);
	campos +="&profissaoFiliese="+encodeURI(document.getElementById('profissaoFiliese').value);
	campos +="&paiFiliese="+encodeURI(document.getElementById('paiFiliese').value);
	campos +="&maeFiliese="+encodeURI(document.getElementById('maeFiliese').value);
	campos +="&numTituloFiliese="+encodeURI(document.getElementById('numTituloFiliese').value);
	campos +="&zonaFiliese="+encodeURI(document.getElementById('zonaFiliese').value);
	campos +="&secaoFiliese="+encodeURI(document.getElementById('secaoFiliese').value);
	campos +="&munTitFiliese="+encodeURI(document.getElementById('munTitFiliese').value);
	campos +="&estadoTitFiliese="+encodeURI(document.getElementById('estadoTitFiliese').value);
}

function exibeBandeiras(campo){
	atual = document.getElementById('conteudo'+campo).style.display;
	if (atual=='none'){
		document.getElementById('conteudo'+campo).style.display='block';
		document.getElementById('acao'+campo).innerHTML='<img style="cursor:pointer" onclick="exibeBandeiras(\''+campo+'\')" src="img/-.gif">';
	}else{
		document.getElementById('conteudo'+campo).style.display='none';
		document.getElementById('acao'+campo).innerHTML='<img style="cursor:pointer" onclick="exibeBandeiras(\''+campo+'\')" src="img/+.gif">';
	}
}		
function exibeBandeiras2(campo){
	atual = document.getElementById('conteudo'+campo).style.display;
	if (atual=='none'){
		document.getElementById('conteudo'+campo).style.display='block';
		document.getElementById('acao'+campo).innerHTML='<img style="cursor:pointer" onclick="exibeBandeiras2(\''+campo+'\')" src="img/projetos_de_leis_-.gif">';
	}else{
		document.getElementById('conteudo'+campo).style.display='none';
		document.getElementById('acao'+campo).innerHTML='<img style="cursor:pointer" onclick="exibeBandeiras2(\''+campo+'\')" src="img/projetos_de_leis_+.gif">';
	}
}

function paginaInterna(caminho){
	mensagem = '<div align=center style="font-family:Arial, Helvetica;font-size:10px;height:110px;float:center"><br><br><img src=img/loading.gif border=0><br>Carregando ...</div>'
	enviaRequisicao3('colLeft',caminho,mensagem);	
}
function abreFaleConosco(){ paginaInterna('contato.php');}
function abreFilie(){	paginaInterna('filiese.php');}
