// JavaScript Document


function onoff(id) {
var el = document.getElementById(id);
el.style.display = (el.style.display=="none") ? "" : "none"; 
}


function lookup(inputString) {
	
	if(inputString.length == 0) {
		// Hide the suggestion box.
		$('#suggestions').hide();
	} else {
		$.post("cidades.php", {queryString: ""+inputString+""}, function(data){
		
		if(data.length >0) {
			$('#suggestions').show();
			$('#autoSuggestionsList').html(data);
		}
	});
	}
} // lookup
	
function fill(thisValue) {
		$('#inputString').val(thisValue);
		setTimeout("$('#suggestions').hide();", 200);
} 

function indique(){
		window.open('form2.php','Indique', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=350,height=310');
}

function favorito(){
    var url      = "http://www.politicosbrasileiros.com.br/";
    var title    = "Politicos Brasileiros Site sobre os politicos do Brasil!";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}

function valida_campos(form){

	 if(cadastro.nome.value==""){
	   alert("Campo Nome é obrigatório!");
	    cadastro.nome.focus();
		cadastro.nome.style.backgroundColor ="#FFE4E4";
		cadastro.nome.select();
	   return false;
	 }
	 if(cadastro.nome_resp.value==""){
	   alert("Campo Nome Responsável é obrigatório!");
	    cadastro.nome_resp.focus();
		cadastro.nome_resp.style.backgroundColor ="#FFE4E4";
		cadastro.nome_resp.select();
	   return false;
	 }	
	 if(cadastro.nome_parl.value==""){
	   alert("Campo Nome do Parlamentar é obrigatório!");
	    cadastro.nome_parl.focus();
		cadastro.nome_parl.style.backgroundColor ="#FFE4E4";
		cadastro.nome_parl.select();
	   return false;
	 }	 
	 if(cadastro.estado.value==""){
	   alert("Campo Estado é obrigatório!");
	    cadastro.estado.focus();
		cadastro.estado.style.backgroundColor ="#FFE4E4";
		cadastro.estado.select();
	   return false;
	 }	
	 if(cadastro.cidade.value==""){
	   alert("Campo Cidade é obrigatório!");
	    cadastro.cidade.focus();
		cadastro.cidade.style.backgroundColor ="#FFE4E4";
		cadastro.cidade.select();
	   return false;
	 }	 
	 if(cadastro.cargo.value==""){
	   alert("Campo Cargo do Parlamentar é obrigatório!");
	    cadastro.cargo.focus();
		cadastro.cargo.style.backgroundColor ="#FFE4E4";
		cadastro.cargo.select();
	   return false;
	 }	
	 if(cadastro.telefone.value==""){
	   alert("Campo Telefone é obrigatório!");
	    cadastro.telefone.focus();
		cadastro.telefone.style.backgroundColor ="#FFE4E4";
		cadastro.telefone.select();
	   return false;
	 }	 
     if(cadastro.email.value==""){
	   alert("Campo e-mail é obrigatório!");
	    cadastro.email.focus();
		cadastro.email.style.backgroundColor ="#FFE4E4";
		cadastro.email.select();
	   return false;
	 }

     if(cadastro.senha.value==""){
	   alert("Campo Senha é obrigatório!");
	    cadastro.senha.focus();
		cadastro.senha.style.backgroundColor ="#FFE4E4";
		cadastro.senha.select();
	   return false;
	 }
     if(cadastro.rept_senha.value==""){
	   alert("Campo Repetir Senha é obrigatório!");
	    cadastro.rept_senha.focus();
		cadastro.rept_senha.style.backgroundColor ="#FFE4E4";
		cadastro.rept_senha.select();
	   return false;
	 }	
     if(cadastro.rept_senha.value!=cadastro.senha.value){
	   alert("Campo Repetir senha diferente da Senha!");
	    cadastro.rept_senha.focus();
		cadastro.rept_senha.style.backgroundColor ="#FFE4E4";
		cadastro.rept_senha.select();
	   return false;
	 }	 
}
function valida_campos2(form){


	 if(cadastro.nome_resp.value==""){
	   alert("Campo Nome Responsável é obrigatório!");
	    cadastro.nome_resp.focus();
		cadastro.nome_resp.style.backgroundColor ="#FFE4E4";
		cadastro.nome_resp.select();
	   return false;
	 }	
	 if(cadastro.nome_parl.value==""){
	   alert("Campo Nome do Parlamentar é obrigatório!");
	    cadastro.nome_parl.focus();
		cadastro.nome_parl.style.backgroundColor ="#FFE4E4";
		cadastro.nome_parl.select();
	   return false;
	 }	 
	 if(cadastro.estado.value==""){
	   alert("Campo Estado é obrigatório!");
	    cadastro.estado.focus();
		cadastro.estado.style.backgroundColor ="#FFE4E4";
		cadastro.estado.select();
	   return false;
	 }	
	 if(cadastro.cidade.value==""){
	   alert("Campo Cidade é obrigatório!");
	    cadastro.cidade.focus();
		cadastro.cidade.style.backgroundColor ="#FFE4E4";
		cadastro.cidade.select();
	   return false;
	 }	 
	 if(cadastro.cargo.value==""){
	   alert("Campo Cargo do Parlamentar é obrigatório!");
	    cadastro.cargo.focus();
		cadastro.cargo.style.backgroundColor ="#FFE4E4";
		cadastro.cargo.select();
	   return false;
	 }	
     if(cadastro.email.value==""){
	   alert("Campo e-mail é obrigatório!");
	    cadastro.email.focus();
		cadastro.email.style.backgroundColor ="#FFE4E4";
		cadastro.email.select();
	   return false;
	 }	 
	 if(cadastro.telefone.value==""){
	   alert("Campo Telefone é obrigatório!");
	    cadastro.telefone.focus();
		cadastro.telefone.style.backgroundColor ="#FFE4E4";
		cadastro.telefone.select();
	   return false;
	 }	 

}

function valida_campos(form){
	 if(logar_user.email.value==""){
	   alert("Campo email é Obrigatório!");
	    logar_user.email.focus();
		logar_user.email.style.backgroundColor ="#FFE4E4";
		logar_user.email.select();
	   return false;
	 }	
     if(logar_user.senha.value==""){
	   alert("Campo senha é Obrigatório!");
	    logar_user.senha.focus();
		logar_user.senha.style.backgroundColor ="#FFE4E4";
		logar_user.senha.select();
	   return false;
	 }	 

}
function valida_campos3(form){
	var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
	email = cadastroUser.email
	
	if(typeof(email) == "string"){
			if(er.test(email)){ return true; }
	}else if(typeof(email) == "object"){
		if(er.test(email.value)){ 
					return true; 
				}
	}else{
	    email.focus();
		email.style.backgroundColor ="#FFE4E4";
		logar_user.email.select();
		 alert("Campo email está incorreto!");
		return false;
		}
	
     if(cadastroUser.senha.value==""){
	   alert("Campo senha é Obrigatório!");
	    logar_user.senha.focus();
		logar_user.senha.style.backgroundColor ="#FFE4E4";
		logar_user.senha.select();
	   return false;
	 }	 

}

function limpa() {
document.getElementById('inputString').value="";


}

function stAba(menu,conteudo)
	{
		this.menu = menu;
		this.conteudo = conteudo;
	}
 
	var arAbas = new Array();
	arAbas[0] = new stAba('td_desempenho','div_desempenho');
	arAbas[1] = new stAba('td_bens','div_bens');
	arAbas[2] = new stAba('td_processos','div_processos');
	arAbas[3] = new stAba('td_comentarios','div_comentarios');
 
	function AlternarAbas(menu,conteudo)
	{
		for (i=0;i<arAbas.length;i++)
		{
			m = document.getElementById(arAbas[i].menu);
			m.className = 'menu-perfil';
			c = document.getElementById(arAbas[i].conteudo)
			c.style.display = 'none';
		}
		m = document.getElementById(menu)
		m.className = 'menu-sel';
		c = document.getElementById(conteudo)
		c.style.display = '';
	}
 

