function FloatMenu(floatOn) {
  this.floatOn = floatOn;
  this.addMenu = function(className) {
    var floatOn = this.floatOn;
	var index = 0;
    var menuBox = document.getElementById(floatOn+"_"+index);
	while(menuBox) {
          var menu = document.createElement("div");
          menu.id = floatOn+"_menu_"+index;
          menu.className = className;
	  //menuBox.style.position = "relative";
      menuBox.appendChild(menu);
	  menuBox.floatOn = floatOn;
	  menuBox.index = index;
	  menuBox.baseClassName = floatOn;
	  menuBox.className = floatOn;
      index++;
      menuBox = document.getElementById(floatOn+"_"+index);
    }
  }
  this.addMenuItem = function(itemID, innerHTML, className, action,canDo) {
        var index = 0;
	var floatOn = this.floatOn;
        if(typeof(canDo)=='undefined'){
            canDo = true;
        }
        while(document.getElementById(floatOn+"_menu_"+index)) {
          if(canDo == false && _GLOBAL_VAR['current_user'].admin == false && _bookmarks[index].u_name != _GLOBAL_VAR['current_user'].name){    
            index++;
            continue;
          }
	  var menuItem = document.createElement("span");
          menuItem.menuBox = this;
	  menuItem.index = index;
	  menuItem.className = className;
          menuItem.onmouseover = function(){this.className+=" menuItemOnAction";}
          menuItem.onmouseout = function(){this.className=this.className.replace("menuItemOnAction", "");}
          menuItem.innerHTML = innerHTML;
	  menuItem.onclick = action;
	  menuItem.id = floatOn+"_menu_item_"+index+"_"+itemID;
          var menu = document.getElementById(floatOn+"_menu_"+index);
	  menu.appendChild(menuItem);
      index++;
    }
  }
  
  this.switchMenu = function(on) {
    var index = 0;
	var floatOn = this.floatOn;
    if(on) {
	  while(document.getElementById(floatOn+"_"+index)) {
	    var menuBox = document.getElementById(floatOn+"_"+index);
		menuBox.onmouseover = this.onHover;
        menuBox.onmouseout = this.onOut;
        document.getElementById(floatOn+"_menu_"+index).style.visibility = "visible";
        index++;
      }
	}else {
	  while(document.getElementById(floatOn+"_"+index)) {
	    var menuBox = document.getElementById(floatOn+"_"+index);
		menuBox.onmouseover = null;
        menuBox.onmouseout = null;
        document.getElementById(floatOn+"_menu_"+index).style.visibility = "hidden";
        index++;
      }
	}
  }
  
  this.switchMenu2 = function(on, index) {
    var floatOn = this.floatOn;
    if(on) {
	  var menuBox = document.getElementById(floatOn+"_"+index);
      menuBox.onmouseover = this.onHover;
      menuBox.onmouseout = this.onOut;
      document.getElementById(floatOn+"_menu_"+index).style.visibility = "visible";
	}else {
	  var menuBox = document.getElementById(floatOn+"_"+index);
	  menuBox.onmouseover = null;
      menuBox.onmouseout = null;
      document.getElementById(floatOn+"_menu_"+index).style.visibility = "hidden";
	}
  }
  
  this.onHover = function () {
    var floatOn = this.floatOn;
    var index = this.index;
    if(document.getElementById(floatOn+"_menu_"+index)) {
      document.getElementById(floatOn+"_menu_"+index).className+=" menuItemHover";
    }
  }
  this.onOut = function () {
    var floatOn = this.floatOn;
    var index = this.index;
    if(document.getElementById(floatOn+"_menu_"+index)) {
      var klassName = document.getElementById(floatOn+"_menu_"+index).className;
      document.getElementById(floatOn+"_menu_"+index).className = klassName.replace("menuItemHover", "");
    } 
  }
}// JavaScript Document