function toggleScalePriceDisplay(groupId, firstRow, numberOfRows) { var text = document.getElementById(groupId); if (!text.firstChild) { text.appendChild(document.createTextNode("-")); } for (var i = firstRow; i < firstRow + numberOfRows; i++) { var rowId = groupId + "-" + i; row = document.getElementById(rowId); if (row.style.display == "none") { row.style.display = ""; text.firstChild.nodeValue = 'Collapse Price List'; } else { row.style.display = "none"; text.firstChild.nodeValue = 'Expand Price List'; } } }