
      $().ready(function() {
			
			$("#carregando").hide();
			
			$('#cidadeCentros').attr("disabled", true); 
			
			$('#modalidadeCentros').attr("disabled", true);
			
			$('#btEnviar').attr("disabled", true);
			
			
			//$("#cont_le_centros").hide();


      		
			$("select[@name=uf]").change(function()
			{	
				
				 $('#cidadeCentros').attr("disabled", false); 
     			 
				 $('select[@name=cidadeCentros]').html('<option value="sda">Carregando Cidade...</option>');
				
				 $("#carregando").ajaxStart(function(){	$("#carregando").show(); });
					
				 $("#carregando").ajaxStop(function() {	$("#carregando").hide(); });

      			 $.post('../../aplicativos/centros/WEB_INF/buscaCidade.php',{ uf : $(this).val() },function(resposta)
				 {
      				$('select[@name=cidadeCentros]').html(resposta);
     			 }

    			 );

     		 });
			
			
			
			$("select[@name=cidadeCentros]").change(function()
			{
				 $('#modalidadeCentros').attr("disabled", false);
			
				$('select[@name=modalidadeCentros]').html('<option value="sda">Carregando Modalidade...</option>');
				
				$("#carregandoEspecialidade").ajaxStart(function(){ $("#carregandoEspecialidade").show();  });
					
				$("#carregandoEspecialidade").ajaxStop(function(){ $("#carregandoEspecialidade").hide();   });


      			 $.post('../../aplicativos/centros/WEB_INF/buscaModalidade.php',{ cidadeCentros : $(this).val(), uf : $("#uf").val() },function(resposta)
				 {
      				$('select[@name=modalidadeCentros]').html(resposta);
     			 }

    			 );

     		 });
			
			
			
			$("select[@name=modalidadeCentros]").change(function()
			{	
			
				$('#btEnviar').attr("disabled", false); 
			});
			
	
			
			$("#btEnviar").click(function()
			{
			
				$('#cidadeCentros').attr("disabled", true); 
				
				$('#modalidadeCentros').attr("disabled", true);
				
				$("#cont_le_centros").fadeIn("normal");	
				
                $.post('../../aplicativos/centros/WEB_INF/resultado_busca.php',{ uf : $("#uf").val(), cidadeCentros: $("#cidadeCentros").val() },function(resultado_busca)
				 {
      				
					$('#cont_le_centros').html(resultado_busca);
     			 $('#btEnviar').attr("disabled", true);
				$('#fotos_estados').cycle({
			   fx:     'fade',
			   speed:   600,
			   timeout: 3000,
			   next:   '#next2',
			   prev:   '#prev2' ,
			   pause:   1
			});
				
			
				
				 
				 }

    			 );
				
				
							
			});

      });

