function ToggleVisibility(image, element){ // Find the image. var image = document.getElementById(image) // Find the element to hide/unhide. var element = document.getElementById(element) // Check the element's current state. if (element.style.display == "none"){ // If hidden, unhide it. element.style.display = "block" image.src = "images/open.png" } else { // If not hidden, hide it. element.style.display = "none" image.src = "images/closed.png"; } }