Client Side Collapse/Expand

Want to do it directly with javascript? Here’s an example, including changing a collapse/expand button, that I snagged from somewhere…


     if( expandedAccountSummaryLayer )
     {
       expandedAccountSummaryLayer = false;
	if (agt.indexOf('msie') != -1) {
 	       theButton.childNodes[0].src = imgpath + "/expandButton.gif";
        } else {
 	       theButton.childNodes[1].src = imgpath + "/expandButton.gif";
        }
       if ( theLayer != null ) {
         theLayer.style.height = "138";
         theLayer.style.overflow = "auto";
       }
     }
     else
     {
       expandedAccountSummaryLayer = true;
	if (agt.indexOf('msie') != -1) {
 	      	theButton.childNodes[0].src = imgpath + "/collapseButton.gif";
        } else {
 	      	theButton.childNodes[1].src = imgpath + "/collapseButton.gif";
        }
       if ( theLayer != null ) {
         theLayer.style.height = "auto";
         theLayer.style.overflow = "auto";
       }
     }