//Activate a menu item, inactivate default menu item.
function actMenuItem(imgName) {
	if (defImg)
	{
	  act(imgName);
	  show(true, imgName.charAt(0).toUpperCase() + imgName.substring(1,imgName.length));
	  inact(defImg);
	  show(false, defDiv);
	}
}

//Inctivate a menu item, activate default menu item.
function inactMenuItem(imgName) {
	if (defImg)
	{
	  inact(imgName);
	  show(false, imgName.charAt(0).toUpperCase() + imgName.substring(1,imgName.length));
	  act(defImg);
	  show(true, defDiv);
	}
}

//Activate a submenu item under the current section.
function actSubMenuItem(imgName)
{
	if (defSubImg)
	{
		if (document.all || document.getElementById) //IE or Netscape 6
			inact(defSubImg)
		else if (document.layers) //Netscape 4.X
		{
			var imgObj = eval('document.submenu' + defDiv + '.document.' + defSubImg);
			imgObj.src = eval(defSubImg + 'Off.src');
		}

		if (document.all || document.getElementById) //IE or Netscape 6
			act(imgName)
		else if (document.layers) //Netscape 4.X
		{
			var imgObj = eval('document.submenu' + defDiv + '.document.' + imgName);
			imgObj.src = eval(imgName + 'On.src');
		}
	}
}

//Inactivate a submenu item under the current section.
function inactSubMenuItem(imgName)
{
	if (defSubImg)
	{
		if (document.all || document.getElementById) //IE or Netscape 6
			act(defSubImg)
		else if (document.layers) //Netscape 4.X
		{
			var imgObj = eval('document.submenu' + defDiv + '.document.' + defSubImg);
			imgObj.src = eval(defSubImg + 'On.src');
		}

		if (document.all || document.getElementById) //IE or Netscape 6
			inact(imgName)
		else if (document.layers) //Netscape 4.X
		{
			var imgObj = eval('document.submenu' + defDiv + '.document.' + imgName);
			imgObj.src = eval(imgName + 'Off.src');
		}
	}
}


//Activate a submenu item, inactivate default submenu item.
function actOtherSubMenuItem(section, imgName) {
	if (defSubImg)
	{
	  actMenuItem(section.toLowerCase());
	  inactOther(defDiv, defSubImg);
	  actOther(section, imgName);
	}
}

//Inactivate a submenu item, activate default submenu item.
function inactOtherSubMenuItem(section, imgName) {
	if (defSubImg)
	{
	  inactMenuItem(section.toLowerCase());
	  inactOther(section, imgName);
//	  actMenuItem(defImg);
	  actOther(defDiv, defSubImg);
	}
}

//Highlight top menu item.
function act(imgName) {
  if (document.images) 
    document.images[imgName].src = eval(imgName + "On.src");
}

//Turn off top menu item.
function inact(imgName) {
  if (document.images) 
    document.images[imgName].src = eval(imgName + "Off.src");
}

//Highlight a subheading under another section
function actOther(section, imgName) {
  if (document.all || document.getElementById) //IE or Netscape 6
     act(imgName)
  else if (document.layers) //Netscape 4.X
  {
     var imgObj = eval('document.submenu' + section + '.document.' + imgName);
	 imgObj.src = eval(imgName + 'On.src');
  }

  act(section.toLowerCase());
}

//Turn off a subheading under another section
function inactOther(section, imgName) {
  if (document.all || document.getElementById) //IE or Netscape 6
     inact(imgName)
  else if (document.layers) //Netscape 4.X
  {
     var imgObj = eval('document.submenu' + section + '.document.' + imgName);
	 imgObj.src = eval(imgName + 'Off.src');
  }
 
  inact(section.toLowerCase());
}

//Get a DIV object for setting visibility
function getDivObj(section) {
    var divObj;
	if (document.all) { //IE
		if (eval('document.all.submenu' + section)) {
			divObj = eval('document.all.submenu' + section + '.style');
		}
    }
    else if (document.layers) { //Netscape 4.X
        divObj = eval('document.submenu' + section);   // assign Netscape alias
    }       
    else if (document.getElementById) { //Netscape 6
        if (document.getElementById('submenu' + section)) {
			divObj = document.getElementById('submenu' + section).style;
		}
    }

	return divObj;
}

//Show or hide a DIV
function show(on, section) {
	var divObj = getDivObj(section);
	if (divObj)
		divObj.visibility = on ? 'visible' : 'hidden';    
}
