$(document).ready(function(){
						   		
								$('#idade').mask('99/99/9999'),
								$('#cpf').mask('999.999.999-99'),
								$('#dddTelefone').mask('99'),
								$('#nrTelefone').mask('9999-9999'),
								$('#dddCelular').mask('99'),
								$('#nrCelular').mask('9999-9999'),
								$('#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 = '';
											}
									}
									
								}),
								
								
								$('#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>'
											  
											  });
										
									},
									// 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 == "alterado"  ){
											
											$("#resultado").html('Dados alterados com sucesso.');
											
										}else {
											
											if( data.length > 0 ){
											
												$("#resultado").html(data);
											
											}else{
												
												$('#dialog').dialog('open');
	
											}
										}
										
										
										
									} 
								}),
								
         						$("#tabs").tabs(),
								$("input:submit", ".sub").button(),
								 $("select[name=estados]").change(function(){
									$("select[name=cidades]").html('<option value="0">Carregando...</option>');
									
									$.post("combos.php",
										  {estado:$(this).val(), acao:"carregarCidades"},
										  function(valor){
											 
											 $("select[name=cidades]").html(valor);
										  }
										  )
									
								 })
							});
