function set_payment_vars() { var exch = 1.0194819408975; var loc; var tax; var currency; var shipping; var dfConvertedPrice; var tmConvertedPrice; var dfPrice = 2800; var tmPrice = 199; for (i = 0; i < document.locationForm.locations.length; i++) { if (document.locationForm.locations[i].checked == true) { loc = document.locationForm.locations[i].value; } } if (loc == "bc") { tax = .12; currency = "CAD"; shipping = "150"; dfConvertedPrice = dfPrice * exch; tmConvertedPrice = tmPrice * exch; // TODO: testing //indow.alert("BC, tax set to " + tax + " / currency set to " + currency + " / price set to " + price); } else if (loc == "can") { tax = 0.05; currency = "CAD"; shipping = "200"; dfConvertedPrice = dfPrice * exch; tmConvertedPrice = tmPrice * exch; // TODO: testing //window.alert("Canada, tax set to " + tax + " / currency set to " + currency + " / price set to " + price); } else if (loc == "us") { tax = 0; currency = "USD"; shipping = "250"; dfConvertedPrice = dfPrice; tmConvertedPrice = tmPrice; // TODO: testing //window.alert("US, tax set to " + tax + " / currency set to " + currency + " / price set to " + price); } var dfTax = dfConvertedPrice * tax; document.dfForm.amount.value = dfConvertedPrice.toFixed(2); document.dfForm.tax.value = dfTax.toFixed(2); document.dfForm.currency_code.value = currency; document.dfForm.shipping.value = shipping; document.dfForm.shipping2.value = shipping-10; var tmTax = tmConvertedPrice * tax; document.tmForm.amount.value = tmConvertedPrice.toFixed(2); document.tmForm.tax.value = tmTax.toFixed(2); document.tmForm.currency_code.value = currency; } function verify_location(frm) { var locSelected = false; for (i = 0; i < document.locationForm.locations.length; i++) { if (document.locationForm.locations[i].checked) { locSelected = true; } } if (!locSelected) { window.alert("Please select your location."); } return locSelected; }