function grid_pla_actualizacion_de_datos_fecha_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_fecha" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_fecha_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_fecha" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_cedula_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_cedula" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_cedula_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_cedula" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_nombre_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_nombre" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_nombre_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_nombre" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_celular_personal_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_Hidden_celular_personal" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_celular_personal_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_celular_personal" + seqRow).html(newValue);
}
function grid_pla_actualizacion_de_datos_celular_personal_Hidden_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_Hidden_celular_personal" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_celular_empresa_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_celular_empresa" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_celular_empresa_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_celular_empresa" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_correo_electronico_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_correo_electronico" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_correo_electronico_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_correo_electronico" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_fecha_nacimiento_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_fecha_nacimiento" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_fecha_nacimiento_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_fecha_nacimiento" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_id_periodo_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_id_periodo" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_id_periodo_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_id_periodo" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_id_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_Hidden_id" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_id_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_id" + seqRow).html(newValue);
}
function grid_pla_actualizacion_de_datos_id_Hidden_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_Hidden_id" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_periodo_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_Hidden_periodo" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_periodo_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_periodo" + seqRow).html(newValue);
}
function grid_pla_actualizacion_de_datos_periodo_Hidden_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_Hidden_periodo" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_predio_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_predio" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_predio_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_predio" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_id_predio_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_id_predio" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_id_predio_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_id_predio" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_telefono_emergencia1_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_telefono_emergencia1" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_telefono_emergencia1_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_telefono_emergencia1" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_telefono_emergencia2_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_telefono_emergencia2" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_telefono_emergencia2_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_telefono_emergencia2" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_direccion_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_direccion" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_direccion_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_direccion" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_estado_civil_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_estado_civil" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_estado_civil_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_estado_civil" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_sexo_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_sexo" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_sexo_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_sexo" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_nacionalidad_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_nacionalidad" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_nacionalidad_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_nacionalidad" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_id_nacionalidad_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_id_nacionalidad" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_id_nacionalidad_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_id_nacionalidad" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_talla_camisa_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_talla_camisa" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_talla_camisa_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_talla_camisa" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_talla_zapatos_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_talla_zapatos" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_talla_zapatos_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_talla_zapatos" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_acepta_terminos_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_acepta_terminos" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_acepta_terminos_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_acepta_terminos" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_firma_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_firma" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_firma_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_firma" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_enviar_getValue(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  return $("#id_sc_field_Hidden_enviar" + seqRow).html();
}

function grid_pla_actualizacion_de_datos_enviar_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_enviar" + seqRow).html(newValue);
}
function grid_pla_actualizacion_de_datos_enviar_Hidden_setValue(newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#id_sc_field_Hidden_enviar" + seqRow).html(newValue);
}

function grid_pla_actualizacion_de_datos_getValue(field, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  var SC_tmp = "";
  if ("fecha" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_fecha_getValue(seqRow);
  }
  if ("cedula" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_cedula_getValue(seqRow);
  }
  if ("nombre" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_nombre_getValue(seqRow);
  }
  if ("celular_personal" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_celular_personal_getValue(seqRow);
  }
  if ("celular_empresa" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_celular_empresa_getValue(seqRow);
  }
  if ("correo_electronico" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_correo_electronico_getValue(seqRow);
  }
  if ("fecha_nacimiento" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_fecha_nacimiento_getValue(seqRow);
  }
  if ("id_periodo" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_id_periodo_getValue(seqRow);
  }
  if ("id" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_id_getValue(seqRow);
  }
  if ("periodo" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_periodo_getValue(seqRow);
  }
  if ("predio" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_predio_getValue(seqRow);
  }
  if ("id_predio" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_id_predio_getValue(seqRow);
  }
  if ("telefono_emergencia1" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_telefono_emergencia1_getValue(seqRow);
  }
  if ("telefono_emergencia2" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_telefono_emergencia2_getValue(seqRow);
  }
  if ("direccion" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_direccion_getValue(seqRow);
  }
  if ("estado_civil" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_estado_civil_getValue(seqRow);
  }
  if ("sexo" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_sexo_getValue(seqRow);
  }
  if ("nacionalidad" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_nacionalidad_getValue(seqRow);
  }
  if ("id_nacionalidad" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_id_nacionalidad_getValue(seqRow);
  }
  if ("talla_camisa" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_talla_camisa_getValue(seqRow);
  }
  if ("talla_zapatos" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_talla_zapatos_getValue(seqRow);
  }
  if ("acepta_terminos" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_acepta_terminos_getValue(seqRow);
  }
  if ("firma" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_firma_getValue(seqRow);
  }
  if ("enviar" == field) {
    SC_tmp = grid_pla_actualizacion_de_datos_enviar_getValue(seqRow);
  }
  if (typeof(SC_tmp) == 'undefined') {
      SC_tmp = "";
  }
  else {
      SC_tmp = SC_tmp.replace(/[+]/g, "__NM_PLUS__");
      while (SC_tmp.lastIndexOf("&amp;") != -1)
      {
         SC_tmp = SC_tmp.replace("&amp;" , "__NM_AMP__");
      }
      SC_tmp = SC_tmp.replace(/[&]/g, "__NM_AMP__");
      SC_tmp = SC_tmp.replace(/[%]/g, "__NM_PRC__");
  }
  return SC_tmp;
}

