var img1;
var img2;

function doDonation()
{
    var amount = document.donation.aq_0.value;
    if (amount == '') {
        alert("Please specify a donation amount.");
        document.donation.aq_0.focus();
        return;
    }
    var re = /^(\d+(\.\d\d)?|\.\d\d)$/;
    if (!re.test(amount)) {
        alert("Invalid donation amount.");
        document.donation.aq_0.focus();
        return;
    }
    if (parseFloat(amount) < 5) {
        alert("The minimum credit card donation amount is $5.");
        document.donation.aq_0.focus();
        return;
    }

    document.donation.description_0.value = "FNCPL, Inc. donation for the Armonk Players";

    if (document.donation.matched.checked) {
        var company = document.donation.company.value;
        var re = /^ *$/;
        if (re.test(company)) {
            alert("Please specify the company name.");
            document.donation.company.focus();
            return;
        }
        document.donation.description_0.value += ", matched by " + company;
    }

    document.donation.cont.value = location.href;
    document.donation.submit();
}


(function() {
    var onloadSave = window.onload;
    window.onload = function() {
        if (typeof onloadSave == "function")
            onloadSave();

        img1 = new Image();
        img1.src = "images/donate.gif";
        img2 = new Image();
        img2.src = "images/donate2.gif";

        document.donation.aq_0.value = '';

        document.getElementById("company").style.display = "none";
        document.donation.matched.checked = false;
        document.donation.aq_0.focus();
    };
})();
