function doConfirmAction(pTab, pAction, pMsg, pIndex) {
  loadPageConfirm(pMsg, '&action=' + pAction + '&index=' + pIndex + '&tab=' + pTab);
}

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

function doConfirmActionRemoveAssoc(pMsg, pIndex, pSubIndex) {
  loadPageConfirm(pMsg, '&page=details&action=removeassoc&index=' + pIndex + '&subindex=' + pSubIndex);
}

function doIndexConfirmAction(pAction, pMsg) {
  doConfirmAction('1', pAction, pMsg, getOptSelValue(formByName('index').elements['index']));
}

function doPopupActionAddAssoc(pEntity, pIndex, pSubIndex) {
  goOpener('index.php?umi=org_followup&page=details&action=addassoc&entity=' + pEntity + '&index=' + pIndex + '&subindex=' + pSubIndex);
  window.close();
}

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

function getDynPreview(pIndex) {
  if (elementById('index_preview').style.display != 'none')
    doHttpRequest('plain.php?umi=org_followup&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 popupAddAssoc(pIndex) {
  popupWindow('plain.php?umi=org_followup&page=addassoc.pop&index=' + pIndex, 300, 420);
}

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

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

function updatePriority(pObj) {
  with (imageByName('priorityico'))
    src = src.replace(/priority[0-9]*\.gif/, 'priority' + pObj.selectedIndex + '.gif');
}

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']));
}