
function scJQGeneralAdd() {
  scLoadScInput('input:text.sc-js-input');
  scLoadScInput('input:password.sc-js-input');
  scLoadScInput('input:checkbox.sc-js-input');
  scLoadScInput('input:radio.sc-js-input');
  scLoadScInput('select.sc-js-input');
  scLoadScInput('textarea.sc-js-input');

} // scJQGeneralAdd

function scFocusField(sField) {
  var $oField = $('#id_sc_field_' + sField);

  if (0 == $oField.length) {
    $oField = $('input[name=' + sField + ']');
  }

  if (0 == $oField.length && document.F1.elements[sField]) {
    $oField = $(document.F1.elements[sField]);
  }

  if ($("#id_ac_" + sField).length > 0) {
    if ($oField.hasClass("select2-hidden-accessible")) {
      if (false == scSetFocusOnField($oField, sField)) {
        setTimeout(function() { scSetFocusOnField($oField, sField); }, 500);
      }
    }
    else {
      if (false == scSetFocusOnField($oField, sField)) {
        if (false == scSetFocusOnField($("#id_ac_" + sField, sField))) {
          setTimeout(function() { scSetFocusOnField($("#id_ac_" + sField, sField)); }, 500);
        }
      }
      else {
        setTimeout(function() { scSetFocusOnField($oField, sField); }, 500);
      }
    }
  }
  else {
    setTimeout(function() { scSetFocusOnField($oField, sField); }, 500);
  }
} // scFocusField

function scSetFocusOnField($oField, sField) {
  if ($oField.length > 0 && $oField[0].offsetHeight > 0 && $oField[0].offsetWidth > 0 && !$oField[0].disabled) {
     if (sField == 'nacionalidad') {
        $oField.select2('open');
     }
     else {
        $oField[0].focus();
     }
    return true;
  }
  return false;
} // scSetFocusOnField

