var validCoupons= new Array();
validCoupons["HBC10"] = 0.1;
validCoupons["VSLIM10"] = 0.1;
validCoupons["SAVE10NOW"] = 0.1;
validCoupons["CCONE"] = 0.1;
validCoupons["save10now"] = 0.1;
validCoupons["ccone"] = 0.1;
function toEuro()
{
document.getElementById('currency').value = 'euro';
var qty = document.getElementById('quantity').value;
document.getElementById('price1').innerHTML = '€35.65';
document.getElementById('pill1price1').innerHTML = '€0.59';
document.getElementById('save1').innerHTML = '€0.00';
document.getElementById('price2').innerHTML = '€66.72';
document.getElementById('pill1price2').innerHTML = '€0.56';
document.getElementById('save2').innerHTML = '€4.57';
document.getElementById('price3').innerHTML = '€97.80';
document.getElementById('pill1price3').innerHTML = '€0.54';
document.getElementById('save3').innerHTML = '€9.14';
document.getElementById('price6').innerHTML = '€172.75';
document.getElementById('pill1price6').innerHTML = '€0.36';
document.getElementById('save6').innerHTML = '€112.42';
document.getElementById('price9').innerHTML = '€238.56';
document.getElementById('pill1price9').innerHTML = '€0.33';
document.getElementById('save9').innerHTML = '€189.20';
document.getElementById('shipd2').innerHTML = '€22.80';
if(qty == 6 || qty == 9) {
document.getElementById('shipd1').innerHTML='€0.00';
} else {
document.getElementById('shipd1').innerHTML = '€13.66';
}
return true;
}
function toDollar()
{
document.getElementById('currency').value = 'dollar';
var qty = document.getElementById('quantity').value;
document.getElementById('price1').innerHTML = '$39.00';
document.getElementById('pill1price1').innerHTML = '$0.65';
document.getElementById('save1').innerHTML = '$0';
document.getElementById('price2').innerHTML = '$73.00';
document.getElementById('pill1price2').innerHTML = '$0.61';
document.getElementById('save2').innerHTML = '$5.00';
document.getElementById('price3').innerHTML = '$107.00';
document.getElementById('pill1price3').innerHTML = '$0.59';
document.getElementById('save3').innerHTML = '$10.00';
document.getElementById('price6').innerHTML = '$189.00';
document.getElementById('pill1price6').innerHTML = '$0.39';
document.getElementById('save6').innerHTML = '$123.00';
document.getElementById('price9').innerHTML = '$261.00';
document.getElementById('pill1price9').innerHTML = '$0.36';
document.getElementById('save9').innerHTML = '$207.00';
document.getElementById('shipd2').innerHTML = '$24.95';
if(qty == 6 || qty == 9) {
document.getElementById('shipd1').innerHTML='$0.00';
} else {
document.getElementById('shipd1').innerHTML = '$14.95';
}
return true;
}
function setQuantity(qty)
{
document.getElementById('quantity').value=qty;
var currency = document.getElementById('currency').value;
if(qty == 6 || qty == 9) {
if(currency == 'dollar')
document.getElementById('shipd1').innerHTML='$0.00';
else
document.getElementById('shipd1').innerHTML='€0.00';
} else {
if(currency == 'dollar')
document.getElementById('shipd1').innerHTML='$14.95';
else
document.getElementById('shipd1').innerHTML= '€13.66';
}
}
function applyCoupon()
{
var coupon = document.getElementById('coupon_code').value;
var coupon_applied = false;
for (var i in validCoupons) {
if(i == coupon) {
var couponVal = validCoupons[i]*100;
document.getElementById('couponspan').innerHTML = 'You have availed '+couponVal+'% discount!';
document.getElementById('coupon').value = (1-validCoupons[i]);
document.getElementById('coupon_code_hidden').value = i;
coupon_applied = true;
}
}
if (!coupon_applied)
alert('Invalid coupon!');
}