function CartForm() { this.step = 1; this.payType = ""; this.overview = document.getElementById('overview'); this.checkoutCart = document.getElementById('checkoutCart'); this.SubmitOrder = document.getElementById('SubmitOrder'); this.errorMessage = document.getElementByClassName('p', 'errormessage'); this.personalDetails = document.getElementById('personalDetails'); this.paymenttype = document.getElementById('paymenttype'); this.information = document.getElementById('information'); this.formCreditCard = document.getElementById('formCreditCard'); this.formSchoolInvoice = document.getElementById('formSchoolInvoice'); this.checkoutConfirmation = document.getElementById('checkoutConfirmation'); if (typeof CartForm._initialized == "undefined") { CartForm.prototype.hideAll = function () { this.overview.style.display = "none"; this.checkoutCart.style.display = "none"; this.errorMessage.style.display = "none"; this.personalDetails.style.display = "none"; this.paymenttype.style.display = "none"; this.information.style.display = "none"; this.formCreditCard.style.display = "none"; this.formSchoolInvoice.style.display = "none"; this.checkoutConfirmation.style.display = "none"; if ((this.step == 2) && (this.payType == "3")) { var oExtras = document.getInnerElementByClassName(this.formSchoolInvoice, 'div', 'formExtras'); oExtras.style.display = "block"; oExtras = document.getInnerElementByClassName(this.formCreditCard, 'div', 'formExtras'); oExtras.style.display = "none"; } }; CartForm.prototype.goTo2 = function () { if (!oCart.loaded) return false; if (this.payType == "2" && oCart.hasInspectedItem()) { alert("Inspection copies may only be requested by schools."); return false; } if (this.payType == "3" && oCart.hasInspectedItem()) { alert("Inspect on Approval items cannot be ordered using credit card for payment. Please select payment by invoice or remove these items."); return false; } var validate = this.validateStep1(); if (!validate) return false; this.hideAll(); this.step++; this.overview.innerHTML = ""; if (this.payType == "2") { var oText = '
';
oText += 'Please enter your payment details.
';
if ((typeof checkTC != "undefined") && (checkTC == true)) {
oText += 'Your total charge will be $' + oCart.getEClubTotal() + '';
} else {
oText += 'Your total purchase is $' + (Number(oCart.getTotal()) - oCart.handlingCharge).toFixed(2) + '
';
oText += 'A handling charge of $' + oCart.handlingCharge + ' applies to personal orders.
';
oText += 'Your total charge will be $' + (Number(oCart.getTotal())).toFixed(2) + '';
}
oText += '
';
oText += 'Please enter your payment details.
';
if ((typeof checkTC != "undefined") && (checkTC == true)) {
oText += 'Your total purchase is $' + oCart.getEClubTotal() + '
';
} else {
oText += 'Your total purchase is $' + oCart.getTotal() + '
';
}
oText += '
A handling fee of $10.00 applies for private customers.
'; } oText += this.getDeliverySummary(); oText += ''; oText += ''; this.checkoutConfirmation.innerHTML = oText; this.checkoutConfirmation.style.display = "block"; var summaryCartTotal = document.getElementById('total'); if (summaryCartTotal) summaryCartTotal.innerHTML = 'Current total: $' + oCart.getTotal(); } } } else { this.submit(); } }; CartForm.prototype.previous = function () { this.hideAll(); if ((this.payType == '2' || this.payType == '3') && this.step == 3) { this.step = 1; } else { this.step--; } if (this.step == "1") { this.overview.innerHTML = ""; var oText = '';
oText += 'If you are a Teacher e-Club member and not logged in, login now to receive your discount.
';
oText += 'Non members, register now.
';
oText += 'Inspection copies can be made by schools only.';
oText += '
';
oText += 'Please enter your payment details.
';
if ((typeof checkTC != "undefined") && (checkTC == true)) {
oText += 'Your total purchase is $' + oCart.getEClubTotal() + '
';
} else {
oText += 'Your total purchase is $' + oCart.getTotal() + '
';
}
oText += '
Your delivery details:
';
oText += document.forms['SubmitOrder'].Firstname.value + " " + document.forms['SubmitOrder'].Lastname.value + "
";
if (document.forms['SubmitOrder'].Organisation.value != "") {
oText += document.forms['SubmitOrder'].Organisation.value + "
";
}
oText += document.forms['SubmitOrder'].PostalAddress.value + "
";
oText += document.forms['SubmitOrder'].PostalCity.value + " " + document.forms['SubmitOrder'].PostalState.value + " " + document.forms['SubmitOrder'].PostalCode.value;
oText += "
Your payment information:
';
if (this.payType == "2" || this.payType == "3") {
var nCard = "xxxx xxxx xxxx " + document.forms['SubmitOrder'].CardNumber.value.substring(12);
oText += "Your ";
if (this.payType == "3") oText += " school ";
oText += document.forms['SubmitOrder'].CardType.value + " fcredit card ending in ";
oText += nCard + " will be charged.
";
}
if (this.payType == "3" || this.payType == "4") {
oText += "Customer Order Number: " + document.forms['SubmitOrder'].Inv_Order_Number.value + ".
";
oText += "Account Code: " + document.forms['SubmitOrder'].Inv_Order_AccountCode.value + ".
";
oText += "On verification by our Customer Service department the transaction will be processed.
";
}
return oText;
};
}
CartForm._initialized = true;
}
function getAddressType() {
var fAddressType = '';
var fAddressTypeRadio = document.forms['SubmitOrder'].AddressType;
for (var i = 0; i < fAddressTypeRadio.length; i++) {
if (fAddressTypeRadio[i].checked) fAddressType = fAddressTypeRadio[i].value;
}
return fAddressType;
}