function showPasswordResetForm ( )
{

	var dialog = $('<div style="display:hidden" id="newDialog"></div>').appendTo('body');

	$("#newDialog").html("<image src='../img/progressAnimation.gif'/><a>&nbsp; Cargando...<a/>");
				
	$("#newDialog").dialog({ 
		bgiframe: true,
		buttons: { "Cerrar": function() { $(this).dialog("close"); }, 
			   "Aceptar": function() { passwordReset(); $(this).dialog("close");}
			 },
		modal: true,
		/*show: 'scale', //Allowed Values: 'blind', 'clip', 'drop', 'explode', 'fold', 'puff', 'slide', 'scale', 'size', 'pulsate'.
		hide: 'scale', //Allowed Values: 'blind', 'clip', 'drop', 'explode', 'fold', 'puff', 'slide', 'scale', 'size', 'pulsate'.*/
		title: "Password Recovery" ,
		height: 237,
		width: 377,
		close: function() {
			//$(this).dialog("close");
			//$("#newDialog").dialog("destroy");
			$("#newDialog").remove();
		}
	});
	

	//load Password Reset Form
	//the AJAX request
	$.ajax({
		   type: "GET",
		   url: "../formPasswordRecovery.html",
		   success: function( msg ) {
		
				if ( msg != '' ) {
	
					$("#newDialog").html( msg );
						
				}	   	   
	
		   }
	});
	
}


function passwordReset ( )
{
	
	var email = $("#mail").val();
	
	//the AJAX request
	$.ajax({
		   type: "GET",
		   url: "../restorePassword.php" + "?email=" + email,
		   success: function( msg ) {
		
				if ( msg != '' ) {
					
					alert ( msg ) ;
											
				} else {
					
					alert ( "No se pudo realizar la restauracion, por favor intente en unos minutos." ) ;
					
				}   	   
	
		   }
	});
	
}

