// Example: obj = findObj("image1");
function findObj(theObj, theDoc) {
  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

var m = new Array();
var h = null;

function sm(i, l) {
  // cancel hiding the current menu, if scheduled
  ct(l);
  // show requested menu
  o = findObj("submenu-"+i);
  if(o) {
	  o.className = 'show';
	  // add menu to stack
	  m.push(i);
  }
}

// hide all menus at level and higher
function hm(l) {
  while(m.length > l) {
	i = m.pop();
	m[m.length-1] = null;
    o = findObj("submenu-"+i);
    if(o) o.className = 'hide';
  }
}

// schedule menu timeout
function st() {
  h = setTimeout("hm(0)", 700);
}

// cancel scheduled hiding of menu
function ct(l) {
  hm(l);
  clearTimeout(h);
}