function grid_pla_actualizacion_de_datos_setValue(field, newValue, seqRow) {
  seqRow = scSeqNormalize(seqRow);
  if ("fecha" == field) {
    grid_pla_actualizacion_de_datos_fecha_setValue(newValue, seqRow);
  }
  if ("cedula" == field) {
    grid_pla_actualizacion_de_datos_cedula_setValue(newValue, seqRow);
  }
  if ("nombre" == field) {
    grid_pla_actualizacion_de_datos_nombre_setValue(newValue, seqRow);
  }
  if ("celular_personal" == field) {
    grid_pla_actualizacion_de_datos_celular_personal_setValue(newValue, seqRow);
  }
  if ("celular_empresa" == field) {
    grid_pla_actualizacion_de_datos_celular_empresa_setValue(newValue, seqRow);
  }
  if ("correo_electronico" == field) {
    grid_pla_actualizacion_de_datos_correo_electronico_setValue(newValue, seqRow);
  }
  if ("fecha_nacimiento" == field) {
    grid_pla_actualizacion_de_datos_fecha_nacimiento_setValue(newValue, seqRow);
  }
  if ("id_periodo" == field) {
    grid_pla_actualizacion_de_datos_id_periodo_setValue(newValue, seqRow);
  }
  if ("id" == field) {
    grid_pla_actualizacion_de_datos_id_setValue(newValue, seqRow);
  }
  if ("periodo" == field) {
    grid_pla_actualizacion_de_datos_periodo_setValue(newValue, seqRow);
  }
  if ("predio" == field) {
    grid_pla_actualizacion_de_datos_predio_setValue(newValue, seqRow);
  }
  if ("id_predio" == field) {
    grid_pla_actualizacion_de_datos_id_predio_setValue(newValue, seqRow);
  }
  if ("telefono_emergencia1" == field) {
    grid_pla_actualizacion_de_datos_telefono_emergencia1_setValue(newValue, seqRow);
  }
  if ("telefono_emergencia2" == field) {
    grid_pla_actualizacion_de_datos_telefono_emergencia2_setValue(newValue, seqRow);
  }
  if ("direccion" == field) {
    grid_pla_actualizacion_de_datos_direccion_setValue(newValue, seqRow);
  }
  if ("estado_civil" == field) {
    grid_pla_actualizacion_de_datos_estado_civil_setValue(newValue, seqRow);
  }
  if ("sexo" == field) {
    grid_pla_actualizacion_de_datos_sexo_setValue(newValue, seqRow);
  }
  if ("nacionalidad" == field) {
    grid_pla_actualizacion_de_datos_nacionalidad_setValue(newValue, seqRow);
  }
  if ("id_nacionalidad" == field) {
    grid_pla_actualizacion_de_datos_id_nacionalidad_setValue(newValue, seqRow);
  }
  if ("talla_camisa" == field) {
    grid_pla_actualizacion_de_datos_talla_camisa_setValue(newValue, seqRow);
  }
  if ("talla_zapatos" == field) {
    grid_pla_actualizacion_de_datos_talla_zapatos_setValue(newValue, seqRow);
  }
  if ("acepta_terminos" == field) {
    grid_pla_actualizacion_de_datos_acepta_terminos_setValue(newValue, seqRow);
  }
  if ("firma" == field) {
    grid_pla_actualizacion_de_datos_firma_setValue(newValue, seqRow);
  }
  if ("enviar" == field) {
    grid_pla_actualizacion_de_datos_enviar_setValue(newValue, seqRow);
  }
  if ("celular_personal_Hidden" == field) {
    grid_pla_actualizacion_de_datos_celular_personal_Hidden_setValue(newValue, seqRow);
  }
  if ("id_Hidden" == field) {
    grid_pla_actualizacion_de_datos_id_Hidden_setValue(newValue, seqRow);
  }
  if ("periodo_Hidden" == field) {
    grid_pla_actualizacion_de_datos_periodo_Hidden_setValue(newValue, seqRow);
  }
  if ("enviar_Hidden" == field) {
    grid_pla_actualizacion_de_datos_enviar_Hidden_setValue(newValue, seqRow);
  }
}

