How to make accordion nav collapse

Hey everyone. If you go here: http://store.inspirationsdancewear.c…inekey=4888254 you will see when you click on one of the side nav links, it drops down to display the sub-categories. If you open another link in the side nav it will also display the sub-categories, BUT the first sub-category box does NOT slide back up (which I want it to do). So, if you click on the “shoes” link the subcategories appear, and then if you click on say “bodywear” the “shoes” sub-categories slide back up and the “bodywear” sub categories slide out. Like it does here: I just don’t know what to include in the javascript to make it do that.

<div id="leftwrapper">
<h2 style="margin-top:-25px; padding-bottom:15px; color:#900; margin-left:15px; font-size:1.2em">Shop Online</h2>	


function print_childs($categ){
	$childs = $categ->categ_childs;
	if(!$childs || (count($childs) == 0)){
		echo "</a>";
		echo "&raquo;</a><ul>\
	foreach($childs as $category){
<li><a class="childcats" href="<?= $category->Link; ?>"><?= $category->Name; ?><?php print_childs($category); ?></a></li>
	echo "</ul><br/>\


		<div id="left">
<?php foreach($this->menu_categories as $category):  ?>	
<h2 class="headings"> <?= $category->Name; ?></h2>

<a class="childcats" href="<?= $category->Link; ?>">  See all <?= $category->Name; ?> <?php print_childs($category); ?></a>

<?php endforeach; ?>
<?php if(_xls_get_conf('ENABLE_FAMILIES', 1)): ?>								
<?php $families = Family::LoadAll();?>
<?php foreach($families as $family): ?>
<a href="index.php?family=<?= $family->Family ?>"><?= $family->Family ?></a>
<?php endforeach; ?>
								<?php endif; ?>
//----------------------------NAVIGATION DROPDOWN------------------------------------//
sfHover = function() {
		var sfEls = document.getElementById("left").getElementsByTagName("h2");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\\\b"), "");
	if (window.attachEvent) window.attachEvent("onload", sfHover);
function initMenu() {
		  $('#left div').hide();
		  $('#left h2').click(
		    function() {
		$(document).ready(function() {initMenu();});