$(document).ready(function() {
    $("table.newsletter-form input.submit").click(function() {
        if ($("input[name=name]").val().replace(/^\s*|\s*$/g, "") == "") {
            alert("Please enter your name");
            return false;
        } else if ($("input[name=email]").val().replace(/^\s*|\s*$/g, "") == "") {
            alert("Please enter your e-mail address");
            return false;
        } else
            return true;
    });

    // For some reason, Firefox 2 renders the attachment image with too much of
    // a margin, so we correct here.  It works fine in all other tested
    // browsers.  This is a total hack.
    if (($.browser.mozilla) && ($.browser.version.substring(0, 5) == "1.8.1")) {
        var attachment = $("div#attachment");
        var marginTop = attachment.css("margin-top");
        if (marginTop == "0px")
            var offset = 0;
        else
            var offset = new Number(marginTop.substring(0, 3));
        offset += 23;
        attachment.css("margin-top", offset.toString() + "px");
    }
});
