﻿function checkout_images(f) {

    if (f.paymentmethod.value == 0) {
        alert('Please select your payment method');
        return false;
    }
    else if (f.cardholdername.value == "" && (f.paymentmethod.value != 5)) {
        alert('Please enter the card holder name');
        return false;
    }
    else if (f.cardnumber.value == "" && (f.paymentmethod.value != 5)) {
        alert('Please enter your credit or debit card number');
        return false;
    }
    else if ((f.cardnumber.value.length != 15) && (f.cardnumber.value.length != 16) && (f.cardnumber.value.length != 18) && (f.paymentmethod.value != 5)) {
        alert('Please make sure you enter all the digits of your credit or debit card number');
        return false;
    }
    else if (f.cardstartdate.value == "" && (f.paymentmethod.value != 5)) {
        alert('Please enter the card start date');
        return false;
    }
    else if (f.cardexpiry.value == "" && (f.paymentmethod.value != 5)) {
        alert('Please enter the card expiry date');
        return false;
    }
    else if (((f.cardsecurity.value.length < 3) || (f.cardsecurity.value.length > 4)) && (f.paymentmethod.value != 5)) {
        alert('Please enter the security number\nFor most cards this is the last 3 digits on the BACK of the card at the top of the signature strip\nFor American Express it is the 4 digits printed on the FRONT of the card above the account number');
        return false;
    }

    //    else if (!(f.declaration.checked)) {
    //      alert('Please confirm you have read the conditions of entry - see the left side menu');
    //       return false;

    else
        return confirm('Are you sure you proceed with this order?');


}
