function fValidar(){
    // Varibles de campos y secciones
    var tr_sec_16=document.getElementById("tr_sec_16");
    var tr_sec_18=document.getElementById("tr_sec_18");
    var tr_sec_21=document.getElementById("tr_sec_21");
    var tr_sec_17=document.getElementById("tr_sec_17");
    var tr_sec_22=document.getElementById("tr_sec_22");
    var tr_sec_23=document.getElementById("tr_sec_23");
    var cmbo_document=document.forms[0].LST_16_72;
    var txt_numdocumnt=document.getElementById("TXT_NUMDOCUMNT");
    var txt_nombre=document.getElementById("TXT_NOMBRE");
    var txt_apellpater=document.getElementById("TXT_APELLPATER");
    var txt_apellmatern=document.getElementById("TXT_APELLMATERN");
    var fech_nacimiento=document.getElementById("FECH_NACIMIENTO");
    var radbut_sexo=document.forms[0].LST_16_78;
    var cmbo_estadcivil=document.forms[0].LST_16_79;
    var txt_dependientes=document.getElementById("TXT_DEPENDIENTES");
    var cmb_nivelestudios=document.forms[0].LST_16_81;
    var txt_profesion=document.getElementById("TXT_PROFESION");
    var rdbbut_tipocasa=document.forms[0].LST_16_83;
    var txt_fechainicpropica=document.getElementById("TXT_FECHAINICPROPICA");
    var cmbo_direccion1=document.forms[0].LST_16_91;
    var txt_numerocasa=document.getElementById("TXT_NUMEROCASA");
    var cmbo_direccion2=document.forms[0].LST_16_97;
    var cmbo_direccion3=document.forms[0].LST_16_98;
    var cmbo_direccion4=document.forms[0].LST_16_99;
    var txt_mzlote=document.getElementById("TXT_MZLOTE");
    var cmbo_direccion5=document.forms[0].LST_16_101;
    var txt_distrito=document.getElementById("TXT_DISTRITO");
    var txt_provincia=document.getElementById("TXT_PROVINCIA");
    var txt_departamento=document.getElementById("TXT_DEPARTAMENTO");
    var txt_referencia=document.getElementById("TXT_REFERENCIA");
    var txt_fonofijo=document.getElementById("TXT_FONOFIJO");
    var radbut_clasefono=document.forms[0].LST_16_107;
    var txt_celular=document.getElementById("TXT_CELULAR");
    var txt_correlec=document.getElementById("TXT_CORRELEC");
    var nombres=document.getElementById("NOMBRES");
    var apellidopaterno=document.getElementById("APELLIDOPATERNO");
    var apellidomaterno=document.getElementById("APELLIDOMATERNO");
    var dni=document.getElementById("DNI");
    var nombrecompleto=document.getElementById("NOMBRECOMPLETO");
    var relacion=document.getElementById("RELACION");
    var telefono=document.getElementById("TELEFONO");
    var chkbox_tipoactividad=document.forms[0].LST_17_85;
    var txt_ruc=document.getElementById("TXT_RUC");
    var txt_tipoingreso=document.forms[0].LST_17_87;
    var txt_ingresnetomes=document.getElementById("TXT_INGRESNETOMES");
    var txt_cargo=document.getElementById("TXT_CARGO");
    var fech_ingreso=document.getElementById("FECH_INGRESO");
    var txt_seccionarea=document.getElementById("TXT_SECCIONAREA");
    var txt_rucempres=document.getElementById("TXT_RUCEMPRES");
    var txt_nombrempresa=document.getElementById("TXT_NOMBREMPRESA");
    var txt_giro=document.getElementById("TXT_GIRO");
    var nombreempresa=document.getElementById("NOMBREEMPRESA");
    var fechasalida=document.getElementById("FECHASALIDA");
    var diapago=document.forms[0].LST_23_119;
    var direccionenviotarjet=document.forms[0].LST_23_120;
    var enviocorrespondencia=document.forms[0].LST_23_121;
    var publicidadviamail=document.forms[0].LST_23_122;
    var disposicionefectivo=document.forms[0].LST_23_123;

    if (esVisible('tr_sec_16')){
    if (document.getElementById("hid_valida_72").value=="R"){
    if (cmbo_document.options[cmbo_document.selectedIndex].value==-1){
        alert("Ingrese el documento de identidad");
        cmbo_document.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_73").value=="R"){
    if (!trim(txt_numdocumnt.value)){
        alert("Ingrese el número de documento");
        txt_numdocumnt.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_74").value=="R"){
    if (!trim(txt_nombre.value)){
        alert("Ingrese el nombres");
        txt_nombre.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_75").value=="R"){
    if (!trim(txt_apellpater.value)){
        alert("Ingrese el apellido paterno");
        txt_apellpater.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_76").value=="R"){
    if (!trim(txt_apellmatern.value)){
        alert("Ingrese el apellido materno");
        txt_apellmatern.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_77").value=="R"){
    if (!trim(fech_nacimiento.value)){
        alert("Ingrese el fecha de nac.");
        fech_nacimiento.focus();
        return false;
    }
    if (!esFecha(fech_nacimiento.value)){
        alert("Ingrese una fecha válida");
        fech_nacimiento.focus();
        return false;
    }
    }
    else if (document.getElementById("hid_valida_77").value=="N"){
    var fech_nacimiento=document.getElementById("FECH_NACIMIENTO");
    if (trim(fech_nacimiento.value)){
    if (!esFecha(fech_nacimiento.value)){
        alert("Ingrese una fecha válida");
        fech_nacimiento.focus();
        return false;
    }
    }
    }
    if (document.getElementById("hid_valida_78").value=="R"){
    if (getSelectedList(radbut_sexo)==-1){
        alert("Ingrese el sexo");
        return false;
    }
    }
    if (document.getElementById("hid_valida_79").value=="R"){
    if (cmbo_estadcivil.options[cmbo_estadcivil.selectedIndex].value==-1){
        alert("Ingrese el estado civil");
        cmbo_estadcivil.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_80").value=="R"){
    if (!trim(txt_dependientes.value)){
        alert("Ingrese el nº dependientes");
        txt_dependientes.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_81").value=="R"){
    if (cmb_nivelestudios.options[cmb_nivelestudios.selectedIndex].value==-1){
        alert("Ingrese el elija nivel de estudios");
        cmb_nivelestudios.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_82").value=="R"){
    if (!trim(txt_profesion.value)){
        alert("Ingrese el profesión");
        txt_profesion.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_83").value=="R"){
    if (getSelectedList(rdbbut_tipocasa)==-1){
        alert("Ingrese el tipo de vivienda");
        return false;
    }
    }
    if (document.getElementById("hid_valida_84").value=="R"){
    if (!trim(txt_fechainicpropica.value)){
        alert("Ingrese el inicio de residencia");
        txt_fechainicpropica.focus();
        return false;
    }
    if (!esFecha(txt_fechainicpropica.value)){
        alert("Ingrese una fecha válida");
        txt_fechainicpropica.focus();
        return false;
    }
    }
    else if (document.getElementById("hid_valida_84").value=="N"){
    var txt_fechainicpropica=document.getElementById("TXT_FECHAINICPROPICA");
    if (trim(txt_fechainicpropica.value)){
    if (!esFecha(txt_fechainicpropica.value)){
        alert("Ingrese una fecha válida");
        txt_fechainicpropica.focus();
        return false;
    }
    }
    }
    if (document.getElementById("hid_valida_91").value=="R"){
    if (cmbo_direccion1.options[cmbo_direccion1.selectedIndex].value==-1){
        alert("Ingrese el elija una opción");
        cmbo_direccion1.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_96").value=="R"){
    if (!trim(txt_numerocasa.value)){
        alert("Ingrese el dirección");
        txt_numerocasa.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_97").value=="R"){
    if (cmbo_direccion2.options[cmbo_direccion2.selectedIndex].value==-1){
        alert("Ingrese el elija una opción");
        cmbo_direccion2.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_98").value=="R"){
    if (cmbo_direccion3.options[cmbo_direccion3.selectedIndex].value==-1){
        alert("Ingrese el elija");
        cmbo_direccion3.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_99").value=="R"){
    if (cmbo_direccion4.options[cmbo_direccion4.selectedIndex].value==-1){
        alert("Ingrese el elija");
        cmbo_direccion4.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_100").value=="R"){
    if (!trim(txt_mzlote.value)){
        alert("Ingrese el ingrese manzana/lote");
        txt_mzlote.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_101").value=="R"){
    if (cmbo_direccion5.options[cmbo_direccion5.selectedIndex].value==-1){
        alert("Ingrese el elija");
        cmbo_direccion5.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_102").value=="R"){
    if (!trim(txt_distrito.value)){
        alert("Ingrese el distrito");
        txt_distrito.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_103").value=="R"){
    if (!trim(txt_provincia.value)){
        alert("Ingrese el provincia");
        txt_provincia.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_104").value=="R"){
    if (!trim(txt_departamento.value)){
        alert("Ingrese el departamento");
        txt_departamento.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_105").value=="R"){
    if (!trim(txt_referencia.value)){
        alert("Ingrese el referencia");
        txt_referencia.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_106").value=="R"){
    if (!trim(txt_fonofijo.value)){
        alert("Ingrese el teléfono fijo");
        txt_fonofijo.focus();
        return false;
    }
    if (!esNumeroEntero(txt_fonofijo.value)){
        alert("Ingrese un número entero válido");
        txt_fonofijo.focus();
        return false;
    }
    }
    else if (document.getElementById("hid_valida_106").value=="N"){
    var txt_fonofijo=document.getElementById("TXT_FONOFIJO");
    if (trim(txt_fonofijo.value)){
    if (!esNumeroEntero(txt_fonofijo.value)){
        alert("Ingrese un número entero válido");
        txt_fonofijo.focus();
        return false;
    }
    }
    }
    if (document.getElementById("hid_valida_107").value=="R"){
    if (getSelectedList(radbut_clasefono)==-1){
        alert("Ingrese el clase teléfono");
        return false;
    }
    }
    if (document.getElementById("hid_valida_108").value=="R"){
    if (!trim(txt_celular.value)){
        alert("Ingrese el celular");
        txt_celular.focus();
        return false;
    }
    if (!esNumeroEntero(txt_celular.value)){
        alert("Ingrese un número entero válido");
        txt_celular.focus();
        return false;
    }
    }
    else if (document.getElementById("hid_valida_108").value=="N"){
    var txt_celular=document.getElementById("TXT_CELULAR");
    if (trim(txt_celular.value)){
    if (!esNumeroEntero(txt_celular.value)){
        alert("Ingrese un número entero válido");
        txt_celular.focus();
        return false;
    }
    }
    }
    if (document.getElementById("hid_valida_109").value=="R"){
    if (!trim(txt_correlec.value)){
        alert("Ingrese el correo electrónico");
        txt_correlec.focus();
        return false;
    }
    if (!esCorreo(txt_correlec.value)){
        alert("Ingrese un correo válido");
        txt_correlec.focus();
        return false;
    }
    }
    else if (document.getElementById("hid_valida_109").value=="N"){
    var txt_correlec=document.getElementById("TXT_CORRELEC");
    if (trim(txt_correlec.value)){
    if (!esCorreo(txt_correlec.value)){
        alert("Ingrese un correo válido");
        txt_correlec.focus();
        return false;
    }
    }
    }
    }
    if (esVisible('tr_sec_18')){
    if (document.getElementById("hid_valida_110").value=="R"){
    if (!trim(nombres.value)){
        alert("Ingrese el nombres");
        nombres.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_111").value=="R"){
    if (!trim(apellidopaterno.value)){
        alert("Ingrese el apellido paterno");
        apellidopaterno.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_112").value=="R"){
    if (!trim(apellidomaterno.value)){
        alert("Ingrese el apellido materno");
        apellidomaterno.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_113").value=="R"){
    if (!trim(dni.value)){
        alert("Ingrese el dni");
        dni.focus();
        return false;
    }
    }
    }
    if (esVisible('tr_sec_21')){
    if (document.getElementById("hid_valida_114").value=="R"){
    if (!trim(nombrecompleto.value)){
        alert("Ingrese el nombre completo");
        nombrecompleto.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_115").value=="R"){
    if (!trim(relacion.value)){
        alert("Ingrese el relación");
        relacion.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_116").value=="R"){
    if (!trim(telefono.value)){
        alert("Ingrese el teléfono");
        telefono.focus();
        return false;
    }
    }
    }
    if (esVisible('tr_sec_17')){
    if (document.getElementById("hid_valida_85").value=="R"){
    if (getSelectedList(chkbox_tipoactividad)==-1){
        alert("Ingrese el tipo de actividad");
        return false;
    }
    }
    if (document.getElementById("hid_valida_86").value=="R"){
    if (!trim(txt_ruc.value)){
        alert("Ingrese el ruc persona natural");
        txt_ruc.focus();
        return false;
    }
    if (!esNumeroEntero(txt_ruc.value)){
        alert("Ingrese un número entero válido");
        txt_ruc.focus();
        return false;
    }
    }
    else if (document.getElementById("hid_valida_86").value=="N"){
    var txt_ruc=document.getElementById("TXT_RUC");
    if (trim(txt_ruc.value)){
    if (!esNumeroEntero(txt_ruc.value)){
        alert("Ingrese un número entero válido");
        txt_ruc.focus();
        return false;
    }
    }
    }
    if (document.getElementById("hid_valida_87").value=="R"){
    if (getSelectedList(txt_tipoingreso)==-1){
        alert("Ingrese el tipo de ingreso");
        return false;
    }
    }
    if (document.getElementById("hid_valida_88").value=="R"){
    if (!trim(txt_ingresnetomes.value)){
        alert("Ingrese el ingreso neto mensual  (s/.)");
        txt_ingresnetomes.focus();
        return false;
    }
    if (!esNumeroEntero(txt_ingresnetomes.value)){
        alert("Ingrese un número entero válido");
        txt_ingresnetomes.focus();
        return false;
    }
    }
    else if (document.getElementById("hid_valida_88").value=="N"){
    var txt_ingresnetomes=document.getElementById("TXT_INGRESNETOMES");
    if (trim(txt_ingresnetomes.value)){
    if (!esNumeroEntero(txt_ingresnetomes.value)){
        alert("Ingrese un número entero válido");
        txt_ingresnetomes.focus();
        return false;
    }
    }
    }
    if (document.getElementById("hid_valida_89").value=="R"){
    if (!trim(txt_cargo.value)){
        alert("Ingrese el cargo");
        txt_cargo.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_90").value=="R"){
    if (!trim(fech_ingreso.value)){
        alert("Ingrese el fecha de ingreso");
        fech_ingreso.focus();
        return false;
    }
    if (!esFecha(fech_ingreso.value)){
        alert("Ingrese una fecha válida");
        fech_ingreso.focus();
        return false;
    }
    }
    else if (document.getElementById("hid_valida_90").value=="N"){
    var fech_ingreso=document.getElementById("FECH_INGRESO");
    if (trim(fech_ingreso.value)){
    if (!esFecha(fech_ingreso.value)){
        alert("Ingrese una fecha válida");
        fech_ingreso.focus();
        return false;
    }
    }
    }
    if (document.getElementById("hid_valida_92").value=="R"){
    if (!trim(txt_seccionarea.value)){
        alert("Ingrese el sección/área");
        txt_seccionarea.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_93").value=="R"){
    if (!trim(txt_rucempres.value)){
        alert("Ingrese el ruc de la empresa");
        txt_rucempres.focus();
        return false;
    }
    if (!esNumeroEntero(txt_rucempres.value)){
        alert("Ingrese un número entero válido");
        txt_rucempres.focus();
        return false;
    }
    }
    else if (document.getElementById("hid_valida_93").value=="N"){
    var txt_rucempres=document.getElementById("TXT_RUCEMPRES");
    if (trim(txt_rucempres.value)){
    if (!esNumeroEntero(txt_rucempres.value)){
        alert("Ingrese un número entero válido");
        txt_rucempres.focus();
        return false;
    }
    }
    }
    if (document.getElementById("hid_valida_94").value=="R"){
    if (!trim(txt_nombrempresa.value)){
        alert("Ingrese el nombre de la empresa");
        txt_nombrempresa.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_95").value=="R"){
    if (!trim(txt_giro.value)){
        alert("Ingrese el giro");
        txt_giro.focus();
        return false;
    }
    }
    }
    if (esVisible('tr_sec_22')){
    if (document.getElementById("hid_valida_117").value=="R"){
    if (!trim(nombreempresa.value)){
        alert("Ingrese el nombre de la empresa");
        nombreempresa.focus();
        return false;
    }
    }
    if (document.getElementById("hid_valida_118").value=="R"){
    if (!trim(fechasalida.value)){
        alert("Ingrese el fecha de salida");
        fechasalida.focus();
        return false;
    }
    if (!esFecha(fechasalida.value)){
        alert("Ingrese una fecha válida");
        fechasalida.focus();
        return false;
    }
    }
    else if (document.getElementById("hid_valida_118").value=="N"){
    var fechasalida=document.getElementById("FECHASALIDA");
    if (trim(fechasalida.value)){
    if (!esFecha(fechasalida.value)){
        alert("Ingrese una fecha válida");
        fechasalida.focus();
        return false;
    }
    }
    }
    }
    if (esVisible('tr_sec_23')){
    if (document.getElementById("hid_valida_119").value=="R"){
    if (getSelectedList(diapago)==-1){
        alert("Ingrese el día de pago");
        return false;
    }
    }
    if (document.getElementById("hid_valida_120").value=="R"){
    if (getSelectedList(direccionenviotarjet)==-1){
        alert("Ingrese el dirección envío de tarjeta");
        return false;
    }
    }
    if (document.getElementById("hid_valida_121").value=="R"){
    if (getSelectedList(enviocorrespondencia)==-1){
        alert("Ingrese el envío de correspondencia");
        return false;
    }
    }
    if (document.getElementById("hid_valida_122").value=="R"){
    if (getSelectedList(publicidadviamail)==-1){
        alert("Ingrese el recibir publicidad / información vía email");
        return false;
    }
    }
    if (document.getElementById("hid_valida_123").value=="R"){
    if (getSelectedList(disposicionefectivo)==-1){
        alert("Ingrese el desea habilitar disposición de efectivo");
        return false;
    }
    }
    }
    var txt_captcha=document.getElementById("TXT_CAPTCHA");
    if(!trim(txt_captcha.value)){
        alert("Ingrese el codigo que se muestra en la imagen correctamente.");
        txt_captcha.focus();
        return false;
    }
    var texto_captcha=window.frames.ifr_Captcha.document.getElementById('captcha_hid_TextoCaptcha').value;
    if(txt_captcha.value.toLowerCase()!=texto_captcha.toLowerCase()){
        alert("No coinciden los caracteres ingresados.");
        txt_captcha.focus();
        return false;
    }

    // Asigna texto a valor de listas
    document.getElementById("hid_lista_72").value=cmbo_document.options[cmbo_document.selectedIndex].text;
    document.getElementById("hid_lista_78").value=getSelectedRadioText(radbut_sexo);
    document.getElementById("hid_lista_79").value=cmbo_estadcivil.options[cmbo_estadcivil.selectedIndex].text;
    document.getElementById("hid_lista_81").value=cmb_nivelestudios.options[cmb_nivelestudios.selectedIndex].text;
    document.getElementById("hid_lista_83").value=getSelectedRadioText(rdbbut_tipocasa);
    document.getElementById("hid_lista_91").value=cmbo_direccion1.options[cmbo_direccion1.selectedIndex].text;
    document.getElementById("hid_lista_97").value=cmbo_direccion2.options[cmbo_direccion2.selectedIndex].text;
    document.getElementById("hid_lista_98").value=cmbo_direccion3.options[cmbo_direccion3.selectedIndex].text;
    document.getElementById("hid_lista_99").value=cmbo_direccion4.options[cmbo_direccion4.selectedIndex].text;
    document.getElementById("hid_lista_101").value=cmbo_direccion5.options[cmbo_direccion5.selectedIndex].text;
    document.getElementById("hid_lista_107").value=getSelectedRadioText(radbut_clasefono);
    document.getElementById("hid_lista_85").value=getSelectedCheckboxText(chkbox_tipoactividad);
    document.getElementById("hid_lista_87").value=getSelectedRadioText(txt_tipoingreso);
    document.getElementById("hid_lista_119").value=getSelectedRadioText(diapago);
    document.getElementById("hid_lista_120").value=getSelectedRadioText(direccionenviotarjet);
    document.getElementById("hid_lista_121").value=getSelectedRadioText(enviocorrespondencia);
    document.getElementById("hid_lista_122").value=getSelectedRadioText(publicidadviamail);
    document.getElementById("hid_lista_123").value=getSelectedRadioText(disposicionefectivo);

   // Limpiar texto de ayuda


    __doPostBack('ctl00$PortalPlaceHolder$ctl00$btn_Enviar','');
}


