function toggleCheck(field, value) {
    // variables
    var checkBoxes = document.getElementById(field).getElementsByTagName("input");

    // loop through checkboxes
    for (var i = 0; i < checkBoxes.length; i++) {
        if (checkBoxes[i].type == "checkbox" && checkBoxes[i].name != "checkAll") {
            if (value == "yes") {
                // check all
                checkBoxes[i].checked = true;
                document.getElementById("checkAll").value = "no";
            } else {
                // uncheck all
                checkBoxes[i].checked = false;
                document.getElementById("checkAll").value = "yes";
            }
        }
    }
}

// open a new window of given width and height
function openWindow(url, width, height) {
    window.open(url, 'popup', 'width='+width+',height='+height+'');
}

function enableQty(id) {
    // seperate at _
    var location = id.split('_');

    // disable all quantity inputs
    var inputs = document.getElementById("dataControlTable").getElementsByTagName("input");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type == "text") {
            inputs[i].disabled = true;
        }
    }

    // enable quantity
    document.getElementById("Quantity_" + location[1]).disabled = false;
}