
$(document).ready(function(){
						     
							 $('#submt').click(function() { 
								
								$.blockUI({
										  
										  theme:     true, 
										  title:    'Processando...', 
										  message: '<div width=100% align=center><img src="views/css/images/wait.gif" /></div>' });
								
							}),
							 
						   	 
						   
							 $('#formularioLogin').ajaxForm({ 
										// target identifies the element(s) to update with the server response 
										target: '#resultado', 
								 
										// success identifies the function to invoke when the server response 
										// has been received; here we apply a fade-in effect to the new content 
										success: function(data) { 
											
											if( data.length > 0 ){
												
												$("#resultado").html(data);
												
											}else {
												
												window.location = 'controle/home_usuario.php';
											}
	 
										} 
									}),
	
								$("#tabs").tabs(),
								
								$("input:submit", ".sub").button(),
								
								$("select[name=veiculos]").change(function(){
									$("select[name=marcas]").html('<option value="0">Carregando...</option>');
									$("select[name=modelos]").html('<option value="0"></option>');
									$.post("controle/combos.php",
										  {veiculo:$(this).val(), acao:"carregarMarcas"},
										  function(valor){
											  
											 $("select[name=marcas]").html(valor);
										  }
										  )
									
								 }),
								 $("select[name=marcas]").change(function(){
									$("select[name=modelos]").html('<option value="0">Carregando...</option>');
									
									$.post("controle/combos.php",
										  {marca:$(this).val(), acao:"carregarModelos", tipo:$("select[name=veiculos]").val()},
										  function(valor){
											 $("select[name=modelos]").html(valor);
										  }
										  )
									
								 }),
								 $("select[name=estados]").change(function(){
									$("select[name=cidades]").html('<option value="0">Carregando...</option>');
									
									$.post("controle/combos.php",
										  {estado:$(this).val(), acao:"carregarCidades"},
										  function(valor){
											 
											 $("select[name=cidades]").html(valor);
										  }
										  )
									
								 })
	
});