var waeQty = 0;
var currentCurrency = "USD";


function ValidateForm() {
var qtyInput = document.getElementById('waeQty');
    
    if (qtyInput.value == "") 
    {
        alert('Please enter an order quantity.');
        return false;
    }

    if (qtyInput.value == '0')
    {
        alert('Please enter an order quantity.');
        return false;
    }
    
    var qty = parseInt(qtyInput.value);        
    
    if (isNaN(qty) || (qty % 25 > 0))
    {
        alert('The order quantity must be in multiples of 25.');
        return false;
    }    
    
    return true;
}

function UpdateTotal(id) {
    var qtyInput = document.getElementById(id + 'Qty');
    
    if (qtyInput.value == "")
        return;
    
    var qty = parseInt(qtyInput.value);
        
    if (qty == 0)
    {
        waeQty = qty;
        UpdateQty();
        return;
    }
    
    if (isNaN(qty) || (qty % 25 > 0))
    {
        alert('Must be in increments of 25')
        qtyInput.Value = '0';
        return;
    }    
        
    waeQty = qty;
    UpdateQty();
}

function changeCurrency() {
    var currency = document.getElementById('currency');
    var cur = currency.options[currency.selectedIndex].value;
    
    if(document.all){
    if (cur == "usd") {
        document.getElementById('c1').innerText = '199.99 USD';
        document.getElementById('c2').innerText = '499.99 USD';
        document.getElementById('c3').innerText = '799.99 USD';
    }
    else if (cur == "gbp") {
        document.getElementById('c1').innerText = '129.99 GBP';
        document.getElementById('c2').innerText = '299.99 GBP';
        document.getElementById('c3').innerText = '489.99 GBP';
    }
    else if (cur == "eur") {
        document.getElementById('c1').innerText = '139.99 EUR';
        document.getElementById('c2').innerText = '349.99 EUR';
        document.getElementById('c3').innerText = '559.99 EUR';
    }
    
    }else{
        if (cur == "usd") {
        document.getElementById('c1').textContent  = '199.99 USD';
        document.getElementById('c2').textContent  = '499.99 USD';
        document.getElementById('c3').textContent  = '799.99 USD';
    }
    else if (cur == "gbp") {
        document.getElementById('c1').textContent  = '129.99 GBP';
        document.getElementById('c2').textContent  = '299.99 GBP';
        document.getElementById('c3').textContent  = '489.99 GBP';
    }
    else if (cur == "eur") {
        document.getElementById('c1').textContent  = '139.99 EUR';
        document.getElementById('c2').textContent  = '349.99 EUR';
        document.getElementById('c3').textContent  = '559.99 EUR';
    }

    }
}
