
		function envia_msg(){
		
			if (document.form_cadastro.nome.value == 'nome') {						
				
			dialogo_generico("Faltou digitar o nome!");							
								
		    } else if (document.form_cadastro.mail.value == 'mail') {			
				
			dialogo_generico("Faltou digitar o email!");
			
			} else {
			    
				
				
                par  = "nome="      + escape(document.form_cadastro.nome.value);
				par += "&mail="    + document.form_cadastro.mail.value;
			
			
				send_ajax('cadastra.php', par, envia_msg_ok);			
			
			}
			
		}
		
		
		function envia_msg_ok(retorno)
		
		{	
		
			    if (retorno == "S")
				{
					dialogo_generico("Obrigado! Cadastro efetuado com sucesso!");
					document.form_cadastro.reset();
					
				} else if (retorno == "K") {
				
					dialogo_generico("E-mail já cadastrado!");
										
				} else  if (retorno == "X") {
				
					dialogo_generico("E-mail errado!")
				
				} else {
				
					dialogo_generico("Erro desconhecido!")
				
				}
			
			
		}

		 
     function dialogo_generico(msg) {

					  $(function () {

							$("#dialog").dialog('open');	

							$("#dialog").dialog({

								

					            resizable: false,

					            height:140,

								bgiframe: true,

								modal:true,
								
								position: 'center',

								buttons: {

										Ok: function() {

											$(this).dialog('close');

											

										}

									}

							});

						});

							

						dialogo = document.getElementById('msg2');

						dialogo.innerHTML = "<strong>"+msg+"</strong>";

					}



