code: function attachMenu(item) {
          var menuType = item.find('a').hasClass(FOLDER_TYPE) ? "folderMenu" : "itemMenu";
          item.contextMenu({
                  menu:menuType
              },
              function (action, el, pos) {
                  switch (action) {
                      case ADD_SUBFOLDER_MENU_COMMAND:
                          var parentFolderId = el.find('a').attr('id');
                          addFolder(parentFolderId);
                          break;
                      case DOWNLOAD_MENU_COMMAND:
                          download(el.find('a').attr('id'));
                          break;
                      case RENAME_MENU_COMMAND:
                          rename(el.find('a').attr('id'), true);
                          break;
                      case DELETE_MENU_COMMAND:
                          var link = el.find('a');
                          remove(link.attr('id'), link.hasClass(FOLDER_TYPE) ? FOLDER_TYPE : "");
                          break;
                      default:
                          alert("Todo: apply action '" + action + "' to node " + el);
                  }
              });
  
      }
docs: attach menu as per type