function verificaCartao(form){
	email = new RegExp("^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$");
	 var id=0;
	    for(i=0;i<form.radio.length ;i++){
	        if(form.radio[i].checked){
	            temp=form.radio[i].value;	                       
	            id=temp;
	        }
	    }
	    if(id==0){
	        alert("Selecione o cartão");
	        return false;
	    }
	    if(form.nome.value==""){
	    	alert("Digite o nome");
	    	return false;
	    }
	    if(form.email.value==""){
	    	alert("Digite o e-mail");
	    	return false;
	    }
	    if(!email.test(form.email.value)){
	        alert("O e-mail está incorreto");
	        return false;
	    }
	    if(form.mensagem.value==""){
	    	alert("Digite a mensagem");
	    	return false;
	    }
	
}

function verificaContato(form){
	email = new RegExp("^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$");
	    if(form.nome.value==""){
	    	alert("Digite o nome");
	    	return false;
	    }
	    if(form.email.value==""){
	    	alert("Digite o e-mail");
	    	return false;
	    }
	    if(!email.test(form.email.value)){
	        alert("O e-mail está incorreto");
	        return false;
	    }
	    if(form.mensagem.value==""){
	    	alert("Digite a mensagem");
	    	return false;
	    }
	
}

function verificaSuaArte(form){
	email = new RegExp("^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$");
	
	if(form.arquivo.value==""){
	    	alert("Escolha um arquivo");
	    	return false;
	    }
	    if(form.nome.value==""){
	    	alert("Digite o nome");
	    	return false;
	    }
	    if(form.email.value==""){
	    	alert("Digite o e-mail");
	    	return false;
	    }
	    if(!email.test(form.email.value)){
	        alert("O e-mail está incorreto");
	        return false;
	    }
		if(form.cidade.value==""){
	    	alert("Digite a cidade");
	    	return false;
	    }
		if(form.uf.value==""){
	    	alert("Escolha a UF");
	    	return false;
	    }
		if(form.titulo.value==""){
	    	alert("Digite o título");
	    	return false;
	    }
	    if(form.descricao.value==""){
	    	alert("Digite a descrição");
	    	return false;
	    }
	
}

	function enviarVoto(form,id){	
		ajax("validarvoto.php?id="+id,"carrega");
	}
	
	function listarRespostas(form){	
		for (i=0;i<form.idTipoPessoa.length;i++){
			if (form.idTipoPessoa[i].checked==true){
				tipo = form.idTipoPessoa[i].value;
			}
		}
		ajax("listarRespostas.php?idTipoPessoa="+tipo+"&valor="+url_encode(form.valor.value)+"&uf="+form.uf.value+"&busca="+url_encode(form.busca.value),"conteudo");
		return false;
	}
	
	function url_encode(str) {
      var hex_chars = "0123456789ABCDEF";
      var noEncode = /^([a-zA-Z0-9\_\-\.])$/;
      var n, strCode, hex1, hex2, strEncode = "";

      for(n = 0; n < str.length; n++) {
          if (noEncode.test(str.charAt(n))) {
              strEncode += str.charAt(n);
          } else {
              strCode = str.charCodeAt(n);
              hex1 = hex_chars.charAt(Math.floor(strCode / 16));
              hex2 = hex_chars.charAt(strCode % 16);
              strEncode += "%" + (hex1 + hex2);
          }
      }
      return strEncode;
}

function listarGrafico(form,pg){	
		for (i=0;i<document.form.idTipoPessoa.length;i++){
			if (document.form.idTipoPessoa[i].checked==true){
				tipo = document.form.idTipoPessoa[i].value;
			}
		}
		location.href="index_formatado.php?idTipoPessoa="+tipo+"&valor="+document.form.valor.value+"&uf="+document.form.uf.value+"&busca="+document.form.busca.value+"&action=on&tipo="+form.value+"&pagina="+pg;
	}