$(document).ready(function(){

	/*###########################
	INSCRIÇÕES - CARREGAR CIDADES
	###########################*/
	$('#estadoins').change(function(){
		if($(this).val() != ""){
			$('#cidadeins').html('<option value="">carregando...</option>');
			var aux = $(this).val().split('_');
			var estado = aux[0];
			$.post("ajax_carregar_cidade.php", {estado : estado}, function(result){
				$('#cidadeins').html(result);
			});
		}
		else{
			$('#cidadeins').html('<option value=""> -- </option>');
		}
	});
	
	/*###########################################
	INSCRIÇÕES - CARREGAR CAMPOS EXTRAS DO CARGO
	###########################################*/
	$('#cargoins').change(function(){
		if($(this).val() != ""){
			$('#tr_cargocampoextra').css('display','');
			$('#tr_cargocampoextra > td > table').html('<tr><td align="center" style="color:#f00;font-size:12px">carregando...</td></tr>');
			var cargo = $(this).val();
			$.post("ajax_carregar_cargocampoextra.php", {cargo : cargo}, function(result){
				$('#tr_cargocampoextra > td > table').html(result);
			});
		}
		else{
			$('#tr_cargocampoextra').css('display','none');
			$('#tr_cargocampoextra > td > table').empty();
		}
	});
	
	/*###########################################
	INSCRIÇÕES - EXIBIR/ESCONDER CAMPOS PNE
	###########################################*/
	$('#deficienciains_s').click(function(){
		$('#tr_solicitacaoins').css('display','');
		$('#tr_espdeficienciains').css('display','');
	});
	$('#deficienciains_n').click(function(){
		$('#tr_espdeficienciains').css('display','none');
		$('#tr_solicitacaoins').css('display','none');
		$('#espdeficienciains').val('');
		$("#solicitacaoins option:selected").each(function(){
			$(this).attr('selected','');
		});
	});
	
	/*###########################################
	FAÇA SEU CADASTRO
	###########################################*/
	$('#bot').click(function(){
		if($('#nomecad').val()=='' || $('#emailcad').val()==''){
			alert('Por favor, informe o nome e o email');
			return false;
		}
	});
	
	/*###########################################
	SELECT CONCURSOS EM ANDAMENTO
	###########################################*/
	$('#conc_andamento').change(function(){
		if($(this).val() != ''){
			var id = $(this).val();
			var url = $('#url').val();
			window.location.href = url+'/leiamais.php?idtitulo='+id;
		}
	});
	
	/*###########################################
	VER DOCUMENTOS
	###########################################*/
	$('.verdoc').click(function(){
		var idtitulo = $(this).attr('idtitulo');
		var status = $('#ul_'+idtitulo).css('display');
		if(status == 'none'){
			$('#ul_'+idtitulo).show();
		}
		else{
			$('#ul_'+idtitulo).hide();
		}
	});
        
	
	/*###########################################
	EXIBE SELECT - CONCURSOS EM ANDAMENTO
	###########################################*/
	$('[menufloat=1]').hover(function(){
		var display = $('#option_concurso_andamento').css('display');
        if(display == 'none'){
        	$('#option_concurso_andamento').show();
        }
    },function(){
    	$('#option_concurso_andamento').hide();
	});
    
	
    
    
});

function mostrar()
{
  var Elm = document.getElementById("botao");
  if(Elm.checked == true)
  {
    Elm.style.display='none';
    Elm.checked = false;
  }
  else
  {
    Elm.style.display='block';
    Elm.checked = true;
  }
}

function campo_vazio()
{
    form = document.frm_cpf;
    if ((form.txt_cpf.value.length < 1))
    {
        alert("Você deve inserir um CPF válido");
        return false;
    }
    return true;
}
