
/**
*	This function expands or collapses the given submenu
*
*	\param	item_id	The DOM id of the subsection to be toggled
*/	
function toggleMenu(item_id) 
{
    closeAll();
    // Get the handle to the item
    var section = document.getElementById(item_id);
    // Get the handle to the parent of the item
    var parent_section = document.getElementById('parent_' + item_id);
    // Make sure that this section should be toggled
    if (parent_section.className != 'jmenu_section_image_nosub') 
    {
	// Toggle the item
	if (section.style.display != 'none') 
	{
	    // Hide the section
	    section.style.display = 'none';
	    // Show the plus image
	    parent_section.className = 'jmenu_section_image_contracted';
	    
	}	
	else 
	{
	    // Show the section
    	    section.style.display = 'block';
	    // Show the minus image
	    parent_section.className = 'jmenu_section_image_expanded';
	}
    }
}

function closeAll()
{
    var menuitems = document.getElementById('jmenu_on').getElementsByTagName('div');
    for (var i=0; i<menuitems.length; i++) 
    {
	var menuitem = menuitems[i];
	if (menuitem.className == 'submenuitems' && menuitem.style.display != 'none') menuitem.style.display = 'none';
	if (menuitem.className == 'jmenu_section_image_expanded') menuitem.className = 'jmenu_section_image_contracted';
    }
}

