var isStandardDOM, isIEDOM, isNN4DOM, isOpera;
if (document.getElementById) isStandardDOM = 1;
if (document.all) isIEDOM = 1;
else if (document.layers) isNN4DOM = 1;

var browserName = new String(navigator.appName);
isOpera = (browserName.search(/opera/i) >= 0) ? 1 : 0;


function ToggleSubmenu(e, submenu_id) {
  if (isStandardDOM) {
    var subitems = document.getElementById(submenu_id);
    if (subitems) {
      if (subitems.style.display == "none")
        subitems.style.display = "block";
      else
        subitems.style.display = "none";
      e.cancelBubble = true;
      //alert(e.cancelBubble);
    }
  }
}


function ensureIsVivsible(expanded_id){
  if (expanded_id) {
    if (isStandardDOM) {
      var subitems = document.getElementById(expanded_id);
      if (subitems) {
        //alert(subitems.style.display);
        //var s = '';
        subitems.style.display = "block";
        var parentItem = subitems.parentNode;
        while (parentItem) {
          //s += "\n" + parentItem;
          if (parentItem.style) {
            if (parentItem.style.display == "none") parentItem.style.display = "block";
            //s += " = " + parentItem.style.display;
          }
          parentItem = parentItem.parentNode;
        }
        //alert(s);
      }
    }
  }
}
