function ForgotPasswordSubmit(form)
{
    SetError("email_error", "");
    successful = true;
    with (form)
    {
        if (!ValidateRequired(email))
        {
            SetError("email_error", "Missing email address");
            successful = false;
        }
        else
        {
            if (!ValidateEmail(email))
            {
                SetError("email_error", "Invalid email address");
                successful = false;
            }
        }
    }
    return successful;
}

function ValidateRequired(field)
{
    with (field)
    {
        if (value == null || value == "")
            return false;
    }
    return true;
}

function ValidateEmail(field)
{
    with (field)
    {
        at = value.indexOf("@");
        dot = value.lastIndexOf(".");
        if (at < 1 || dot - at < 2) 
            return false;
    }
    return true;
}

function SetError(id, text)
{
    document.getElementById(id).innerHTML = text;
}

