$(document).ready(function(){
						   		
								$.fx.speeds._default = 1000;
								
								$('#finalPlaca').mask('99');
								$('#preco').mask('999.999,99',{placeholder:"0"});
								$('#dialog').dialog({
									autoOpen: false,
									modal: true,
									show: 'blind',
									closeOnEscape: false,
									closeText: 'hide',
									hide: 'explode',
									//open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); },
									buttons:{
										
											'OK': function(){
												
												window.location = '/controle/cadastro_usuario.php';
											}
									}
									
								});
								
								$('#termosDialog').dialog({
									autoOpen: false,
									modal: true,
									show: 'blind',
									closeOnEscape: false,
									closeText: 'hide',
									hide: 'explode',
									width: '550',
									height: '460',
									//open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); },
									buttons:{
										
											'Fechar': function(){
												
												$(this).dialog('close');
											}
									}
									
								});

								
								$("#tabs").tabs();
								$("#tabs2").tabs();
								$("#tabs3").tabs();
								$("#tabs4").tabs();
								$("#tabs5").tabs();
								$("#tabs6").tabs();
								
								var icons = {
									header: "ui-icon-circle-arrow-e",
									headerSelected: "ui-icon-circle-arrow-s"
								};
								
								$("#termos").button();
								$("#termos").click(function() {
															
												$('#termosDialog').dialog('open');			
											});
								
								$("#accordion1").accordion({ header: "h3", event: "mouseover", icons: icons });
								
						   		$('#formulario').ajaxForm({ 
									// target identifies the element(s) to update with the  response 
									target: '#resultado', 
									beforeSubmit: function(arr, $form, options) { 
										
										$.blockUI({ 
											  theme:     true, 
											  title:    'Processando...', 
											  message:  '<div width=100% align=center><img src="../views/css/images/wait.gif" /></div>'
											  
											  });
										
									},
							 		//resetForm: true,
									// success identifies the function to invoke when the  response 
									// has been received; here we apply a fade-in effect to the new content 
									success: function(data) {
										$.unblockUI();										
										if(data.substring(0,8) == "alterado" ){
											
											window.location = '/controle/cadastro_veiculo.php?idVeiculo=' + data.substring(8,data.length) ;
											
										}else {
											
											if( data != "sucesso" ){
											
												$("#resultado").html(data);
												
											}else{
												
												$("#resultado").html("Ve&iacute;culo cadastrado com sucesso.");
	
											}
											
										}
										
										
										
										
 
									} 
								}); 
								
								$("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=modelos]").change(function(){
									$("select[name=modelosExtenso]").html('<option value="0">Carregando...</option>');
									
									$.post("../controle/combos.php",
										  {modelo:$(this).val(), acao:"carregarModelosExtenso"},
										  function(valor){
											 $("select[name=modelosExtenso]").html(valor);
										  }
										  )
									
								 });
								
							});



