  function nmAjaxMessage(oTemp)
  {
    if (oTemp && oTemp != null) {
        oResp = oTemp;
    }
    if (oResp["ajaxMessage"] && oResp["ajaxMessage"]["message"] && "" != oResp["ajaxMessage"]["message"])
    {
      var sTitle    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["title"])        ? oResp["ajaxMessage"]["title"]               : scMsgDefTitle,
          bModal    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["modal"])        ? ("Y" == oResp["ajaxMessage"]["modal"])      : false,
          iTimeout  = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["timeout"])      ? parseInt(oResp["ajaxMessage"]["timeout"])   : 0,
          bButton   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["button"])       ? ("Y" == oResp["ajaxMessage"]["button"])     : false,
          sButton   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["button_label"]) ? oResp["ajaxMessage"]["button_label"]        : "Ok",
          iTop      = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["top"])          ? parseInt(oResp["ajaxMessage"]["top"])       : 0,
          iLeft     = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["left"])         ? parseInt(oResp["ajaxMessage"]["left"])      : 0,
          iWidth    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["width"])        ? parseInt(oResp["ajaxMessage"]["width"])     : 0,
          iHeight   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["height"])       ? parseInt(oResp["ajaxMessage"]["height"])    : 0,
          bClose    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["show_close"])   ? ("Y" == oResp["ajaxMessage"]["show_close"]) : true,
          bBodyIcon = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["body_icon"])    ? ("Y" == oResp["ajaxMessage"]["body_icon"])  : true,
          sRedir    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["redir"])        ? oResp["ajaxMessage"]["redir"]               : "",
          sTarget   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["redir_target"]) ? oResp["ajaxMessage"]["redir_target"]        : "",
          sParam    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["redir_par"])    ? oResp["ajaxMessage"]["redir_par"]           : "",
          bToast    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["toast"])        ? ("Y" == oResp["ajaxMessage"]["toast"])      : false,
          sToastPos = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["toast_pos"])    ? oResp["ajaxMessage"]["toast_pos"]           : "",
          sType     = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["type"])         ? oResp["ajaxMessage"]["type"]                : "";
      _nmAjaxShowMessage({title: sTitle, message: oResp["ajaxMessage"]["message"], isModal: bModal, timeout: iTimeout, showButton: bButton, buttonLabel: sButton, topPos: iTop, leftPos: iLeft, width: iWidth, height: iHeight, redirUrl: sRedir, redirTarget: sTarget, redirParam: sParam, showClose: bClose, showBodyIcon: bBodyIcon, isToast: bToast, toastPos: sToastPos, type: sType});
    }
  }
  function _nmAjaxShowMessage_default(params) {
    var sTitle = params["title"], sMessage = params["message"], bModal = params["isModal"], iTimeout = params["timeout"], bButton = params["showButton"], sButton = params["buttonLabel"], iTop = params["topPos"], iLeft = params["leftPos"], iWidth = params["width"], iHeight = params["height"], sRedir = params["redirUrl"], sTarget = params["redirTarget"], sParam = params["redirParam"], bClose = params["showClose"], bBodyIcon = params["showBodyIcon"];
    if ("" == sMessage) {
      if (bModal) {
        scMsgDefClick = "close_modal";
      }
      else {
        scMsgDefClick = "close";
      }
      _nmAjaxMessageBtnClick();
      document.getElementById("id_message_display_title").innerHTML = scMsgDefTitle;
      document.getElementById("id_message_display_text").innerHTML = "";
      document.getElementById("id_message_display_buttone").value = scMsgDefButton;
      document.getElementById("id_message_display_buttond").style.display = "none";
    }
    else {
      document.getElementById("id_message_display_title").innerHTML = nmAjaxSpecCharParser(sTitle);
      document.getElementById("id_message_display_text").innerHTML = nmAjaxSpecCharParser(sMessage);
      document.getElementById("id_message_display_buttone").value = sButton;
      document.getElementById("id_message_display_buttond").style.display = bButton ? "" : "none";
      document.getElementById("id_message_display_buttond").style.display = bButton ? "" : "none";
      document.getElementById("id_message_display_title_line").style.display = (bClose || "" != sTitle) ? "" : "none";
      document.getElementById("id_message_display_close_icon").style.display = bClose ? "" : "none";
      if (document.getElementById("id_message_display_body_icon")) {
        document.getElementById("id_message_display_body_icon").style.display = bBodyIcon ? "" : "none";
      }
      $("#id_message_display_content").css('width', (0 < iWidth ? iWidth + 'px' : ''));
      $("#id_message_display_content").css('height', (0 < iHeight ? iHeight + 'px' : ''));
      if (bModal) {
        iWidth = iWidth || 250;
        iHeight = iHeight || 200;
        scMsgDefClose = "close_modal";
        tb_show('', '#TB_inline?height=' + (iHeight + 6) + '&width=' + (iWidth + 4) + '&inlineId=id_message_display_frame&modal=true', '');
        if (bButton) {
          if ("" != sRedir && "" != sTarget) {
            scMsgDefClick = "redir2_modal";
            document.form_ajax_redir_2.action = sRedir;
            document.form_ajax_redir_2.target = sTarget;
            document.form_ajax_redir_2.nmgp_parms.value = sParam;
            document.form_ajax_redir_2.script_case_init.value = scMsgDefScInit;
          }
          else if ("" != sRedir && "" == sTarget) {
            scMsgDefClick = "redir1";
            document.form_ajax_redir_1.action = sRedir;
            document.form_ajax_redir_1.nmgp_parms.value = sParam;
          }
          else {
            scMsgDefClick = "close_modal";
          }
        }
        else if (null != iTimeout && 0 < iTimeout) {
          scMsgDefClick = "close_modal";
          setTimeout("_nmAjaxMessageBtnClick()", iTimeout * 1000);
        }
      }
      else
      {
        scMsgDefClose = "close";
        $("#id_message_display_frame").css('top', (0 < iTop ? iTop + 'px' : ''));
        $("#id_message_display_frame").css('left', (0 < iLeft ? iLeft + 'px' : ''));
        document.getElementById("id_message_display_frame").style.display = "";
        if (0 == iTop && 0 == iLeft) {
          nmCenterElement(document.getElementById("id_message_display_frame"));
        }
        if (bButton) {
          if ("" != sRedir && "" != sTarget) {
            scMsgDefClick = "redir2";
            document.form_ajax_redir_2.action = sRedir;
            document.form_ajax_redir_2.target = sTarget;
            document.form_ajax_redir_2.nmgp_parms.value = sParam;
            document.form_ajax_redir_2.script_case_init.value = scMsgDefScInit;
          }
          else if ("" != sRedir && "" == sTarget) {
            scMsgDefClick = "redir1";
            document.form_ajax_redir_1.action = sRedir;
            document.form_ajax_redir_1.nmgp_parms.value = sParam;
          }
          else {
            scMsgDefClick = "close";
          }
        }
        else if (null != iTimeout && 0 < iTimeout) {
          scMsgDefClick = "close";
          setTimeout("_nmAjaxMessageBtnClick()", iTimeout * 1000);
        }
      }
    }
  }
  function _nmAjaxMessageBtnClick() {
    switch (scMsgDefClick) {
      case "close":
        document.getElementById("id_message_display_frame").style.display = "none";
        break;
      case "close_modal":
        tb_remove();
        break;
      case "redir1":
        document.form_ajax_redir_1.submit();
        break;
      case "redir2":
        document.form_ajax_redir_2.submit();
        document.getElementById("id_message_display_frame").style.display = "none";
        break;
      case "redir2_modal":
        document.form_ajax_redir_2.submit();
        tb_remove();
        break;
    }
  }
  function _nmAjaxMessageBtnClose() {
    switch (scMsgDefClose) {
      case "close":
        document.getElementById("id_message_display_frame").style.display = "none";
        break;
      case "close_modal":
        tb_remove();
        break;
    }
  }
