// function get elements by class name ... simiar to getElementsByTagName
// leave container arg out, and will default to document. 
function getelementsbyclassname(className,container)  
{  
  if (!container) {
  	container = document;
  }
  if (container.all) {
  	var all = container.all;
  } else {
  	var all = container.getElementsByTagName('*');  	
  }
  var arr = [] ; 
  for(var k=0;k<all.length;k++) {
    if(all[k].className == className) {
      arr[arr.length] = all[k]; 
     }
  }
  return arr;
}

function switchOver(num) {
	document['image'+num].src = eval("image" + num + "over.src");
}

function switchOff(num)	{
	if (num != menuHoldHiglighted) {
		document['image'+num].src = eval("image" + num + "off.src");
	}
}


// finds the menuItem preceding the current menuItem and returns its id
function menu_findPreviousMenuItem(obj) {
	if (obj) {
		objId = obj.id;
		nId = parseInt(objId.substr(5)) - 1; // extract id number
		if (nId >= 2092) {
			return document.getElementById('item-' + nId);
		}
	}
	return false;
}

// decorates the menuItem (the previous item in this case)
function decorateMenuItem(obj) {
	
	var menuItems = getelementsbyclassname('preMenupath', document.getElementById("menu-R"));
	for (i = 0; i < menuItems.length; i++) {
		menuItems[i].className = '';
	}
	var menuItems = getelementsbyclassname('menupath', document.getElementById("menu-R"));
	for (i = 0; i < menuItems.length; i++) {
		menuItems[i].className = '';
	}
	menu_findPreviousMenuItem(obj).className = 'preMenupath'; // decorate previous menu item
	
	obj.className = 'menupath';
}

function menu_decoratePreviousMenuItem() {
	var menuItems = getelementsbyclassname('menupath', document.getElementById("menu-R"));
	menu_findPreviousMenuItem(menuItems[0]).className = 'preMenupath';
}