function ToggleAll(checked, idPrefix)
{
    var inputs = document.getElementsByTagName('input');
    
    var toToggle = new Array();
    
    for (var i = 0; i < inputs.length; i++)
    {
        // If this input has an ID, is a checkbox and has a matching prefix, add it to the array of items to toggle
        if (inputs[i].id != 'undefined' &&
            inputs[i].getAttribute('type') == 'checkbox' &&
            inputs[i].id.substring(0,idPrefix.length) == idPrefix)
        {
            toToggle[toToggle.length] = inputs[i];
        }
    }
    
    // Toggle all the items
    for (var j = 0; j < toToggle.length; j++)
        toToggle[j].checked = checked;
}