function _nmAjaxShowMessage(params) {
	_nmAjaxShowMessage_toast(params);
} // _nmAjaxShowMessage
function _nmAjaxShowMessage_toast(params) {
    var sTitle = params["title"], sMessage = params["message"], bModal = params["isModal"], iTimeout = params["timeout"], bButton = params["showButton"], sButton = params["buttonLabel"], iTop = params["topPos"], iLeft = params["leftPos"], iWidth = params["width"], iHeight = params["height"], sRedir = params["redirUrl"], sTarget = params["redirTarget"], sParam = params["redirParam"], bClose = params["showClose"], bBodyIcon = params["showBodyIcon"];
	var sweetAlertParams = {};

	if ("" != params["type"]) {
		sweetAlertParams["type"] = params["type"];
	}

	if ("" != params["title"]) {
		sweetAlertParams["title"] = params["title"];
	}

	if (params["isToast"]) {
		sweetAlertParams["toast"] = true;
		sweetAlertParams["showConfirmButton"] = false;
		sweetAlertParams["showCancelButton"] = false;

		if ("" != params["toastPos"]) {
			sweetAlertParams["position"] = params["toastPos"];
		}

		if (null == sweetAlertParams["position"]) {
			sweetAlertParams["position"] = "top-end";
		}

		if (null == sweetAlertParams["timer"]) {
			sweetAlertParams["timer"] = 3000;
		}
	}
/* mantis 0019285
	scJs_alert_sweetalert(sMessage, function() {}, scJs_sweetalert_params(sweetAlertParams));
*/
	   if ("" != params["redirUrl"]) {
                document.form_ajax_redir_2.action = params["redirUrl"];
                document.form_ajax_redir_2.target = "_self";
                if ("" != params["redirTarget"]) {
                    document.form_ajax_redir_2.target = params["redirTarget"];
                }
/* mantis 0021352
                document.form_ajax_redir_2.nmgp_parms.value = params["redirParams"];
                document.form_ajax_redir_2.script_case_init.value = "<?php echo $this->Ini->sc_page ?>";
*/
                document.form_ajax_redir_2.nmgp_parms.value = sParam;
                document.form_ajax_redir_2.script_case_init.value = scMsgDefScInit;
/*-----*/
	       callbackOk = function() { document.form_ajax_redir_2.submit(); };
                scJs_alert_sweetalert(sMessage, callbackOk, scJs_sweetalert_params(sweetAlertParams));
	   }
	   else {
                scJs_alert_sweetalert(sMessage, function() {}, scJs_sweetalert_params(sweetAlertParams));
	   }

/*------*/
} // _nmAjaxShowMessage_toast
function scJs_alert_default(message) {
	alert(message);
} // scJs_alert_default

