function doConfirmActionDeleteItem(pMsg, pIndex, pSubIndex) {
  loadPageConfirm(pMsg, '&page=details_file&action=deleteitem&index=' + pIndex + '&subindex=' + pSubIndex);
}

function doConfirmActionDeleteJournal(pMsg, pIndex, pSubIndex) {
  loadPageConfirm(pMsg, '&page=details_file&action=deletejournal&index=' + pIndex + '&subindex=' + pSubIndex + '&tab=1');
}

function doConfirmActionDeleteShortcut(pMsg, pIndex) {
  loadPageConfirm(pMsg, '&page=shortcuts&action=delete&index=' + pIndex);
}

function doConfirmActionDeleteType(pMsg) {
  if (formByName('index').elements['index'].selectedIndex > 0 && confirm(pMsg))
    submitAndAction('index', 'delete');
}

function doConfirmActionFiles(pAction, pMsg, pFolder, pIndex) {
  loadPageConfirm(pMsg, '&page=files&action=' + pAction + '&folder=' + pFolder + '&index=' + pIndex);
}

function doConfirmActionFolders(pAction, pMsg, pIndex) {
  loadPageConfirm(pMsg, '&page=folders&action=' + pAction + '&index=' + pIndex);
}

function doIndexConfirmActionFiles(pAction, pMsg, pFolder) {
  doConfirmActionFiles(pAction, pMsg, pFolder, getOptSelValue(formByName('index').elements['index']));
}

function doIndexConfirmActionFolders(pAction, pMsg) {
  doConfirmActionFolders(pAction, pMsg, getOptSelValue(formByName('index').elements['index']));
}

function doPopupActionMove(pIndex, pFolder) {
  goOpener('index.php?umi=col_files&page=files&action=move&folder=' + pFolder + '&index=' + pIndex);
  window.close();
}

function doPopupActionPublish(pMsg, pIndex) {
  if (confirm(pMsg)) {
    goOpener('index.php?umi=col_files&page=folders&action=publish&index=' + pIndex + '&owner=' + encodeURIComponent(getSelectSelValue(formByIndex(0).elements['selowner'])));
    window.close();
  }
}

function doPromptActionRenameItem(pMsg, pIndex, pSubIndex, pFileName) {
  var S = prompt(pMsg, pFileName);
  if (S != null && S != '')
    loadPage('&page=details_file&action=renameitem&index=' + pIndex + '&newfilename=' + encodeURIComponent(S) + '&subindex=' + pSubIndex);
}

function dragEndMoveFile(pIndex, pOwner) {
  if (_DragParam != '') {
    var List = _DragParam.split("\n");
    if (pOwner == '_private' || List[1] == '_public' || pOwner == List[1])
      loadPage('&page=files&action=move&folder=' + List[0] + '&index=' + pIndex);
  }
}

function dragOutMoveFile(pObj) {
  pObj.style.cursor = 'default';
}

function dragOverMoveFile(pObj) {
  if (_DragAction != '')
    pObj.style.cursor = 'url(bin/col/files/img/dragmove.ico),move';
}

function dragStartMoveFile(pIndex, pOwner) {
  _DragAction = "dragEndMoveFile('" + pIndex + "', '" + pOwner +  "');";
  getElemBody().style.cursor = 'url(bin/col/files/img/dragfile.ico),move';
}

function dragStopMoveFile(pIndex, pOwner) {
  _DragParam = pIndex + "\n" + pOwner;
}

function getDynParent(pKeyPress) {
  var Form = formByName('details').elements;
  var S = Form['dyn_parent'].value;
  if (pKeyPress) {
    Form['parent'].value = '';
    displayElemById('ok', S == '' ? 'inline' : 'none');
  }
  doHttpRequest('plain.php?umi=col_files&page=parent.dyn', 'showDynParent', '', 'index=' + Form['index'].value + '&name=' + encodeURIComponent(S));
}

function getDynPreview(pIndex) {
  if (elementById('index_preview').style.display != 'none')
    doHttpRequest('plain.php?umi=col_files&page=preview.dyn&index=' + pIndex, 'setHTML', 'index_preview', '');
}

function goAssignedUser() {
  var S = getSelectSelValue(formByName('details').elements['assigneduser']);
  if (S != '')
    go('index.php?umi=admin_users&page=details&id=' + S);
}

function goParentFolder() {
  var S = formByName('details').elements['parent'].value;
  if (S != '')
    loadPage('&page=details_folder&index=' + S);
}

function hideDynParent() {
  window.setTimeout("displayElemById('dyn_parent', 'none');", 300);
}

function popupHistoryFile(pIndex) {
  popupWindow('plain.php?page=history.pop&entity=col_files_files&index=' + pIndex, 240, 500);
}

function popupHistoryFolder(pIndex) {
  popupWindow('plain.php?page=history.pop&entity=col_files_folders&index=' + pIndex, 240, 500);
}

function popupMove(pIndex) {
  popupWindow('plain.php?umi=col_files&page=move.pop&index=' + pIndex, 280, 220);
}

function popupPublish(pIndex) {
  popupWindow('plain.php?umi=col_files&page=publish.pop&index=' + pIndex, 100, 220);
}

function setDynParent(pIndex, pName) {
  var Form = formByName('details').elements;
  Form['parent'].value = pIndex;
  Form['dyn_parent'].value = pName;
  displayElemById('ok', 'inline');
}

function showDynParent(pValue, pParam) {
  setHTML(pValue, 'dyn_parent');
  fadeElemById('dyn_parent', pValue == '' ? 'none' : 'block');
}

function viewInfoBoxUser(pId) {
  if (pId != '')
    viewInfoBox('user' + pId, 'plain.php?umi=admin_users&page=user.info&id=' + pId);
}

function viewInfoBoxUser2() {
  viewInfoBoxUser(getSelectSelValue(formByName('details').elements['assigneduser']));
}