

    function toggleGroup(img, numberOfRows)
    {
        //  get a reference to the parent row and table
        var tr = img.parentNode.parentNode.parentNode;
        var table = document.getElementById('results-table');
        var src = img.src;
        
        //  determine how many rows we need to hide/show
        var startIndex = tr.rowIndex + 1;
        var stopIndex = startIndex + parseInt(numberOfRows);
        
        //  switch image and visiblity
        if(src.endsWith('minus.gif'))
        {
            for(var i = startIndex; i < stopIndex; i++)
            {
                table.rows[i].style.display = 'none';
            }
        
            src = src.replace('minus.gif', 'plus.gif');
        }
        else
        {
            for(var i = startIndex; i < stopIndex; i++)
            {
                table.rows[i].style.display = '';
            }

            src = src.replace('plus.gif', 'minus.gif');
        }
        
        //  update image src with the new value
        img.src = src;
    }



