/*  The expandable menu is loosely based on the work of Dave Lindquist http://www.gazingus.org
 * 
 *  Enhancements, increased functionality, and commenting created by Michael L. Richards (mlrichards@rads-inc.com)
 */

if (!document.getElementById)
    document.getElementById = function() { return null; }


/*  
The initializeMenu function takes up to five parameters.  All our required.
  Param 1) Name of menuId from the calling menu document
  Param 2) Name of actuatorId from the calling menu document
  Param 3) This is the url for a page that will display in the top iFRAME.  This value can be null if no page is needed.
  Param 4) This is the url for a page that will display in the bottom iFRAME.  This value can be null if no page is needed.
  Param 5) In order to keep a menu link that has no submenus, this parameter can be set to true.
  
  Use one of the html menu files in the menus directory to see how you actually call this function and 
  for examples of syntax.


*/

function initializeMenu(menuId, actuatorId, topHrefId, botHrefId,noSubMenus) {
    var menu = document.getElementById(menuId);
    var actuator = document.getElementById(actuatorId);

    if (menu == null || actuator == null) return;

    	if (noSubMenus != "true") {

     actuator.parentNode.style.backgroundImage = "url(../images/plus.gif)";
     menu.parentNode.style.backgroundImage = "url(../images/plus.gif)";
	}


     actuator.onclick = function() {
	
			var display = menu.style.display;        
       	if (noSubMenus != "true") {
	
			this.parentNode.style.backgroundImage =
            		(display == "block") ? "url(../images/plus.gif)" : "url(../images/minus.gif)";
			}
        menu.style.display = (display == "block") ? "none" : "block";
	
		
	 if (topHrefId != null) {
	 	window.parent.frames["topIFrame"].location.href=topHrefId;
	 	if (botHrefId == null) {
			window.parent.frames["bottomIFrame"].document.write("");
	 		window.parent.frames["bottomIFrame"].document.close;
		} else {
		    window.parent.frames["bottomIFrame"].location.href=botHrefId;
		};
	 }
	 
        return false;
    }
}

