﻿function cancelCart(oid, msg, url)
{
    if (confirm(msg))
    {
        document.location.href = url + '?oid=' + oid;
    }
}

function changeQty(control, action)
{
    var txtControl = document.getElementById(control);
    
    if (action == 0)
    {
        if (parseInt(txtControl.value) > 0)
        {
            txtControl.value = parseInt(txtControl.value) - 1;
        }
    }
    else
    {
        txtControl.value = parseInt(txtControl.value) + 1;
    }
}

function chkNumeric(text)
{
    var checkOK = "0123456789"
    var allValid = true;

    for (i = 0;  i < text.length;  i++)
    {
        ch = text.charAt(i);
        if (checkOK.indexOf(ch) < 0)
        {
            allValid = false;
        }
    }
    
    return allValid;
}

function res(control)
{
    control.value = control.value.replace(/([^0-9])/g,"");
}