function scJs_confirm_default(message, callbackOk, callbackCancel) {
	if (confirm(message)) {
		callbackOk();
	}
	else {
		callbackCancel();
	}
} // scJs_confirm_default

function scJs_alert(message, params) {
	scJs_alert_sweetalert(message, function() {}, scJs_sweetalert_params(params));
} // scJs_alert

function scJs_confirm(message, callbackOk, callbackCancel) {
	scJs_confirm_sweetalert(message, callbackOk, callbackCancel);
} // scJs_confirm

function scJs_alert_sweetalert(message, callbackOk, params) {
	var sweetAlertConfig;

	if (null == params) {
		params = {};
	}

	params['html'] = message;

	Swal.fire(params).then(function (result) {
		if (result.value) {
			if (typeof callbackOk == "function") {
				callbackOk();
			}
		}
        else if (result.dismiss == Swal.DismissReason.timer || result.dismiss == Swal.DismissReason.close) {
            Swal.close();
            $(".swal2-container.swal2-shown").remove();
        }
		else if (result.dismiss == Swal.DismissReason.timer) {
			Swal.close();
		}
	});
} // scJs_alert_sweetalert

function scJs_sweetalert_params(params) {
	var parName, confirmText, confirmFA, confirmPos, cancelText, cancelFA, cancelPos, sweetAlertConfig;

	sweetAlertConfig = {
		customClass: {
			popup: 'scSweetAlertPopup',
			header: 'scSweetAlertHeader',
			content: 'scSweetAlertMessage',
			confirmButton: scSweetAlertConfirmButton,
			cancelButton: scSweetAlertCancelButton
		}
	};

	confirmText = scSweetAlertConfirmButtonText;
	confirmFA = scSweetAlertConfirmButtonFA;
	confirmPos = scSweetAlertConfirmButtonFAPos;
	cancelText = scSweetAlertCancelButtonText;
	cancelFA = scSweetAlertCancelButtonFA;
	cancelPos = scSweetAlertCancelButtonFAPos;

	for (parName in params) {
		if ('confirmButtonText' == parName) {
			confirmText = params[parName];
		}
		else if ('confirmButtonFA' == parName) {
			confirmFA = params[parName];
		}
		else if ('confirmButtonFAPos' == parName) {
			confirmPos = params[parName];
		}
		else if ('cancelButtonText' == parName) {
			cancelText = params[parName];
		}
		else if ('cancelButtonFA' == parName) {
			cancelFA = params[parName];
		}
		else if ('cancelButtonFAPos' == parName) {
			cancelPos = params[parName];
		}
		else {
			sweetAlertConfig[parName] = params[parName];
		}
	}

	if ('' != confirmFA) {
		if ('text_right' == confirmPos) {
			confirmText = '<i class="fas ' + confirmFA + '"></i> ' + confirmText;
		}
		else {
			confirmText += ' <i class="fas ' + confirmFA + '"></i>';
		}
	}
	if ('' != cancelFA) {
		if ('text_right' == cancelPos) {
			cancelText = '<i class="fas ' + cancelFA + '"></i> ' + cancelText;
		}
		else {
			cancelText += ' <i class="fas ' + cancelFA + '"></i>';
		}
	}

	sweetAlertConfig['confirmButtonText'] = confirmText;
	sweetAlertConfig['cancelButtonText'] = cancelText;

	if (sweetAlertConfig['toast']) {
		sweetAlertConfig['showConfirmButton'] = false;
		sweetAlertConfig['showCancelButton'] = false;
		sweetAlertConfig['customClass']['popup'] = 'scToastPopup';
		sweetAlertConfig['customClass']['header'] = 'scToastHeader';
		sweetAlertConfig['customClass']['content'] = 'scToastMessage';
		if (null == sweetAlertConfig['timer']) {
			sweetAlertConfig['timer'] = 3000;
		}
		if (null == sweetAlertConfig["position"]) {
			sweetAlertConfig["position"] = "top-end";
		}
	}

	return sweetAlertConfig;
} // scJs_sweetalert_params

function scJs_confirm_sweetalert(message, callbackOk, callbackCancel) {
	var sweetAlertConfig,
	    params = {
		text: message,
		type: 'warning',
		showCancelButton: true,
		customClass: {
			popup: 'scSweetAlertPopup',
			header: 'scSweetAlertHeader',
			content: 'scSweetAlertMessage',
			confirmButton: scSweetAlertConfirmButton,
			cancelButton: scSweetAlertCancelButton
		}
	};

	sweetAlertConfig = scJs_sweetalert_params(params);

	Swal.fire(sweetAlertConfig).then(function (result) {
		if (result.value) {
			callbackOk();
		}
		else if (result.dismiss === Swal.DismissReason.backdrop || result.dismiss === Swal.DismissReason.cancel || result.dismiss === Swal.DismissReason.esc) {
			callbackCancel();
		}
	});
} // scJs_confirm_sweetalert