function scJQAddEvents(seqRow) {
  seqRow = scSeqNormalize(seqRow);
  $("#sc-actionbar-actbtn_enviarwhatsapp" + seqRow).click(function () {
    let actionBarButtonRow = "", actionBarButtonState = "", actionBarButtonConfirm = "";
    if ($(this).hasClass("disabled")) {
        return;
    }
    actionBarButtonRow = $(this).data("actionbarRow");
    actionBarButtonState = $(this).data("actionbarState");
    actionBarButtonConfirm = $(this).data("actionbarConfirm");
    if ("" != actionBarButtonConfirm) {
      scJs_confirm(actionBarButtonConfirm, function() { scAjaxCall_actbtn_enviarwhatsapp_onClick(seqRow, actionBarButtonRow, actionBarButtonState, actionBarButtonConfirm); }, function() {});
      return;
    }
    scAjaxCall_actbtn_enviarwhatsapp_onClick(seqRow, actionBarButtonRow, actionBarButtonState, actionBarButtonConfirm);
  }).mouseover(function() { $(this).css("cursor", "pointer"); })
    .mouseout(function() { $(this).css("cursor", "pointer"); })
    .addClass(($("#sc-actionbar-actbtn_enviarwhatsapp" + seqRow).parent().hasClass("scGridFieldOddFont") ? "scGridFieldOddLink" : "scGridFieldEvenLink"));
  $("#id_sc_field_celular_personal" + seqRow).click(function () {
    let actionBarButtonRow = "", actionBarButtonState = "", actionBarButtonConfirm = "";
    if ("" != actionBarButtonConfirm) {
      scJs_confirm(actionBarButtonConfirm, function() { scAjaxCall_celular_personal_onClick(seqRow, actionBarButtonRow, actionBarButtonState, actionBarButtonConfirm); }, function() {});
      return;
    }
    scAjaxCall_celular_personal_onClick(seqRow, actionBarButtonRow, actionBarButtonState, actionBarButtonConfirm);
  }).mouseover(function() { $(this).css("cursor", "pointer"); })
    .mouseout(function() { $(this).css("cursor", "pointer"); })
    .addClass(($("#id_sc_field_celular_personal" + seqRow).parent().hasClass("scGridFieldOddFont") ? "scGridFieldOddLink" : "scGridFieldEvenLink"));
}
function scAjaxCall_actbtn_enviarwhatsapp_onClick(seqRow, actionBarButtonRow, actionBarButtonState, actionBarButtonConfirm) {
  nmAjaxProcOn();
  $.ajax({
    type: "POST",
    url: "index.php",
    data: "nmgp_opcao=ajax_event&nmgp_event=actbtn_enviarwhatsapp_onClick&script_case_init=" + document.F3.script_case_init.value + "&enviar=" + grid_pla_actualizacion_de_datos_getValue("enviar", seqRow) + "&id=" + grid_pla_actualizacion_de_datos_getValue("id", seqRow) + "&periodo=" + grid_pla_actualizacion_de_datos_getValue("periodo", seqRow) + "&quitarmarca=" + grid_pla_actualizacion_de_datos_getValue("quitarmarca", seqRow) + "&quitarmarca_erro=" + grid_pla_actualizacion_de_datos_getValue("quitarmarca_erro", seqRow) + "&ponermarca=" + grid_pla_actualizacion_de_datos_getValue("ponermarca", seqRow) + "&ponermarca_erro=" + grid_pla_actualizacion_de_datos_getValue("ponermarca_erro", seqRow) + "&actionbar_clicked_state=" + actionBarButtonState + ""
   })
   .done(function(jsonReturn) {
      var i, fieldDisplay, oResp;
      Tst_integrid = jsonReturn.trim();
      if ("{" != Tst_integrid.substr(0, 1)) {
        nmAjaxProcOff();
        alert (jsonReturn);
        return;
      }
      nmAjaxProcOff();
      eval("oResp = " + jsonReturn);
      if (oResp["setValue"]) {
        for (i = 0; i < oResp["setValue"].length; i++) {
          grid_pla_actualizacion_de_datos_setValue(oResp["setValue"][i]["field"], oResp["setValue"][i]["value"], seqRow);
        }
      }
      if (oResp["fieldDisplay"]) {
        for (i = 0; i < oResp["fieldDisplay"].length; i++) {
          if ("off" == oResp["fieldDisplay"][i]["status"]) {
            $("#id_sc_field_" + oResp["fieldDisplay"][i]["field"] + seqRow).hide();
          }
          else {
            $("#id_sc_field_" + oResp["fieldDisplay"][i]["field"] + seqRow).show();
          }
        }
      }
      if (oResp["Refresh"]) {
         nm_gp_move('igual');
      }
      if (oResp["redirInfo"]) {
         nmAjaxRedir(oResp);
      }
      if (oResp["changeCss"]) {
         nmAjaxChangeCss(oResp["changeCss"], seqRow);
      }
      if (oResp["htmOutput"]) {
        nmAjaxShowDebug(oResp);
      }
      if (oResp["ajaxMessage"]) {
         nmAjaxMessage(oResp);
      }
      if (oResp["actionbarState"]) {
        for (var i in oResp["actionbarState"]) {
          actionBar_displayState(i, oResp["actionbarState"][i], actionBarButtonRow);
        }
      }
      if (oResp["actionbarDisable"]) {
        for (var i in oResp["actionbarDisable"]) {
          actionBar_disable(i, oResp["actionbarDisable"][i], actionBarButtonRow);
        }
      }
      if (oResp["actionbarHide"]) {
        for (var i in oResp["actionbarHide"]) {
          actionBar_hide(i, oResp["actionbarHide"][i], actionBarButtonRow);
        }
      }
      if ("function" == typeof applyGroupButtons) {
        let buttonObject = $("#sc-actionbar-actbtn_enviarwhatsapp" + seqRow);
        applyGroupButtons($(".sc-actbtn-group-" + buttonObject.data("actionbarPos") + buttonObject.data("actionbarRow")));
      }
  });
}
function scAjaxCall_celular_personal_onClick(seqRow, actionBarButtonRow, actionBarButtonState, actionBarButtonConfirm) {
  nmAjaxProcOn();
  $.ajax({
    type: "POST",
    url: "index.php",
    data: "nmgp_opcao=ajax_event&nmgp_event=celular_personal_onClick&script_case_init=" + document.F3.script_case_init.value + "&celular_personal=" + grid_pla_actualizacion_de_datos_getValue("celular_personal", seqRow) + "&datavgeu=" + grid_pla_actualizacion_de_datos_getValue("datavgeu", seqRow) + ""
   })
   .done(function(jsonReturn) {
      var i, fieldDisplay, oResp;
      Tst_integrid = jsonReturn.trim();
      if ("{" != Tst_integrid.substr(0, 1)) {
        nmAjaxProcOff();
        alert (jsonReturn);
        return;
      }
      nmAjaxProcOff();
      eval("oResp = " + jsonReturn);
      if (oResp["setValue"]) {
        for (i = 0; i < oResp["setValue"].length; i++) {
          grid_pla_actualizacion_de_datos_setValue(oResp["setValue"][i]["field"], oResp["setValue"][i]["value"], seqRow);
        }
      }
      if (oResp["fieldDisplay"]) {
        for (i = 0; i < oResp["fieldDisplay"].length; i++) {
          if ("off" == oResp["fieldDisplay"][i]["status"]) {
            $("#id_sc_field_" + oResp["fieldDisplay"][i]["field"] + seqRow).hide();
          }
          else {
            $("#id_sc_field_" + oResp["fieldDisplay"][i]["field"] + seqRow).show();
          }
        }
      }
      if (oResp["Refresh"]) {
         nm_gp_move('igual');
      }
      if (oResp["redirInfo"]) {
         nmAjaxRedir(oResp);
      }
      if (oResp["changeCss"]) {
         nmAjaxChangeCss(oResp["changeCss"], seqRow);
      }
      if (oResp["htmOutput"]) {
        nmAjaxShowDebug(oResp);
      }
      if (oResp["ajaxMessage"]) {
         nmAjaxMessage(oResp);
      }
  });
}