function scEventControl_init(iSeqRow) {
  scEventControl_data["titulo" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["fecha" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["cedula" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["periodo" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["predio" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["celular_personal" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["celular_empresa" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["telefono_emergencia1" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["nombre_persona_emergencia1" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["parentesco1" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["telefono_emergencia2" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["nombre_persona_emergencia2" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["parentesco2" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["direccion" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["provincia" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["canton" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["distrito" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["correo_electronico" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["fecha_nacimiento" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["estado_civil" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["sexo" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["nacionalidad" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["talla_camisa" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["talla_zapatos" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["nucle" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["enfermedadescronicas" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["otras_enfermedades" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["yaestaregistrado" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["firma2" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["acepta_terminos" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["firma" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
  scEventControl_data["id" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""};
}

function scEventControl_active(iSeqRow) {
  if (scEventControl_data["titulo" + iSeqRow] && scEventControl_data["titulo" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["titulo" + iSeqRow] && scEventControl_data["titulo" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["fecha" + iSeqRow] && scEventControl_data["fecha" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["fecha" + iSeqRow] && scEventControl_data["fecha" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["cedula" + iSeqRow] && scEventControl_data["cedula" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["cedula" + iSeqRow] && scEventControl_data["cedula" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["periodo" + iSeqRow] && scEventControl_data["periodo" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["periodo" + iSeqRow] && scEventControl_data["periodo" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["predio" + iSeqRow] && scEventControl_data["predio" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["predio" + iSeqRow] && scEventControl_data["predio" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["celular_personal" + iSeqRow] && scEventControl_data["celular_personal" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["celular_personal" + iSeqRow] && scEventControl_data["celular_personal" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["celular_empresa" + iSeqRow] && scEventControl_data["celular_empresa" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["celular_empresa" + iSeqRow] && scEventControl_data["celular_empresa" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["telefono_emergencia1" + iSeqRow] && scEventControl_data["telefono_emergencia1" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["telefono_emergencia1" + iSeqRow] && scEventControl_data["telefono_emergencia1" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["nombre_persona_emergencia1" + iSeqRow] && scEventControl_data["nombre_persona_emergencia1" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["nombre_persona_emergencia1" + iSeqRow] && scEventControl_data["nombre_persona_emergencia1" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["parentesco1" + iSeqRow] && scEventControl_data["parentesco1" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["parentesco1" + iSeqRow] && scEventControl_data["parentesco1" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["telefono_emergencia2" + iSeqRow] && scEventControl_data["telefono_emergencia2" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["telefono_emergencia2" + iSeqRow] && scEventControl_data["telefono_emergencia2" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["nombre_persona_emergencia2" + iSeqRow] && scEventControl_data["nombre_persona_emergencia2" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["nombre_persona_emergencia2" + iSeqRow] && scEventControl_data["nombre_persona_emergencia2" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["parentesco2" + iSeqRow] && scEventControl_data["parentesco2" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["parentesco2" + iSeqRow] && scEventControl_data["parentesco2" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["direccion" + iSeqRow] && scEventControl_data["direccion" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["direccion" + iSeqRow] && scEventControl_data["direccion" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["provincia" + iSeqRow] && scEventControl_data["provincia" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["provincia" + iSeqRow] && scEventControl_data["provincia" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["canton" + iSeqRow] && scEventControl_data["canton" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["canton" + iSeqRow] && scEventControl_data["canton" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["distrito" + iSeqRow] && scEventControl_data["distrito" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["distrito" + iSeqRow] && scEventControl_data["distrito" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["correo_electronico" + iSeqRow] && scEventControl_data["correo_electronico" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["correo_electronico" + iSeqRow] && scEventControl_data["correo_electronico" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["fecha_nacimiento" + iSeqRow] && scEventControl_data["fecha_nacimiento" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["fecha_nacimiento" + iSeqRow] && scEventControl_data["fecha_nacimiento" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["estado_civil" + iSeqRow] && scEventControl_data["estado_civil" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["estado_civil" + iSeqRow] && scEventControl_data["estado_civil" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["sexo" + iSeqRow] && scEventControl_data["sexo" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["sexo" + iSeqRow] && scEventControl_data["sexo" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["nacionalidad" + iSeqRow] && scEventControl_data["nacionalidad" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["nacionalidad" + iSeqRow] && scEventControl_data["nacionalidad" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["talla_camisa" + iSeqRow] && scEventControl_data["talla_camisa" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["talla_camisa" + iSeqRow] && scEventControl_data["talla_camisa" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["talla_zapatos" + iSeqRow] && scEventControl_data["talla_zapatos" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["talla_zapatos" + iSeqRow] && scEventControl_data["talla_zapatos" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["nucle" + iSeqRow] && scEventControl_data["nucle" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["nucle" + iSeqRow] && scEventControl_data["nucle" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["enfermedadescronicas" + iSeqRow] && scEventControl_data["enfermedadescronicas" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["enfermedadescronicas" + iSeqRow] && scEventControl_data["enfermedadescronicas" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["otras_enfermedades" + iSeqRow] && scEventControl_data["otras_enfermedades" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["otras_enfermedades" + iSeqRow] && scEventControl_data["otras_enfermedades" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["yaestaregistrado" + iSeqRow] && scEventControl_data["yaestaregistrado" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["yaestaregistrado" + iSeqRow] && scEventControl_data["yaestaregistrado" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["firma2" + iSeqRow] && scEventControl_data["firma2" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["firma2" + iSeqRow] && scEventControl_data["firma2" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["acepta_terminos" + iSeqRow] && scEventControl_data["acepta_terminos" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["acepta_terminos" + iSeqRow] && scEventControl_data["acepta_terminos" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["firma" + iSeqRow] && scEventControl_data["firma" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["firma" + iSeqRow] && scEventControl_data["firma" + iSeqRow]["change"]) {
    return true;
  }
  if (scEventControl_data["id" + iSeqRow] && scEventControl_data["id" + iSeqRow]["blur"]) {
    return true;
  }
  if (scEventControl_data["id" + iSeqRow] && scEventControl_data["id" + iSeqRow]["change"]) {
    return true;
  }
  return false;
} // scEventControl_active

function scEventControl_onFocus(oField, iSeq) {
  var fieldId, fieldName;
  fieldId = $(oField).attr("id");
  fieldName = fieldId.substr(12);
  scEventControl_data[fieldName]["blur"] = true;
  if ("periodo" + iSeq == fieldName) {
    scEventControl_data[fieldName]["blur"] = false;
  }
  if ("predio" + iSeq == fieldName) {
    scEventControl_data[fieldName]["blur"] = false;
  }
  if ("parentesco1" + iSeq == fieldName) {
    scEventControl_data[fieldName]["blur"] = false;
  }
  if ("parentesco2" + iSeq == fieldName) {
    scEventControl_data[fieldName]["blur"] = false;
  }
  if ("provincia" + iSeq == fieldName) {
    scEventControl_data[fieldName]["blur"] = false;
  }
  if ("canton" + iSeq == fieldName) {
    scEventControl_data[fieldName]["blur"] = false;
  }
  if ("distrito" + iSeq == fieldName) {
    scEventControl_data[fieldName]["blur"] = false;
  }
  if ("estado_civil" + iSeq == fieldName) {
    scEventControl_data[fieldName]["blur"] = false;
  }
  if ("sexo" + iSeq == fieldName) {
    scEventControl_data[fieldName]["blur"] = false;
  }
  if ("nacionalidad" + iSeq == fieldName) {
    scEventControl_data[fieldName]["blur"] = false;
  }
  if ("acepta_terminos" + iSeq == fieldName) {
    scEventControl_data[fieldName]["change"]   = true;
    scEventControl_data[fieldName]["original"] = $(oField).val();
    scEventControl_data[fieldName]["calculated"] = $(oField).val();
    return;
  }
  if ("firma" + iSeq == fieldName) {
    scEventControl_data[fieldName]["change"]   = true;
    scEventControl_data[fieldName]["original"] = $(oField).val();
    scEventControl_data[fieldName]["calculated"] = $(oField).val();
    return;
  }
  scEventControl_data[fieldName]["change"] = false;
} // scEventControl_onFocus

function scEventControl_onBlur(sFieldName) {
  scEventControl_data[sFieldName]["blur"] = false;
  if (scEventControl_data[sFieldName]["change"]) {
        if (scEventControl_data[sFieldName]["original"] == $("#id_sc_field_" + sFieldName).val() || scEventControl_data[sFieldName]["calculated"] == $("#id_sc_field_" + sFieldName).val()) {
          scEventControl_data[sFieldName]["change"] = false;
        }
  }
} // scEventControl_onBlur

function scEventControl_onChange(sFieldName) {
  scEventControl_data[sFieldName]["change"] = false;
} // scEventControl_onChange

function scEventControl_onAutocomp(sFieldName) {
  scEventControl_data[sFieldName]["autocomp"] = false;
} // scEventControl_onChange

var scEventControl_data = {};

function scJQEventsAdd(iSeqRow) {
  $('#id_sc_field_id' + iSeqRow).bind('blur', function() { sc_form_pla_actualizacion_de_datos_id_onblur('#id_sc_field_id' + iSeqRow, iSeqRow, event) })
                                .bind('focus', function() { sc_form_pla_actualizacion_de_datos_id_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_fecha' + iSeqRow).bind('blur', function() { sc_form_pla_actualizacion_de_datos_fecha_onblur('#id_sc_field_fecha' + iSeqRow, iSeqRow, event) })
                                   .bind('focus', function() { sc_form_pla_actualizacion_de_datos_fecha_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_fecha_hora' + iSeqRow).bind('blur', function() { sc_form_pla_actualizacion_de_datos_fecha_onblur('#id_sc_field_fecha' + iSeqRow, iSeqRow, event) })
                                        .bind('focus', function() { sc_form_pla_actualizacion_de_datos_fecha_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_cedula' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_cedula_onblur('#id_sc_field_cedula' + iSeqRow, iSeqRow, event);}, 300) })
                                    .bind('change', function() { sc_form_pla_actualizacion_de_datos_cedula_onchange(this, iSeqRow, event) })
                                    .bind('focus', function() { sc_form_pla_actualizacion_de_datos_cedula_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_periodo' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_periodo_onblur('#id_sc_field_periodo' + iSeqRow, iSeqRow, event);}, 300) })
                                     .bind('focus', function() { sc_form_pla_actualizacion_de_datos_periodo_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_predio' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_predio_onblur('#id_sc_field_predio' + iSeqRow, iSeqRow, event);}, 300) })
                                    .bind('focus', function() { sc_form_pla_actualizacion_de_datos_predio_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_celular_personal' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_celular_personal_onblur('#id_sc_field_celular_personal' + iSeqRow, iSeqRow, event);}, 300) })
                                              .bind('focus', function() { sc_form_pla_actualizacion_de_datos_celular_personal_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_celular_empresa' + iSeqRow).bind('blur', function() { sc_form_pla_actualizacion_de_datos_celular_empresa_onblur('#id_sc_field_celular_empresa' + iSeqRow, iSeqRow, event) })
                                             .bind('focus', function() { sc_form_pla_actualizacion_de_datos_celular_empresa_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_telefono_emergencia1' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_telefono_emergencia1_onblur('#id_sc_field_telefono_emergencia1' + iSeqRow, iSeqRow, event);}, 300) })
                                                  .bind('focus', function() { sc_form_pla_actualizacion_de_datos_telefono_emergencia1_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_telefono_emergencia2' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_telefono_emergencia2_onblur('#id_sc_field_telefono_emergencia2' + iSeqRow, iSeqRow, event);}, 300) })
                                                  .bind('focus', function() { sc_form_pla_actualizacion_de_datos_telefono_emergencia2_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_nombre_persona_emergencia1' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_nombre_persona_emergencia1_onblur('#id_sc_field_nombre_persona_emergencia1' + iSeqRow, iSeqRow, event);}, 300) })
                                                        .bind('focus', function() { sc_form_pla_actualizacion_de_datos_nombre_persona_emergencia1_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_parentesco1' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_parentesco1_onblur('#id_sc_field_parentesco1' + iSeqRow, iSeqRow, event);}, 300) })
                                         .bind('focus', function() { sc_form_pla_actualizacion_de_datos_parentesco1_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_nombre_persona_emergencia2' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_nombre_persona_emergencia2_onblur('#id_sc_field_nombre_persona_emergencia2' + iSeqRow, iSeqRow, event);}, 300) })
                                                        .bind('focus', function() { sc_form_pla_actualizacion_de_datos_nombre_persona_emergencia2_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_parentesco2' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_parentesco2_onblur('#id_sc_field_parentesco2' + iSeqRow, iSeqRow, event);}, 300) })
                                         .bind('focus', function() { sc_form_pla_actualizacion_de_datos_parentesco2_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_direccion' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_direccion_onblur('#id_sc_field_direccion' + iSeqRow, iSeqRow, event);}, 300) })
                                       .bind('focus', function() { sc_form_pla_actualizacion_de_datos_direccion_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_correo_electronico' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_correo_electronico_onblur('#id_sc_field_correo_electronico' + iSeqRow, iSeqRow, event);}, 300) })
                                                .bind('focus', function() { sc_form_pla_actualizacion_de_datos_correo_electronico_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_fecha_nacimiento' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_fecha_nacimiento_onblur('#id_sc_field_fecha_nacimiento' + iSeqRow, iSeqRow, event);}, 300) })
                                              .bind('focus', function() { sc_form_pla_actualizacion_de_datos_fecha_nacimiento_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_estado_civil' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_estado_civil_onblur('#id_sc_field_estado_civil' + iSeqRow, iSeqRow, event);}, 300) })
                                          .bind('focus', function() { sc_form_pla_actualizacion_de_datos_estado_civil_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_sexo' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_sexo_onblur('#id_sc_field_sexo' + iSeqRow, iSeqRow, event);}, 300) })
                                  .bind('focus', function() { sc_form_pla_actualizacion_de_datos_sexo_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_nacionalidad' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_nacionalidad_onblur('#id_sc_field_nacionalidad' + iSeqRow, iSeqRow, event);}, 300) })
                                          .bind('focus', function() { sc_form_pla_actualizacion_de_datos_nacionalidad_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_talla_camisa' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_talla_camisa_onblur('#id_sc_field_talla_camisa' + iSeqRow, iSeqRow, event);}, 300) })
                                          .bind('focus', function() { sc_form_pla_actualizacion_de_datos_talla_camisa_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_talla_zapatos' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_talla_zapatos_onblur('#id_sc_field_talla_zapatos' + iSeqRow, iSeqRow, event);}, 300) })
                                           .bind('focus', function() { sc_form_pla_actualizacion_de_datos_talla_zapatos_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_acepta_terminos' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_acepta_terminos_onblur('#id_sc_field_acepta_terminos' + iSeqRow, iSeqRow, event);}, 300) })
                                             .bind('change', function() { sc_form_pla_actualizacion_de_datos_acepta_terminos_onchange(this, iSeqRow, event) })
                                             .bind('click', function() { sc_form_pla_actualizacion_de_datos_acepta_terminos_onclick(this, iSeqRow, event) })
                                             .bind('focus', function() { sc_form_pla_actualizacion_de_datos_acepta_terminos_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_firma' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_firma_onblur('#id_sc_field_firma' + iSeqRow, iSeqRow, event);}, 300) })
                                   .bind('change', function() { sc_form_pla_actualizacion_de_datos_firma_onchange(this, iSeqRow, event) })
                                   .bind('focus', function() { sc_form_pla_actualizacion_de_datos_firma_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_provincia' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_provincia_onblur('#id_sc_field_provincia' + iSeqRow, iSeqRow, event);}, 300) })
                                       .bind('change', function() { sc_form_pla_actualizacion_de_datos_provincia_onchange(this, iSeqRow, event) })
                                       .bind('focus', function() { sc_form_pla_actualizacion_de_datos_provincia_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_canton' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_canton_onblur('#id_sc_field_canton' + iSeqRow, iSeqRow, event);}, 300) })
                                    .bind('change', function() { sc_form_pla_actualizacion_de_datos_canton_onchange(this, iSeqRow, event) })
                                    .bind('focus', function() { sc_form_pla_actualizacion_de_datos_canton_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_distrito' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_form_pla_actualizacion_de_datos_distrito_onblur('#id_sc_field_distrito' + iSeqRow, iSeqRow, event);}, 300) })
                                      .bind('focus', function() { sc_form_pla_actualizacion_de_datos_distrito_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_otras_enfermedades' + iSeqRow).bind('blur', function() { sc_form_pla_actualizacion_de_datos_otras_enfermedades_onblur('#id_sc_field_otras_enfermedades' + iSeqRow, iSeqRow, event) })
                                                .bind('focus', function() { sc_form_pla_actualizacion_de_datos_otras_enfermedades_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_enfermedadescronicas' + iSeqRow).bind('blur', function() { sc_form_pla_actualizacion_de_datos_enfermedadescronicas_onblur('#id_sc_field_enfermedadescronicas' + iSeqRow, iSeqRow, event) })
                                                  .bind('focus', function() { sc_form_pla_actualizacion_de_datos_enfermedadescronicas_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_firma2' + iSeqRow).bind('blur', function() { sc_form_pla_actualizacion_de_datos_firma2_onblur('#id_sc_field_firma2' + iSeqRow, iSeqRow, event) })
                                    .bind('focus', function() { sc_form_pla_actualizacion_de_datos_firma2_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_nucle' + iSeqRow).bind('blur', function() { sc_form_pla_actualizacion_de_datos_nucle_onblur('#id_sc_field_nucle' + iSeqRow, iSeqRow, event) })
                                   .bind('focus', function() { sc_form_pla_actualizacion_de_datos_nucle_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_titulo' + iSeqRow).bind('blur', function() { sc_form_pla_actualizacion_de_datos_titulo_onblur('#id_sc_field_titulo' + iSeqRow, iSeqRow, event) })
                                    .bind('focus', function() { sc_form_pla_actualizacion_de_datos_titulo_onfocus(this, iSeqRow, event) });
  $('#id_sc_field_yaestaregistrado' + iSeqRow).bind('blur', function() { sc_form_pla_actualizacion_de_datos_yaestaregistrado_onblur('#id_sc_field_yaestaregistrado' + iSeqRow, iSeqRow, event) })
                                              .bind('focus', function() { sc_form_pla_actualizacion_de_datos_yaestaregistrado_onfocus(this, iSeqRow, event) });
  $('.sc-ui-checkbox-acepta_terminos' + iSeqRow).on('click', function() { scMarkFormAsChanged(); });
} // scJQEventsAdd

Upload_Cancel = false;
function sc_form_pla_actualizacion_de_datos_id_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_id();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_id_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_fecha_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_fecha();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_fecha_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_fecha();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_fecha_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_fecha_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_cedula_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_cedula();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_cedula_onchange(oThis, iSeqRow, event) {
  lookup_cedula();
}

function sc_form_pla_actualizacion_de_datos_cedula_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_periodo_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_periodo();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_periodo_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_predio_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_predio();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_predio_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_celular_personal_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_celular_personal();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_celular_personal_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_celular_empresa_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_celular_empresa();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_celular_empresa_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_telefono_emergencia1_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_telefono_emergencia1();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_telefono_emergencia1_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_telefono_emergencia2_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_telefono_emergencia2();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_telefono_emergencia2_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_nombre_persona_emergencia1_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_nombre_persona_emergencia1();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_nombre_persona_emergencia1_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_parentesco1_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_parentesco1();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_parentesco1_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_nombre_persona_emergencia2_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_nombre_persona_emergencia2();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_nombre_persona_emergencia2_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_parentesco2_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_parentesco2();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_parentesco2_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_direccion_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_direccion();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_direccion_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_correo_electronico_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_correo_electronico();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_correo_electronico_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_fecha_nacimiento_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_fecha_nacimiento();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_fecha_nacimiento_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_estado_civil_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_estado_civil();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_estado_civil_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_sexo_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_sexo();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_sexo_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_nacionalidad_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_nacionalidad();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_nacionalidad_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_talla_camisa_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_talla_camisa();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_talla_camisa_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_talla_zapatos_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_talla_zapatos();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_talla_zapatos_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_acepta_terminos_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_acepta_terminos();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_acepta_terminos_onchange(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_event_acepta_terminos_onchange();
}

function sc_form_pla_actualizacion_de_datos_acepta_terminos_onclick(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_event_acepta_terminos_onclick();
}

function sc_form_pla_actualizacion_de_datos_acepta_terminos_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_firma_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_firma();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_firma_onchange(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_event_firma_onchange();
}

function sc_form_pla_actualizacion_de_datos_firma_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_provincia_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_provincia();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_provincia_onchange(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_refresh_provincia();
}

function sc_form_pla_actualizacion_de_datos_provincia_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_canton_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_canton();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_canton_onchange(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_refresh_canton();
}

function sc_form_pla_actualizacion_de_datos_canton_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_distrito_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_distrito();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_distrito_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_otras_enfermedades_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_otras_enfermedades();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_otras_enfermedades_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_enfermedadescronicas_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_enfermedadescronicas();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_enfermedadescronicas_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_firma2_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_firma2();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_firma2_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_nucle_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_nucle();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_nucle_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_titulo_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_titulo();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_titulo_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function sc_form_pla_actualizacion_de_datos_yaestaregistrado_onblur(oThis, iSeqRow, event) {
  do_ajax_form_pla_actualizacion_de_datos_mob_validate_yaestaregistrado();
  scCssBlur(oThis);
}

function sc_form_pla_actualizacion_de_datos_yaestaregistrado_onfocus(oThis, iSeqRow, event) {
  scEventControl_onFocus(oThis, iSeqRow);
  scCssFocus(oThis);
}

function displayChange_block(block, status) {
        if ("0" == block) {
                displayChange_block_0(status);
        }
        if ("1" == block) {
                displayChange_block_1(status);
        }
        if ("2" == block) {
                displayChange_block_2(status);
        }
        if ("3" == block) {
                displayChange_block_3(status);
        }
        if ("4" == block) {
                displayChange_block_4(status);
        }
        if ("5" == block) {
                displayChange_block_5(status);
        }
        if ("6" == block) {
                displayChange_block_6(status);
        }
        if ("7" == block) {
                displayChange_block_7(status);
        }
}

function displayChange_block_0(status) {
        displayChange_field("titulo", "", status);
}

function displayChange_block_1(status) {
        displayChange_field("fecha", "", status);
        displayChange_field("cedula", "", status);
        displayChange_field("periodo", "", status);
        displayChange_field("predio", "", status);
        displayChange_field("celular_personal", "", status);
        displayChange_field("celular_empresa", "", status);
}

function displayChange_block_2(status) {
        displayChange_field("telefono_emergencia1", "", status);
        displayChange_field("nombre_persona_emergencia1", "", status);
        displayChange_field("parentesco1", "", status);
}

function displayChange_block_3(status) {
        displayChange_field("telefono_emergencia2", "", status);
        displayChange_field("nombre_persona_emergencia2", "", status);
        displayChange_field("parentesco2", "", status);
}

function displayChange_block_4(status) {
        displayChange_field("direccion", "", status);
        displayChange_field("provincia", "", status);
        displayChange_field("canton", "", status);
        displayChange_field("distrito", "", status);
        displayChange_field("correo_electronico", "", status);
        displayChange_field("fecha_nacimiento", "", status);
        displayChange_field("estado_civil", "", status);
        displayChange_field("sexo", "", status);
        displayChange_field("nacionalidad", "", status);
        displayChange_field("talla_camisa", "", status);
        displayChange_field("talla_zapatos", "", status);
}

function displayChange_block_5(status) {
        displayChange_field("nucle", "", status);
}

function displayChange_block_6(status) {
        displayChange_field("enfermedadescronicas", "", status);
        displayChange_field("otras_enfermedades", "", status);
        displayChange_field("yaestaregistrado", "", status);
        displayChange_field("firma2", "", status);
}

function displayChange_block_7(status) {
        displayChange_field("acepta_terminos", "", status);
        displayChange_field("firma", "", status);
        displayChange_field("id", "", status);
}

function displayChange_row(row, status) {
        displayChange_field_titulo(row, status);
        displayChange_field_fecha(row, status);
        displayChange_field_cedula(row, status);
        displayChange_field_periodo(row, status);
        displayChange_field_predio(row, status);
        displayChange_field_celular_personal(row, status);
        displayChange_field_celular_empresa(row, status);
        displayChange_field_telefono_emergencia1(row, status);
        displayChange_field_nombre_persona_emergencia1(row, status);
        displayChange_field_parentesco1(row, status);
        displayChange_field_telefono_emergencia2(row, status);
        displayChange_field_nombre_persona_emergencia2(row, status);
        displayChange_field_parentesco2(row, status);
        displayChange_field_direccion(row, status);
        displayChange_field_provincia(row, status);
        displayChange_field_canton(row, status);
        displayChange_field_distrito(row, status);
        displayChange_field_correo_electronico(row, status);
        displayChange_field_fecha_nacimiento(row, status);
        displayChange_field_estado_civil(row, status);
        displayChange_field_sexo(row, status);
        displayChange_field_nacionalidad(row, status);
        displayChange_field_talla_camisa(row, status);
        displayChange_field_talla_zapatos(row, status);
        displayChange_field_nucle(row, status);
        displayChange_field_enfermedadescronicas(row, status);
        displayChange_field_otras_enfermedades(row, status);
        displayChange_field_yaestaregistrado(row, status);
        displayChange_field_firma2(row, status);
        displayChange_field_acepta_terminos(row, status);
        displayChange_field_firma(row, status);
        displayChange_field_id(row, status);
}

function displayChange_field(field, row, status) {
        if ("titulo" == field) {
                displayChange_field_titulo(row, status);
        }
        if ("fecha" == field) {
                displayChange_field_fecha(row, status);
        }
        if ("cedula" == field) {
                displayChange_field_cedula(row, status);
        }
        if ("periodo" == field) {
                displayChange_field_periodo(row, status);
        }
        if ("predio" == field) {
                displayChange_field_predio(row, status);
        }
        if ("celular_personal" == field) {
                displayChange_field_celular_personal(row, status);
        }
        if ("celular_empresa" == field) {
                displayChange_field_celular_empresa(row, status);
        }
        if ("telefono_emergencia1" == field) {
                displayChange_field_telefono_emergencia1(row, status);
        }
        if ("nombre_persona_emergencia1" == field) {
                displayChange_field_nombre_persona_emergencia1(row, status);
        }
        if ("parentesco1" == field) {
                displayChange_field_parentesco1(row, status);
        }
        if ("telefono_emergencia2" == field) {
                displayChange_field_telefono_emergencia2(row, status);
        }
        if ("nombre_persona_emergencia2" == field) {
                displayChange_field_nombre_persona_emergencia2(row, status);
        }
        if ("parentesco2" == field) {
                displayChange_field_parentesco2(row, status);
        }
        if ("direccion" == field) {
                displayChange_field_direccion(row, status);
        }
        if ("provincia" == field) {
                displayChange_field_provincia(row, status);
        }
        if ("canton" == field) {
                displayChange_field_canton(row, status);
        }
        if ("distrito" == field) {
                displayChange_field_distrito(row, status);
        }
        if ("correo_electronico" == field) {
                displayChange_field_correo_electronico(row, status);
        }
        if ("fecha_nacimiento" == field) {
                displayChange_field_fecha_nacimiento(row, status);
        }
        if ("estado_civil" == field) {
                displayChange_field_estado_civil(row, status);
        }
        if ("sexo" == field) {
                displayChange_field_sexo(row, status);
        }
        if ("nacionalidad" == field) {
                displayChange_field_nacionalidad(row, status);
        }
        if ("talla_camisa" == field) {
                displayChange_field_talla_camisa(row, status);
        }
        if ("talla_zapatos" == field) {
                displayChange_field_talla_zapatos(row, status);
        }
        if ("nucle" == field) {
                displayChange_field_nucle(row, status);
        }
        if ("enfermedadescronicas" == field) {
                displayChange_field_enfermedadescronicas(row, status);
        }
        if ("otras_enfermedades" == field) {
                displayChange_field_otras_enfermedades(row, status);
        }
        if ("yaestaregistrado" == field) {
                displayChange_field_yaestaregistrado(row, status);
        }
        if ("firma2" == field) {
                displayChange_field_firma2(row, status);
        }
        if ("acepta_terminos" == field) {
                displayChange_field_acepta_terminos(row, status);
        }
        if ("firma" == field) {
                displayChange_field_firma(row, status);
        }
        if ("id" == field) {
                displayChange_field_id(row, status);
        }
}

function displayChange_field_titulo(row, status) {
    var fieldId;
}

function displayChange_field_fecha(row, status) {
    var fieldId;
}

function displayChange_field_cedula(row, status) {
    var fieldId;
}

function displayChange_field_periodo(row, status) {
    var fieldId;
}

function displayChange_field_predio(row, status) {
    var fieldId;
}

function displayChange_field_celular_personal(row, status) {
    var fieldId;
}

function displayChange_field_celular_empresa(row, status) {
    var fieldId;
}

function displayChange_field_telefono_emergencia1(row, status) {
    var fieldId;
}

function displayChange_field_nombre_persona_emergencia1(row, status) {
    var fieldId;
}

function displayChange_field_parentesco1(row, status) {
    var fieldId;
}

function displayChange_field_telefono_emergencia2(row, status) {
    var fieldId;
}

function displayChange_field_nombre_persona_emergencia2(row, status) {
    var fieldId;
}

function displayChange_field_parentesco2(row, status) {
    var fieldId;
}

function displayChange_field_direccion(row, status) {
    var fieldId;
}

function displayChange_field_provincia(row, status) {
    var fieldId;
}

function displayChange_field_canton(row, status) {
    var fieldId;
}

function displayChange_field_distrito(row, status) {
    var fieldId;
}

function displayChange_field_correo_electronico(row, status) {
    var fieldId;
}

function displayChange_field_fecha_nacimiento(row, status) {
    var fieldId;
}

function displayChange_field_estado_civil(row, status) {
    var fieldId;
}

function displayChange_field_sexo(row, status) {
    var fieldId;
}

function displayChange_field_nacionalidad(row, status) {
    var fieldId;
        if ("on" == status) {
                Ctrl_Disabled = false;
                if ("all" == row) {
                        var fieldList = $(".css_nacionalidad__obj");
                        for (var i = 0; i < fieldList.length; i++) {
                                $($(fieldList[i]).attr("id")).select2("destroy");
                        }
                }
                else {
                        if ($('#select2-id_sc_field_nacionalidad' + row + '-container').hasClass('scFormInputDisabled')) {
                            Ctrl_Disabled = true;
                        }

                        $("#id_sc_field_nacionalidad" + row).select2("destroy");
                }
                scJQSelect2Add(row, "nacionalidad");
                if (Ctrl_Disabled) {
                   $('#select2-id_sc_field_nacionalidad' + row + '-container').addClass('scFormInputDisabled')
                }
        }
}

function displayChange_field_talla_camisa(row, status) {
    var fieldId;
}

function displayChange_field_talla_zapatos(row, status) {
    var fieldId;
}

function displayChange_field_nucle(row, status) {
    var fieldId;
        if ("on" == status && typeof $("#nmsc_iframe_liga_form_pla_actualizacion_de_datos_nucleo_mob")[0].contentWindow.scRecreateSelect2 === "function") {
                $("#nmsc_iframe_liga_form_pla_actualizacion_de_datos_nucleo_mob")[0].contentWindow.scRecreateSelect2();
        }
        $("#nmsc_iframe_liga_form_pla_actualizacion_de_datos_nucleo_mob")[0].contentWindow.specificStyle();
}

function displayChange_field_enfermedadescronicas(row, status) {
    var fieldId;
}

function displayChange_field_otras_enfermedades(row, status) {
    var fieldId;
}

function displayChange_field_yaestaregistrado(row, status) {
    var fieldId;
}

function displayChange_field_firma2(row, status) {
    var fieldId;
}

function displayChange_field_acepta_terminos(row, status) {
    var fieldId;
}

function displayChange_field_firma(row, status) {
    var fieldId;
}

function displayChange_field_id(row, status) {
    var fieldId;
}

function scRecreateSelect2() {
        displayChange_field_nacionalidad("all", "on");
}
function scResetPagesDisplay() {
        $(".sc-form-page").show();
}

function scHidePage(pageNo) {
        $("#id_form_pla_actualizacion_de_datos_mob_form" + pageNo).hide();
}

function scCheckNoPageSelected() {
        if (!$(".sc-form-page").filter(".scTabActive").filter(":visible").length) {
                var inactiveTabs = $(".sc-form-page").filter(".scTabInactive").filter(":visible");
                if (inactiveTabs.length) {
                        var tabNo = $(inactiveTabs[0]).attr("id").substr(46);
                }
        }
}
var sc_jq_calendar_value = {};

function scJQCalendarAdd(iSeqRow) {
  $("#id_sc_field_fecha" + iSeqRow).datepicker('destroy');
  $("#id_sc_field_fecha" + iSeqRow).datepicker({
    beforeShow: function(input, inst) {
      var $oField = $(this),
          aParts  = $oField.val().split(" "),
          sTime   = "";
      sc_jq_calendar_value["#id_sc_field_fecha" + iSeqRow] = $oField.val();
      if (2 == aParts.length) {
        sTime = " " + aParts[1];
      }
      if ('' == sTime || ' ' == sTime) {
        sTime = ' <?php echo $this->jqueryCalendarTimeStart($this->field_config['fecha']['date_format'], 'start'); ?>';
      }
      $oField.datepicker("option", "dateFormat", "<?php echo $this->jqueryCalendarDtFormat("" . str_replace(array('/', 'aaaa', 'hh', 'ii', 'ss', ':', ';', $_SESSION['scriptcase']['reg_conf']['date_sep'], $_SESSION['scriptcase']['reg_conf']['time_sep']), array('', 'yyyy', '','','', '', '', '', ''), $this->field_config['fecha']['date_format']) . "", "" . $_SESSION['scriptcase']['reg_conf']['date_sep'] . ""); ?>" + sTime)
<?php
if ('' != $miniCalendarFA) {
?>
    .next('button').append("<?php echo $miniCalendarFA; ?>")
<?php
}
elseif ('' != $miniCalendarButton[0]) {
?>
    .next('button').append("<?php echo $miniCalendarButton[0]; ?>")
<?php
}
?>
    },
    onClose: function(dateText, inst) {
      do_ajax_form_pla_actualizacion_de_datos_mob_validate_fecha(iSeqRow);
    },
    showWeek: true,
    numberOfMonths: 1,
    changeMonth: true,
    changeYear: true,
    yearRange: 'c-5:c+5',
    dayNames: ["<?php        echo html_entity_decode($this->Ini->Nm_lang['lang_days_sund'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_mond'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_tued'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_wend'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_thud'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_frid'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_satd'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>"],
    dayNamesMin: ["<?php     echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_sund'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_mond'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_tued'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_wend'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_thud'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_frid'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_satd'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>"],
    monthNames: ["<?php      echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_janu"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_febr"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_marc"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_apri"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_mayy"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_june"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_july"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_augu"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_sept"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_octo"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_nove"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_dece"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>"],
    monthNamesShort: ["<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_janu'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_febr'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_marc'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_apri'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_mayy'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_june'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_july'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_augu'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_sept'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_octo'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_nove'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_dece'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>"],
    weekHeader: "<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_days_sem'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>",
    firstDay: <?php echo $this->jqueryCalendarWeekInit("" . $_SESSION['scriptcase']['reg_conf']['date_week_ini'] . ""); ?>,
    dateFormat: "<?php echo $this->jqueryCalendarDtFormat("" . str_replace(array('/', 'aaaa', 'hh', 'ii', 'ss', ':', ';', $_SESSION['scriptcase']['reg_conf']['date_sep'], $_SESSION['scriptcase']['reg_conf']['time_sep']), array('', 'yyyy', '','','', '', '', '', ''), $this->field_config['fecha']['date_format']) . "", "" . $_SESSION['scriptcase']['reg_conf']['date_sep'] . ""); ?>",
    showOtherMonths: true,
    showOn: "button",
<?php
$miniCalendarIcon   = $this->jqueryIconFile('calendar');
$miniCalendarFA     = $this->jqueryFAFile('calendar');
$miniCalendarButton = $this->jqueryButtonText('calendar');
if ('' != $miniCalendarIcon) {
?>
    buttonImage: "<?php echo $miniCalendarIcon; ?>",
    buttonImageOnly: true,
<?php
}
elseif ('' != $miniCalendarFA) {
?>
    buttonText: "",
<?php
}
elseif ('' != $miniCalendarButton[0]) {
?>
    buttonText: "",
<?php
}
?>
    currentText: "<?php  echo html_entity_decode($this->Ini->Nm_lang["lang_per_today"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);       ?>",
    closeText: "<?php  echo html_entity_decode($this->Ini->Nm_lang["lang_btns_mess_clse"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);       ?>",
  })
<?php
if ('' != $miniCalendarFA) {
?>
    .next('button').append("<?php echo $miniCalendarFA; ?>")
<?php
}
elseif ('' != $miniCalendarButton[0]) {
?>
    .next('button').append("<?php echo $miniCalendarButton[0]; ?>")
<?php
}
?>
  $("#id_sc_field_fecha_nacimiento" + iSeqRow).datepicker('destroy');
  $("#id_sc_field_fecha_nacimiento" + iSeqRow).datepicker({
    beforeShow: function(input, inst) {
      var $oField = $(this),
          aParts  = $oField.val().split(" "),
          sTime   = "";
      sc_jq_calendar_value["#id_sc_field_fecha_nacimiento" + iSeqRow] = $oField.val();
    },
    onClose: function(dateText, inst) {
      setTimeout(function() { do_ajax_form_pla_actualizacion_de_datos_mob_validate_fecha_nacimiento(iSeqRow); }, 200);
    },
    showWeek: true,
    numberOfMonths: 1,
    changeMonth: true,
    changeYear: true,
    yearRange: 'c-5:c+5',
    dayNames: ["<?php        echo html_entity_decode($this->Ini->Nm_lang['lang_days_sund'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_mond'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_tued'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_wend'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_thud'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_frid'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_days_satd'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);        ?>"],
    dayNamesMin: ["<?php     echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_sund'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_mond'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_tued'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_wend'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_thud'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_frid'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_substr_days_satd'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>"],
    monthNames: ["<?php      echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_janu"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_febr"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_marc"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_apri"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_mayy"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_june"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_july"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_augu"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_sept"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_octo"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_nove"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>","<?php echo html_entity_decode($this->Ini->Nm_lang["lang_mnth_dece"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);      ?>"],
    monthNamesShort: ["<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_janu'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_febr'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_marc'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_apri'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_mayy'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_june'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_july'], ENT_COMPAT, $_SESSION['scriptcase']['charset']);   ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_augu'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_sept'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_octo'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_nove'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>","<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_mnth_dece'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>"],
    weekHeader: "<?php echo html_entity_decode($this->Ini->Nm_lang['lang_shrt_days_sem'], ENT_COMPAT, $_SESSION['scriptcase']['charset']); ?>",
    firstDay: <?php echo $this->jqueryCalendarWeekInit("" . $_SESSION['scriptcase']['reg_conf']['date_week_ini'] . ""); ?>,
    dateFormat: "<?php echo $this->jqueryCalendarDtFormat("" . str_replace(array('/', 'aaaa', $_SESSION['scriptcase']['reg_conf']['date_sep']), array('', 'yyyy', ''), $this->field_config['fecha_nacimiento']['date_format']) . "", "" . $_SESSION['scriptcase']['reg_conf']['date_sep'] . ""); ?>",
    showOtherMonths: true,
    showOn: "button",
<?php
$miniCalendarIcon   = $this->jqueryIconFile('calendar');
$miniCalendarFA     = $this->jqueryFAFile('calendar');
$miniCalendarButton = $this->jqueryButtonText('calendar');
if ('' != $miniCalendarIcon) {
?>
    buttonImage: "<?php echo $miniCalendarIcon; ?>",
    buttonImageOnly: true,
<?php
}
elseif ('' != $miniCalendarFA) {
?>
    buttonText: "",
<?php
}
elseif ('' != $miniCalendarButton[0]) {
?>
    buttonText: "",
<?php
}
?>
    currentText: "<?php  echo html_entity_decode($this->Ini->Nm_lang["lang_per_today"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);       ?>",
    closeText: "<?php  echo html_entity_decode($this->Ini->Nm_lang["lang_btns_mess_clse"], ENT_COMPAT, $_SESSION["scriptcase"]["charset"]);       ?>",
  })
<?php
if ('' != $miniCalendarFA) {
?>
    .next('button').append("<?php echo $miniCalendarFA; ?>")
<?php
}
elseif ('' != $miniCalendarButton[0]) {
?>
    .next('button').append("<?php echo $miniCalendarButton[0]; ?>")
<?php
}
?>
} // scJQCalendarAdd

function scJQUploadAdd(iSeqRow) {
} // scJQUploadAdd

var api_cache_requests = [];
function ajax_check_file(img_name, field  ,t, p, p_cache, iSeqRow, hasRun, img_before){
    setTimeout(function(){
        if(img_name == '') return;
        iSeqRow= iSeqRow !== undefined && iSeqRow !== null ? iSeqRow : '';
        var hasVar = p.indexOf('_@NM@_') > -1 || p_cache.indexOf('_@NM@_') > -1 ? true : false;

        p = p.split('_@NM@_');
        $.each(p, function(i,v){
            try{
                p[i] = $('[name='+v+iSeqRow+']').val();
            }
            catch(err){
                p[i] = v;
            }
        });
        p = p.join('');

        p_cache = p_cache.split('_@NM@_');
        $.each(p_cache, function(i,v){
            try{
                p_cache[i] = $('[name='+v+iSeqRow+']').val();
            }
            catch(err){
                p_cache[i] = v;
            }
        });
        p_cache = p_cache.join('');

        img_before = img_before !== undefined ? img_before : $(t).attr('src');
        var str_key_cache = '<?php echo $this->Ini->sc_page; ?>' + img_name+field+p+p_cache;
        if(api_cache_requests[ str_key_cache ] !== undefined && api_cache_requests[ str_key_cache ] !== null){
            if(api_cache_requests[ str_key_cache ] != false){
                do_ajax_check_file(api_cache_requests[ str_key_cache ], field  ,t, iSeqRow);
            }
            return;
        }
        //scAjaxProcOn();
        $(t).attr('src', '<?php echo $this->Ini->path_icones ?>/scriptcase__NM__ajax_load.gif');
        api_cache_requests[ str_key_cache ] = false;
        var rs =$.ajax({
                    type: "POST",
                    url: 'index.php?script_case_init=<?php echo $this->Ini->sc_page; ?>',
                    async: true,
                    data:'nmgp_opcao=ajax_check_file&AjaxCheckImg=' + encodeURI(img_name) +'&rsargs='+ field + '&p=' + p + '&p_cache=' + p_cache,
                    success: function (rs) {
                        if(rs.indexOf('</span>') != -1){
                            rs = rs.substr(rs.indexOf('</span>') + 7);
                        }
                        if(rs.indexOf('/') != -1 && rs.indexOf('/') != 0){
                            rs = rs.substr(rs.indexOf('/'));
                        }
                        rs = sc_trim(rs);

                        // if(rs == 0 && hasVar && hasRun === undefined){
                        //     delete window.api_cache_requests[ str_key_cache ];
                        //     ajax_check_file(img_name, field  ,t, p, p_cache, iSeqRow, 1, img_before);
                        //     return;
                        // }
                        window.api_cache_requests[ str_key_cache ] = rs;
                        do_ajax_check_file(rs, field  ,t, iSeqRow)
                        if(rs == 0){
                            delete window.api_cache_requests[ str_key_cache ];

                           // $(t).attr('src',img_before);
                            do_ajax_check_file(img_before+'_@@NM@@_' + img_before, field  ,t, iSeqRow)

                        }


                    }
        });
    },100);
}

function do_ajax_check_file(rs, field  ,t, iSeqRow){
    if (rs != 0) {
        rs_split = rs.split('_@@NM@@_');
        rs_orig = rs_split[0];
        rs2 = rs_split[1];
        try{
            if(!$(t).is('img')){

                if($('#id_read_on_'+field+iSeqRow).length > 0 ){
                                    var usa_read_only = false;

                switch(field){

                }
                     if(usa_read_only && $('a',$('#id_read_on_'+field+iSeqRow)).length == 0){
                         $(t).html("<a href=\"javascript:nm_mostra_doc('0', '"+rs2+"', 'form_pla_actualizacion_de_datos_mob')\">"+$('#id_read_on_'+field+iSeqRow).text()+"</a>");
                     }
                }
                if($('#id_ajax_doc_'+field+iSeqRow+' a').length > 0){
                    var target = $('#id_ajax_doc_'+field+iSeqRow+' a').attr('href').split(',');
                    target[1] = "'"+rs2+"'";
                    $('#id_ajax_doc_'+field+iSeqRow+' a').attr('href', target.join(','));
                }else{
                    var target = $(t).attr('href').split(',');
                     target[1] = "'"+rs2+"'";
                     $(t).attr('href', target.join(','));
                }
            }else{
                $(t).attr('src', rs2);
                $(t).css('display', '');
                if($('#id_ajax_doc_'+field+iSeqRow+' a').length > 0){
                    var target = $('#id_ajax_doc_'+field+iSeqRow+' a').attr('href').split(',');
                    target[1] = "'"+rs2+"'";
                    $(t).attr('href', target.join(','));
                }else{
                     var t_link = $(t).parent('a');
                     var target = $(t_link).attr('href').split(',');
                     target[0] = "javascript:nm_mostra_img('"+rs_orig+"'";
                     $(t_link).attr('href', target.join(','));
                }

            }
            eval("window.var_ajax_img_"+field+iSeqRow+" = '"+rs_orig+"';");

        } catch(err){
                        eval("window.var_ajax_img_"+field+iSeqRow+" = '"+rs_orig+"';");

        }
    }
   /* hasFalseCacheRequest = false;
    $.each(api_cache_requests, function(i,v){
        if(v == false){
            hasFalseCacheRequest = true;
        }
    });
    if(hasFalseCacheRequest == false){
        scAjaxProcOff();
    }*/
}

$(document).ready(function(){
});

var scSignatureStarted = {};

function scJQSignatureReset() {
  scSignatureStarted = {};
}

function scJQSignatureChange(fieldName) {
    if (typeof scSignatureStarted[fieldName] == "undefined") {
        scSignatureStarted[fieldName] = true;
    } else if (scSignatureStarted[fieldName]) {
        $("#" + fieldName).trigger("change");
    }
}

function scJQSignatureAdd(seqRow) {
  $("#sc-id-sign-firma" + seqRow).jSignature({
    height: "ratio",
    sizeRatio: 2.5,
    color: "#000000"
  }).bind("change", function(e) {
    scJQSignatureChange("id_sc_field_firma" + seqRow);
    scJQSignatureRedrawReadonly("#id_sc_field_firma" + seqRow);
    var changedRow = $("input[name='sc_check_vert[" + seqRow + "]']");
    if (changedRow.length) {
      $(changedRow[0]).prop("checked", true);
    }
  });
  scJQSignatureRedraw("firma" + seqRow);
  var changedRow = $("input[name='sc_check_vert[" + seqRow + "]']");
  if (changedRow.length) {
    $(changedRow[0]).prop("checked", false);
  }
  scFormHasChanged = false;
} // scJQSignatureAdd

function scJQSignatureRedraw(fieldName) {
  var thisFieldValue = $("#id_sc_field_" + fieldName).val();
  if ("" != thisFieldValue && "data:image/jsignature;base30," != thisFieldValue && "data:image/jsignature;base30," == thisFieldValue.substr(0, 29)) {
    $("#sc-id-sign-" + fieldName).jSignature("reset").jSignature("setData", thisFieldValue);
    var pngDataUrl = $("#sc-id-sign-" + fieldName).jSignature("getData", "image");
    $("#sc-id-disabled-" + fieldName).find("img").attr("src", "data:" + pngDataUrl);
    scJQSignatureRedrawReadonly(fieldName);
  }
  else {
    scJQSignatureClear(fieldName);
  }
} // scJQSignatureRedraw

function scJQSignatureRedrawReadonly(fieldName) {
  var thisFieldValue = $("#id_sc_field_" + fieldName).val();
  if ("" != thisFieldValue) {
    var pngDataUrl = $("#sc-id-sign-" + fieldName).jSignature("getData", "image");
    $("#sc-id-ronly-" + fieldName).find("img").attr("src", "data:" + pngDataUrl);
    $("#sc-id-ronly-" + fieldName).show();
  }
} // scJQSignatureRedraw

function scJQSignatureClear(fieldName) {
  $("#sc-id-sign-" + fieldName).jSignature("reset");
  $("#sc-id-disabled-" + fieldName).find("img").attr("src", "");
  scJQSignatureClearReadOnly(fieldName);
} // scJQSignatureRedraw

function scJQSignatureClearReadOnly(fieldName) {
    $("#sc-id-ronly-" + fieldName).find("img").attr("src", "");
} // scJQSignatureRedraw

function scJQPasswordToggleAdd(seqRow) {
  $(".sc-ui-pwd-toggle-icon" + seqRow).on("click", function() {
    var fieldName = $(this).attr("id").substr(17), fieldObj = $("#id_sc_field_" + fieldName), fieldFA = $("#id_pwd_fa_" + fieldName);
    if ("text" == fieldObj.attr("type")) {
      fieldObj.attr("type", "password");
      fieldFA.attr("class", "fa fa-eye sc-ui-pwd-eye");
    } else {
      fieldObj.attr("type", "text");
      fieldFA.attr("class", "fa fa-eye-slash sc-ui-pwd-eye");
    }
  });
} // scJQPasswordToggleAdd

function scJQSelect2Add(seqRow, specificField) {
  if (null == specificField || "nacionalidad" == specificField) {
    scJQSelect2Add_nacionalidad(seqRow);
  }
} // scJQSelect2Add

function scJQSelect2Add_nacionalidad(seqRow) {
  var elemSelector = "all" == seqRow ? ".css_nacionalidad_obj" : "#id_sc_field_nacionalidad" + seqRow;
  $(elemSelector).select2(
    {
      containerCssClass: 'css_nacionalidad_obj',
      dropdownCssClass: 'css_nacionalidad_obj',
      language: {
        noResults: function() {
          return "<?php echo $this->Ini->Nm_lang['lang_autocomp_notfound'] ?>";
        },
        searching: function() {
          return "<?php echo $this->Ini->Nm_lang['lang_autocomp_searching'] ?>";
        }
      }
    }
  );
  $('#select2-id_sc_field_nacionalidad' + seqRow + '-container').addClass('css_nacionalidad_obj');
} // scJQSelect2Add


function scJQElementsAdd(iLine) {
  scJQEventsAdd(iLine);
  scEventControl_init(iLine);
  scJQCalendarAdd(iLine);
  scJQUploadAdd(iLine);
  scJQSignatureAdd(iLine);
  scJQPasswordToggleAdd(iLine);
  scJQSelect2Add(iLine);
  setTimeout(function () { if ('function' == typeof displayChange_field_nacionalidad) { displayChange_field_nacionalidad(iLine, "on"); scAjaxError_markFieldList(scInsertFieldWithErrors); } }, 150);
} // scJQElementsAdd

function scGetFileExtension(fileName)
{
    fileNameParts = fileName.split(".");

    if (1 === fileNameParts.length || (2 === fileNameParts.length && "" == fileNameParts[0])) {
        return "";
    }

    return fileNameParts.pop().toLowerCase();
}

function scFormatExtensionSizeErrorMsg(errorMsg)
{
    var msgInfo = errorMsg.split("||"), returnMsg = "";

    if ("err_size" == msgInfo[0]) {
        returnMsg = "<?php echo $this->Ini->Nm_lang['lang_errm_file_size'] ?>. <?php echo $this->Ini->Nm_lang['lang_errm_file_size_extension'] ?>".replace("{SC_EXTENSION}", msgInfo[1]).replace("{SC_LIMIT}", msgInfo[2]);
    } else if ("err_extension" == msgInfo[0]) {
        returnMsg = "<?php echo $this->Ini->Nm_lang['lang_errm_file_invl'] ?>";
    }

    return returnMsg;
}

