All this is is an expand and collapse of whatever you want it to expand/collapse - it is made for divisions with the 'block' declaration, but could also be used for inline elements if you simply changed it to 'inline'
var div = document.getElementById(divid);
div.style.display = div.style.display == 'block' ? 'none' : 'block';}
Basically it is just a condensed if/then statement. Keep in mind it will only work on the very first click if you already have 'display' set to 'block' or 'none' at first, otherwise it will take 2 clicks. It is about as simple as it gets.