function scSeqNormalize(seqRow) {
  var newSeqRow = seqRow.toString();
  if ("" == newSeqRow) {
    return "";
  }
  if ("_" != newSeqRow.substr(0, 1)) {
    return "_" + newSeqRow;
  }
  return newSeqRow;
}
function nmAjaxChangeCss(cssChanges, seqRow)
{
    let baseSeq = seqRow.substr(1), underscoreSeq = "_" + baseSeq, ruleSelector, ruleName;
    for (ruleSelector in cssChanges) {
        for (ruleSeq in cssChanges[ruleSelector]) {
            if ("ajax_navigate" == seqRow) {
                baseSeq = ruleSeq;
                underscoreSeq = "_" + baseSeq;
            }
            for (ruleName in cssChanges[ruleSelector][ruleSeq]) {
                if ("sc_badge" == ruleName) {
                    if ("" != ruleSelector) {
                        $("#id_sc_field_" + ruleSelector + underscoreSeq).removeClass("sc-badge-pill").removeClass("sc-b-blue").removeClass("sc-b-brown").removeClass("sc-b-cyan").removeClass("sc-b-gray").removeClass("sc-b-green").removeClass("sc-b-orange").removeClass("sc-b-pink").removeClass("sc-b-purple").removeClass("sc-b-red").removeClass("sc-b-yellow");
                    }
                    if ("" != cssChanges[ruleSelector][ruleSeq][ruleName]) {
                        $("#id_sc_field_" + ruleSelector + underscoreSeq).addClass("sc-badge-pill").addClass("sc-b-" + cssChanges[ruleSelector][ruleSeq][ruleName]);
                    }
                } else if ("__sc_row" == ruleSelector) {
                    $("#SC_ancor" + baseSeq + " .scGridFieldOddFont").css(ruleName, cssChanges[ruleSelector][ruleSeq][ruleName]);
                    $("#SC_ancor" + baseSeq + " .scGridFieldEvenFont").css(ruleName, cssChanges[ruleSelector][ruleSeq][ruleName]);
                } else {
                    $("#SC_ancor" + baseSeq + " .css_" + ruleSelector + "_grid_line").css(ruleName, cssChanges[ruleSelector][ruleSeq][ruleName]);
                }
            }
        }
    }
}
  function nmAjaxRedir(oTemp)
  {
    if (oTemp && oTemp != null) {
        oResp = oTemp;
    }
    if (!oResp["redirInfo"]) {
      return;
    }
    sMetodo = oResp["redirInfo"]["metodo"];
    sAction = oResp["redirInfo"]["action"];
    if ("location" == sMetodo) {
      if ("parent.parent" == oResp["redirInfo"]["target"]) {
        parent.parent.location = sAction;
      }
      else if ("parent" == oResp["redirInfo"]["target"]) {
        parent.location = sAction;
      }
      else if ("_blank" == oResp["redirInfo"]["target"]) {
        window.open(sAction, "_blank");
      }
      else {
        document.location = sAction;
      }
    }
    else if ("html" == sMetodo) {
        document.write(nmAjaxSpecCharParser(oResp["redirInfo"]["action"]));
    }
    else {
      if (oResp["redirInfo"]["target"] == "modal") {
          tb_show('', sAction + '?script_case_init=' +  oResp["redirInfo"]["script_case_init"] + '&nmgp_parms=' + oResp["redirInfo"]["nmgp_parms"] + '&nmgp_outra_jan=true&nmgp_url_saida=modal&NMSC_modal=ok&TB_iframe=true&modal=true&height=' +  oResp["redirInfo"]["h_modal"] + '&width=' + oResp["redirInfo"]["w_modal"], '');
          return;
      }
      sFormRedir = (oResp["redirInfo"]["nmgp_outra_jan"]) ? "form_ajax_redir_1" : "form_ajax_redir_2";
      document.forms[sFormRedir].action           = sAction;
      document.forms[sFormRedir].target           = oResp["redirInfo"]["target"];
      document.forms[sFormRedir].nmgp_parms.value = oResp["redirInfo"]["nmgp_parms"];
      if ("form_ajax_redir_1" == sFormRedir) {
        document.forms[sFormRedir].nmgp_outra_jan.value = oResp["redirInfo"]["nmgp_outra_jan"];
      }
      else {
        document.forms[sFormRedir].nmgp_url_saida.value   = oResp["redirInfo"]["nmgp_url_saida"];
        document.forms[sFormRedir].script_case_init.value = oResp["redirInfo"]["script_case_init"];
      }
      document.forms[sFormRedir].submit();
    }
  }
