your js code is working actually, only that you have to click twice before it will start collapsing/expanding the content.
change it with this:
Code:
function toggleview(element1) {
element1 = document.getElementById(element1);
return element1.style.display = (element1.style.display != 'block') ? 'block' : 'none';
}