﻿/// <reference path="fotoblur-1.0.3.js" />

// do stuff when dom is ready
$(document).ready(function() {

});

function submitEmail() {
    $('#txtMessage').hide("fast");
    var email = $.trim($("#txtEmail").val());
    if (email.length > 0 && fb.util.validateEmail(email))
    {
        $("#btnSubmit").attr("disabled", "disabled");
        $('#txtMessage').html("<img src=\"" + fb.util.root() +
                "images/indicator.gif\" style=\"border:none; vertical-align:bottom; margin-right:5px;\" />Searching for account. . . Please wait.");
        $('#txtMessage').show("fast");

        $.post(fb.util.root() + "handlers/recoverpassword.ashx", { "email": email },
            function(data) {
                if (!fb.util.isObjEmpty(data)) {
                    $('#txtMessage').html(data.message);
                    $("#txtEmail").val("");
                }
                else {
                    $('#txtMessage').html("Response from server failed.  Please try again.");
                }
                $("#btnSubmit").removeAttr("disabled");
            }, "json");
    }
    else {
        $('#txtMessage').show("fast");
        $('#txtMessage').html("Please enter a valid email address.");
    }
}
