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;
	}
	enviaRequisicao3('enquete','ler_pagina_remota.php?pagina=2&enqResultado='+valor_id,'<strong>Carregando...</strong>');
}
function exibeMaisLeis(value){
	if(value==1){
		document.getElementById('projVer').style.display='block';
		document.getElementById('btnDown').style.display='none';
		document.getElementById('btnUp').style.display='block';
	}else{
		document.getElementById('projVer').style.display='none';
		document.getElementById('btnDown').style.display='block';
		document.getElementById('btnUp').style.display='none';
	}
}

function validaNewsletter(){
	if(tiraEspaco(document.getElementById('nome').value) == ""){	
		alert("Informe o seu nome.");
		document.getElementById('nome').focus();
		return;
	}
	if(tiraEspaco(document.getElementById('email').value) == ""){
		alert("Informe o e-mail.");
		document.getElementById('email').focus();
		return ;	
	}else{	
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email').value))){ 
			alert("Email inválido.");
	        document.getElementById('email').focus(); 
	   	    return;
	    }
	}	
	campos = "pagina=1&newsletter=1&email="+encodeURI(document.getElementById('email').value)+"&nome="+encodeURI(document.getElementById('nome').value);
	enviaRequisicao('newsletter','ler_pagina_remota.php?'+campos,'<div style="height:45px"><br/>&nbsp;Enviando...</div>');	
}


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

function buscar()
{
	if(document.getElementById("cmp-busca").value == "")
	{
		alert("Informe alguma palavra chave para busca!");
		document.getElementById("cmp-busca").focus();
		return;
	}
	document.getElementById("busca").submit();
}

function enviaContato()
{
	
	if((document.getElementById("nome_cont").value == "Nome")||(document.getElementById("nome_cont").value == ""))
	{
		alert("Informe seu nome!");
		document.getElementById("nome_cont").focus();
		return;
	}
	if((document.getElementById("email_cont").value == "E-mail")||(document.getElementById("email_cont").value == ""))
	{
		alert("Informe seu e-mail!");
		document.getElementById("email_cont").focus();
		return;
	}
	if((document.getElementById("msg_cont").value == "Mensagem")||(document.getElementById("msg_cont").value == ""))
	{
		alert("Informe uma mensagem!");
		document.getElementById("msg_cont").focus();
		return;
	}
	document.getElementById("form-contato").submit();
}


