function doActionSetFlag(pFlag, pIndex, pSort) {
  loadPage('&page=invitations&action=setflag&flag=' + pFlag + '&index=' + pIndex + '&sort=' + pSort);
}

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

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

function doConfirmActionResetSettings(pMsg) {
  loadPageConfirm(pMsg, '&page=settings&action=reset');
}

function doPopupActionInvite(pMsg, pIndex) {
  var List = getAllOptSelValues(formByIndex(1).elements['users']);
  if (List.length > 0 && confirm(pMsg)) {
    goOpener('index.php?umi=org_calendar&page=details&action=invite&index=' + pIndex + '&selusers=' + encodeURIComponent(List.join('|')));
    window.close();
  }
}

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

function loadSearch(pMsg, pStamp) {
  if (pStamp == '-1')
    window.alert(pMsg);
  else
    goOpener('index.php?umi=org_calendar&stamp=' + pStamp + '&tab=0');
}

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

function popupInvite(pIndex) {
  popupWindow('plain.php?umi=org_calendar&page=invite.pop&index=' + pIndex, 300, 420);
}

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

function popupSearch() {
  popupWindow('plain.php?umi=org_calendar&page=search.pop', 180, 300);
}

function popupSend(pIndex) {
  popupWindow('plain.php?page=send.pop&destumi=org_calendar&index=' + pIndex, 300, 420);
}

function selCorrelative() {
  with (formByName('details')) {
    elements['d2'].value = elements['d1'].value;
    elements['m2'].value = elements['m1'].value;
    elements['y2'].value = elements['y1'].value;
  }
}

function updateDisplay(pObj) {
  with (imageByName('displayico'))
    src = src.replace(/display[0-9]*\.png/, 'display' + pObj.selectedIndex + '.png');
}

function updateLabel(pObj) {
  var Elem = elementById('labelclr');
  if (Elem) {
    var Label = new Array('#FAFAFA', '#FFCCCC', '#CCCCFF', '#CCFFCC', '#FFFFCC', '#FFCCFF', '#CCFFFF', '#F5DEB3');
    Elem.style.backgroundColor = Label[pObj.selectedIndex];
  }
}

function viewInfoBoxEvent(pIndex) {
  if (pIndex != '-1')
    viewInfoBox('event' + pIndex, 'plain.php?umi=org_calendar&page=event.info&index=' + pIndex);
}