var json_err_crtl    = 1;
var Id_Btn_selected  = new Array();
var Css_Btn_selected = new Array();
Id_Btn_selected[0] = "selcmp_top";
Id_Btn_selected[1] = "ordcmp_top";
Id_Btn_selected[2] = "sel_groupby_top";
function ajax_navigate(opc, parm, Fade='S')
{
    if (typeof parm == "string" && "reloadchart__" == parm.substring(0, 13)) {
        parm = parm.substring(13);
    }
    var scrollNavigateReload = false, extraParams = "", iEvt, iStart = 0, rebindClickOnFixedCols = false;
       $('.group_col_backdrop').remove();
    for (ibtn = 0; ibtn < 3; ibtn++) {
        Css_Btn_selected[ibtn] = $("#" + Id_Btn_selected[ibtn]).attr('class');
    }
    if (Fade == 'S') {
        nmAjaxProcOn();
    }
    if (scrollNavigateReload) {
      extraParams += "&scrollNavigateReload=Y";
    }
    if (typeof parm !== "string") {
      parm = parm.toString();
    }
    parm = parm.replace(/[+]/g, "__NM_PLUS__");
    while (parm.lastIndexOf("&amp;") != -1)
    {
       parm = parm.replace("&amp;" , "__NM_AMP__");
    }
    parm = parm.replace(/[&]/g, "__NM_AMP__");
    parm = parm.replace(/[%]/g, "__NM_PRC__");
    parm_save = parm;
    return new Promise(function(resolve, reject) {$.ajax({
      type: "POST",
      url: "index.php",
      data: "nmgp_opcao=ajax_navigate&script_case_init=" + document.F4.script_case_init.value + "&opc=" + opc  + "&parm=" + parm + extraParams
     })
     .fail(function(jqxhr, textStatus, error) {
        var err = textStatus + ", " + error;
        if (json_err_crtl == 1) {
            json_err_crtl++;
            ajax_navigate(opc, parm);
        }
        else {
            nmAjaxProcOff();
            json_err_crtl = 1;
            alert (err);
        }
     })
     .done(function(jsonNavigate) {
        var i, oResp;
        json_err_crtl = 1;
        Tst_integrid = jsonNavigate.trim();
        if ("{" != Tst_integrid.substr(0, 1)) {
            nmAjaxProcOff();
            alert (jsonNavigate);
            return;
        }
        eval("oResp = " + jsonNavigate);
        if (oResp["ss_time_out"]) {
            nmAjaxProcOff();
            nm_move();
        }
        if (!SC_Proc_Mobile) {
            document.getElementById('nmsc_iframe_liga_A_grid_pla_actualizacion_de_datos').src = 'NM_Blank_Page.htm';
            document.getElementById('nmsc_iframe_liga_E_grid_pla_actualizacion_de_datos').src = 'NM_Blank_Page.htm';
            document.getElementById('nmsc_iframe_liga_D_grid_pla_actualizacion_de_datos').src = 'NM_Blank_Page.htm';
            document.getElementById('nmsc_iframe_liga_B_grid_pla_actualizacion_de_datos').src = 'NM_Blank_Page.htm';
            document.getElementById('nmsc_iframe_liga_A_grid_pla_actualizacion_de_datos').style.height = '0px';
            document.getElementById('nmsc_iframe_liga_E_grid_pla_actualizacion_de_datos').style.height = '0px';
            document.getElementById('nmsc_iframe_liga_D_grid_pla_actualizacion_de_datos').style.height = '0px';
            document.getElementById('nmsc_iframe_liga_B_grid_pla_actualizacion_de_datos').style.height = '0px';
            document.getElementById('nmsc_iframe_liga_A_grid_pla_actualizacion_de_datos').style.width  = '0px';
            document.getElementById('nmsc_iframe_liga_E_grid_pla_actualizacion_de_datos').style.width  = '0px';
            document.getElementById('nmsc_iframe_liga_D_grid_pla_actualizacion_de_datos').style.width  = '0px';
            document.getElementById('nmsc_iframe_liga_B_grid_pla_actualizacion_de_datos').style.width  = '0px';
        }
        if (oResp["ajaxMessage"]) {
           nmAjaxMessage(oResp);
        }
        if (oResp["setValue"]) {
          for (i = 0; i < oResp["setValue"].length; i++) {
            $("#" + oResp["setValue"][i]["field"]).html(oResp["setValue"][i]["value"]);
            if ("sc_grid_body" == oResp["setValue"][i]["field"]) {
              if ("function" == typeof applyGroupButtons) {
                applyGroupButtons();
              }
            }
          }
        }
        if (oResp["setTitle"]) {
          for (i = 0; i < oResp["setTitle"].length; i++) {
            $("#" + oResp["setTitle"][i]["field"]).attr('title', oResp["setTitle"][i]["value"]);
          }
        }
        if (oResp["setArr"]) {
          for (i = 0; i < oResp["setArr"].length; i++) {
               eval (oResp["setArr"][i]["var"] + ' = new Array()');
          }
        }
        if (oResp["setVar"]) {
          for (i = 0; i < oResp["setVar"].length; i++) {
               eval (oResp["setVar"][i]["var"] + ' = \"' + oResp["setVar"][i]["value"] + '\"');
          }
        }
        if (oResp["fillArr"]) {
          for (i = 0; i < oResp["fillArr"].length; i++) {
               eval (oResp["fillArr"][i]["var"] + ' = {' + oResp["fillArr"][i]["value"] + '}');
          }
        }
        if (oResp["setThickbox"]) {
          for (i = 0; i < oResp["setThickbox"].length; i++) {
            eval ("document.getElementById('TB_iframeContent').contentWindow.document.getElementById('" + oResp["setThickbox"][i]["field"] + "').innerHTML = \"" + oResp["setThickbox"][i]["value"] + "\"");
          }
        }
        if (oResp["setDisplay"]) {
          for (i = 0; i < oResp["setDisplay"].length; i++) {
            if (typeof oResp["setDisplay"][i] === 'object' && oResp["setDisplay"][i] !== null) {
                var sVarField = oResp["setDisplay"][i].field;
                var sVarValue = oResp["setDisplay"][i].value;
            }
            else {
                var sVarField = oResp["setDisplay"][i]["field"];
                var sVarValue = oResp["setDisplay"][i]["value"];
            }
            if (document.getElementById(sVarField)){document.getElementById(sVarField).style.display = sVarValue;}
          }
        }
        if (oResp["setVisibility"]) {
          for (i = 0; i < oResp["setVisibility"].length; i++) {
            if (typeof oResp["setVisibility"][i] === 'object' && oResp["setVisibility"][i] !== null) {
                var sVarField = oResp["setVisibility"][i].field;
                var sVarValue = oResp["setVisibility"][i].value;
            }
            else {
                var sVarField = oResp["setVisibility"][i]["field"];
                var sVarValue = oResp["setVisibility"][i]["value"];
            }
            if (document.getElementById(sVarField)){document.getElementById(sVarField).style.visibility = sVarValue;}
          }
        }
        if (oResp["setDisabled"]) {
          for (i = 0; i < oResp["setDisabled"].length; i++) {
            if (typeof oResp["setDisabled"][i] === 'object' && oResp["setDisabled"][i] !== null) {
                var sVarField = oResp["setDisabled"][i].field;
                var sVarValue = oResp["setDisabled"][i].value;
            }
            else {
                var sVarField = oResp["setDisabled"][i]["field"];
                var sVarValue = oResp["setDisabled"][i]["value"];
            }
            if (document.getElementById(sVarField)){document.getElementById(sVarField).disabled = sVarValue;}
          }
        }
        if (oResp["setClass"]) {
          for (i = 0; i < oResp["setClass"].length; i++) {
            if (typeof oResp["setClass"][i] === 'object' && oResp["setClass"][i] !== null) {
                var sVarField = oResp["setClass"][i].field;
                var sVarValue = oResp["setClass"][i].value;
            }
            else {
                var sVarField = oResp["setClass"][i]["field"];
                var sVarValue = oResp["setClass"][i]["value"];
            }
            if (document.getElementById(sVarField)){document.getElementById(sVarField).className = sVarValue;}
          }
        }
        if (oResp["setSrc"]) {
          for (i = 0; i < oResp["setSrc"].length; i++) {
            if (typeof oResp["setSrc"][i] === 'object' && oResp["setSrc"][i] !== null) {
                var sVarField = oResp["setSrc"][i].field;
                var sVarValue = oResp["setSrc"][i].value;
            }
            else {
                var sVarField = oResp["setSrc"][i]["field"];
                var sVarValue = oResp["setSrc"][i]["value"];
            }
            if (document.getElementById(sVarField)){document.getElementById(sVarField).src = sVarValue;}
          }
        }
        if (oResp["remove_Obj"]) {
          for (i = 0; i < oResp["remove_Obj"].length; i++) {
            if (typeof oResp["remove_Obj"][i] === 'object' && oResp["remove_Obj"][i] !== null) {
                var sVarField = oResp["remove_Obj"][i].field;
                var sVarValue = oResp["remove_Obj"][i].value;
            }
            else {
                var sVarField = oResp["remove_Obj"][i]["field"];
                var sVarValue = oResp["remove_Obj"][i]["value"];
            }
            if (document.getElementById(sVarField)){document.getElementById(sVarField).src = remove();}
          }
        }
        if (oResp["redirInfo"]) {
           nmAjaxRedir(oResp);
        }
        if (oResp["changeCss"]) {
           nmAjaxChangeCss(oResp["changeCss"], 'ajax_navigate');
        }
        if (oResp["AlertJS"]) {
          for (i = 0; i < oResp["AlertJS"].length; i++) {
              jsAlertParams = oResp["AlertJSParam"][i] ? oResp["AlertJSParam"][i] : {};
              scJs_alert (oResp["AlertJS"][i], jsAlertParams);
          }
        }
        if (oResp["exec_JS"]) {
          for (i = 0; i < oResp["exec_JS"].length; i++) {
               eval (oResp["exec_JS"][i]["function"] + '("' + oResp["exec_JS"][i]["parm"] + '");');
          }
        }
        if (oResp["grid_search_add"]) {
          for (i = 0; i < oResp["grid_search_add"].length; i++) {
               var parm = oResp["grid_search_add"][i]['field'];
               Tot_obj_grid_search++;
               Tab_obj_grid_search[Tot_obj_grid_search] = parm;
               $(oResp["grid_search_add"][i]['tag']).insertBefore('#add_grid_search');
               $('#grid_search_' + parm).attr('new', 'new');
               scLoadScInput('#grid_search_' + parm + '_' + Tot_obj_grid_search + ' input:text.sc-js-input');
          }
          SC_carga_evt_jquery_grid('all');
        }
        if (oResp["htmOutput"]) {
           nmAjaxShowDebug(oResp);
        }
        if (oResp["ajaxMessage"]) {
           nmAjaxMessage(oResp);
        }
        scFixCol_addClickControl();
        scFixCol_loadState();
        if (typeof SC_Link_View !== 'undefined' && !SC_Link_View)
        {
            if (Qsearch_ok)
            {
                scQuickSearchKeyUp('top', null);
            }
            if (parm == "save_grid") {
                Dyn_Ini = true;
            }
            SC_init_jquery(false);
            tb_init('a.thickbox, area.thickbox, input.thickbox');
        }
        for (ibtn = 0; ibtn < 3; ibtn++) {
             $("#" + Id_Btn_selected[ibtn]).attr('class', Css_Btn_selected[ibtn]);
        }
        if (Fade == 'S') {
            nmAjaxProcOff();
        }
        if (typeof(bootstrapMobile) === typeof(function(){})) bootstrapMobile(opc);
        resolve();
          var hval = 0;
          if (document._toolbarHeightFix != undefined) {
            hval = document._toolbarHeightFix;
          }
            scSetFixedHeadersCss(hval);
            scSetFixedHeaders();
    })});
}
function ajax_navigate_res(opc, parm, Fade='S')
{
    let extraParams = [], extraParamsString = "", refixLabels = false;
    if (typeof parm == "string" && "reloadchart__" == parm.substring(0, 13)) {
        parm = parm.substring(13);
        extraParams.push("reload_chart=Y");
        refixLabels = true;
    }
    if (typeof parm == "string" && "change_record_pagination" == parm.substring(0, 24)) {
        refixLabels = true;
    }
    if (typeof parm == "string" && "change_page_pagination" == parm.substring(0, 22)) {
        refixLabels = true;
    }
    if (typeof parm == "string" && "change_length_pagination" == parm.substring(0, 24)) {
        refixLabels = true;
    }
    $('.group_col_backdrop').remove();
    if (Fade == 'S') {
        nmAjaxProcOn();
    }
    parm_save = parm;
    if (extraParams.length) {
        extraParamsString = "&" + extraParams.join("&");
    }
    $.ajax({
      type: "POST",
      url: "index.php",
      data: "nmgp_opcao=ajax_navigate&script_case_init=" + document.FRES.script_case_init.value + "&opc=" + opc  + "&parm=" + parm + extraParamsString
     })
     .done(function(jsonNavigate) {
        if ("grid_search_res" == opc && typeof scSummaryNoRecords != "undefined" && scSummaryNoRecords) {
            document.refresh_config.submit();
            return;
        }
        var i, oResp;
        Tst_integrid = jsonNavigate.trim();
        if ("{" != Tst_integrid.substr(0, 1)) {
            nmAjaxProcOff();
            alert (jsonNavigate);
            return;
        }
        eval("oResp = " + jsonNavigate);
        if (oResp["ss_time_out"]) {
            nmAjaxProcOff();
            nm_move();
        }
        if (oResp["ajaxMessage"]) {
           nmAjaxMessage(oResp);
        }
        if (oResp["setValue"]) {
          for (i = 0; i < oResp["setValue"].length; i++) {
            $("#" + oResp["setValue"][i]["field"]).html(oResp["setValue"][i]["value"]);
          }
        }
        if (oResp["setJqueryVal"]) {
          for (i = 0; i < oResp["setJqueryVal"].length; i++) {
            $("#" + oResp["setJqueryVal"][i]["field"]).val(oResp["setJqueryVal"][i]["value"]);
          }
        }
        if (oResp["setTitle"]) {
          for (i = 0; i < oResp["setTitle"].length; i++) {
            $("#" + oResp["setTitle"][i]["field"]).attr('title', oResp["setTitle"][i]["value"]);
          }
        }
        if (oResp["setArr"]) {
          for (i = 0; i < oResp["setArr"].length; i++) {
               eval (oResp["setArr"][i]["var"] + ' = new Array()');
          }
        }
        if (oResp["setVar"]) {
          for (i = 0; i < oResp["setVar"].length; i++) {
               eval (oResp["setVar"][i]["var"] + ' = \"' + oResp["setVar"][i]["value"] + '\"');
          }
        }
        if (oResp["fillArr"]) {
          for (i = 0; i < oResp["fillArr"].length; i++) {
               eval (oResp["fillArr"][i]["var"] + ' = {' + oResp["fillArr"][i]["value"] + '}');
          }
        }
        if (oResp["setThickbox"]) {
          for (i = 0; i < oResp["setThickbox"].length; i++) {
            eval ("document.getElementById('TB_iframeContent').contentWindow.document.getElementById('" + oResp["setThickbox"][i]["field"] + "').innerHTML = \"" + oResp["setThickbox"][i]["value"] + "\"");
          }
        }
        if (oResp["setDisplay"]) {
          for (i = 0; i < oResp["setDisplay"].length; i++) {
            if (typeof oResp["setDisplay"][i] === 'object' && oResp["setDisplay"][i] !== null) {
                var sVarField = oResp["setDisplay"][i].field;
                var sVarValue = oResp["setDisplay"][i].value;
            }
            else {
                var sVarField = oResp["setDisplay"][i]["field"];
                var sVarValue = oResp["setDisplay"][i]["value"];
            }
            if (document.getElementById(sVarField)){document.getElementById(sVarField).style.display = sVarValue;}
          }
        }
        if (oResp["setVisibility"]) {
          for (i = 0; i < oResp["setVisibility"].length; i++) {
            if (typeof oResp["setVisibility"][i] === 'object' && oResp["setVisibility"][i] !== null) {
                var sVarField = oResp["setVisibility"][i].field;
                var sVarValue = oResp["setVisibility"][i].value;
            }
            else {
                var sVarField = oResp["setVisibility"][i]["field"];
                var sVarValue = oResp["setVisibility"][i]["value"];
            }
            if (document.getElementById(sVarField)){document.getElementById(sVarField).style.visibility = sVarValue;}
          }
        }
        if (oResp["setDisabled"]) {
          for (i = 0; i < oResp["setDisabled"].length; i++) {
            if (typeof oResp["setDisabled"][i] === 'object' && oResp["setDisabled"][i] !== null) {
                var sVarField = oResp["setDisabled"][i].field;
                var sVarValue = oResp["setDisabled"][i].value;
            }
            else {
                var sVarField = oResp["setDisabled"][i]["field"];
                var sVarValue = oResp["setDisabled"][i]["value"];
            }
            if (document.getElementById(sVarField)){document.getElementById(sVarField).disabled = sVarValue;}
          }
        }
        if (oResp["setClass"]) {
          for (i = 0; i < oResp["setClass"].length; i++) {
            if (typeof oResp["setClass"][i] === 'object' && oResp["setClass"][i] !== null) {
                var sVarField = oResp["setClass"][i].field;
                var sVarValue = oResp["setClass"][i].value;
            }
            else {
                var sVarField = oResp["setClass"][i]["field"];
                var sVarValue = oResp["setClass"][i]["value"];
            }
            if (document.getElementById(sVarField)){document.getElementById(sVarField).className = sVarValue;}
          }
        }
        if (oResp["setSrc"]) {
          for (i = 0; i < oResp["setSrc"].length; i++) {
            if (typeof oResp["setSrc"][i] === 'object' && oResp["setSrc"][i] !== null) {
                var sVarField = oResp["setSrc"][i].field;
                var sVarValue = oResp["setSrc"][i].value;
            }
            else {
                var sVarField = oResp["setSrc"][i]["field"];
                var sVarValue = oResp["setSrc"][i]["value"];
            }
            if (document.getElementById(sVarField)){document.getElementById(sVarField).src = sVarValue;}
          }
        }
        if (oResp["grid_search_add"]) {
          for (i = 0; i < oResp["grid_search_add"].length; i++) {
               var parm = oResp["grid_search_add"][i]['field'];
               Tot_obj_grid_search++;
               Tab_obj_grid_search[Tot_obj_grid_search] = parm;
               $(oResp["grid_search_add"][i]['tag']).insertBefore('#add_grid_search');
               $('#grid_search_' + parm).attr('new', 'new');
               scLoadScInput('#grid_search_' + parm + '_' + Tot_obj_grid_search + ' input:text.sc-js-input');
          }
          SC_carga_evt_jquery_grid('all');
        }
        if (oResp["redirInfo"]) {
           nmAjaxRedir(oResp);
        }
        if (("resumo_search" == opc || "grid_search_res" == opc || "dyn_search_res" == opc || "dyn_search_clear_res" == opc || "dyn_search_save_res" == opc || "dyn_search_select_res" == opc || "dyn_search_delete_res" == opc) && typeof scChart_update_inline == "function") {
            scChart_update_inline();
        }
        if (oResp["click_sel_groupby"] && "" != oResp["click_sel_groupby"]) {
            document.getElementById(oResp["click_sel_groupby"]).click();
        }
        if (oResp["AlertJS"]) {
          for (i = 0; i < oResp["AlertJS"].length; i++) {
              jsAlertParams = oResp["AlertJSParam"][i] ? oResp["AlertJSParam"][i] : {};
              scJs_alert (oResp["AlertJS"][i], jsAlertParams);
          }
        }
        if (oResp["exec_JS"]) {
          for (i = 0; i < oResp["exec_JS"].length; i++) {
               eval (oResp["exec_JS"][i]["function"] + '("' + oResp["exec_JS"][i]["parm"] + '");');
          }
        }
        if (oResp["htmOutput"]) {
           nmAjaxShowDebug(oResp);
        }
        if (oResp["ajaxMessage"]) {
           nmAjaxMessage(oResp);
        }
        if (typeof scOrder_addClickControl == "function") {
            scOrder_addClickControl();
        }
        if (Fade == 'S') {
            nmAjaxProcOff();
        }
        if (oResp["exec_script"]) {
          for (i = 0; i < oResp["exec_script"].length; i++) {
              eval (oResp["exec_script"][i]);
          }
        }
    });
}
function ajax_add_grid_search(obj, str_origem, str_field)
{
    $(obj).parent().parent().remove();
    
    if($('#id_grid_search_all_cmp tr').length < 1)
    {
        $('#add_grid_search').addClass('scGridFilterTagAddDisabled');
    }
    else
    {
        $('#add_grid_search').removeClass('scGridFilterTagAddDisabled');
    }
    parm  = str_field;
    nmAjaxProcOn();
    Tot_obj_grid_search++;
    Tab_obj_grid_search[Tot_obj_grid_search] = parm;
    $.ajax({
      type: "POST",
      url: "index.php",
      data: "nmgp_opcao=ajax_add_grid_search&script_case_init=" + document.Fgrid_search.script_case_init.value + "&parm=" + parm + "&seq=" + Tot_obj_grid_search + "&origem=" + str_origem
     })
     .done(function(jsonGrid_add) {
        var i, oResp;
        Tst_integrid = jsonGrid_add.trim();
        if ("{" != Tst_integrid.substr(0, 1)) {
            nmAjaxProcOff();
            alert (jsonGrid_add);
            return;
        }
        eval("oResp = " + jsonGrid_add);
        if (oResp["ss_time_out"]) {
            nmAjaxProcOff();
            nm_move();
        }
        if (oResp["grid_add"]) {
          for (i = 0; i < oResp["grid_add"].length; i++) {
               $(oResp["grid_add"][i]).insertBefore('#add_grid_search');
               $('#grid_search_' + parm).attr('new', 'new');
               $('#grid_search_' + parm).find('.scGridFilterTagListItemLabel').click();
               $('#grid_search_' + parm).find('input[type=text]').focus();
          }
        }
        if (oResp["setVar"]) {
          for (i = 0; i < oResp["setVar"].length; i++) {
               eval (oResp["setVar"][i]["var"] + ' = \"' + oResp["setVar"][i]["value"] + '\"');
          }
        }
        if (oResp["htmOutput"]) {
           nmAjaxShowDebug(oResp);
        }
        SC_carga_evt_jquery_grid(Tot_obj_grid_search);
        scLoadScInput('#grid_search_' + parm + '_' + Tot_obj_grid_search + ' input:text.sc-js-input');
        nmAjaxProcOff();
    });
}
function ajax_ch_bi_grid_search(field, ind, parm, str_origem)
{
    nmAjaxProcOn();
    $.ajax({
      type: "POST",
      url: "index.php",
      data: "nmgp_opcao=ajax_ch_bi_dyn_search&script_case_init=" + document.Fgrid_search.script_case_init.value + "&field=" + field + "&parm=" + parm + "&origem=" + str_origem
     })
     .done(function(jsonDyn_ch_bi) {
        var i, oResp;
        Tst_integrid = jsonDyn_ch_bi.trim();
        if ("{" != Tst_integrid.substr(0, 1)) {
            nmAjaxProcOff();
            alert (jsonDyn_ch_bi);
            return;
        }
        eval("oResp = " + jsonDyn_ch_bi);
        if (oResp["ss_time_out"]) {
            nmAjaxProcOff();
            nm_move();
        }
        if (oResp["dyn_ch_bi"]) {
          for (i = 0; i < oResp["dyn_ch_bi"].length; i++) {
               $('#ID_bi_dados_grid_' + field + '_' + ind).html(oResp["dyn_ch_bi"][i]);
          }
        }
        $('#ID_bi_dados_grid_' + field + '_' + ind).css('display','');
        $('#ID_nm_dados_grid_' + field + '_' + ind).css('display','none');
        nmAjaxProcOff();
    });
}
function ajax_save_ancor(f_submit, ancor)
{
    nmAjaxProcOn();
    $.ajax({
      type: "POST",
      url: "index.php",
      data: "nmgp_opcao=ajax_save_ancor&script_case_init=" + document.F3.script_case_init.value + "&ancor_save=" + ancor
     })
     .done(function(jsonSaveAncor) {
        nmAjaxProcOff();
        eval ("document." + f_submit + ".submit()");
    });
}
var strPath         = '';
var strTitle        = '';
var showAjaxProcess = true;
function ajax_export(tp_export, parms, strCallback, showAjax)
{
    strPath  = '';
    strTitle  = '';
    showAjaxProcess = showAjax;
    if(showAjaxProcess)
    {
        nmAjaxProcOn();
    }
    $.ajax({
      type: "POST",
      url: "index.php",
      data: "nmgp_opcao=ajax_export&export_opc=" + tp_export + parms + "&script_case_init=" + document.F3.script_case_init.value,
      complete: strCallback,
     })
     .done(function(jsonFile) {
        var oResp;
        Tst_integrid = jsonFile.trim();
        if ("{" != Tst_integrid.substr(0, 1)) {
            nmAjaxProcOff();
            alert (jsonFile);
            return;
        }
        eval("oResp = " + jsonFile);
        if (oResp["ss_time_out"]) {
            nmAjaxProcOff();
            nm_move();
        }
        if (oResp["htmOutput"]) {
           nmAjaxShowDebug(oResp);
        }
        if (oResp["file_export"]) {
            strPath = oResp['file_export'];
            strTitle = oResp['title_export'];
        }
        if(showAjaxProcess)
        {
            nmAjaxProcOff();
        }
    });
}

