{% load i18n staticfiles tz stats %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
{#    <meta name="viewport" content="width=device-width, initial-scale=1">#}
    <meta name="description" content="">
    <meta name="author" content="IL2 stats {{ VERSION }}">

    <link rel="icon" href="{% static 'favicon.ico' %}">
    <link rel="apple-touch-icon-precomposed" sizes="57x57" href="{% static 'apple-touch-icon-57x57.png' %}" />
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="{% static 'apple-touch-icon-114x114.png' %}" />
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="{% static 'apple-touch-icon-72x72.png' %}" />
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="{% static 'apple-touch-icon-144x144.png' %}" />
    <link rel="apple-touch-icon-precomposed" sizes="60x60" href="{% static 'apple-touch-icon-60x60.png' %}" />
    <link rel="apple-touch-icon-precomposed" sizes="120x120" href="{% static 'apple-touch-icon-120x120.png' %}" />
    <link rel="apple-touch-icon-precomposed" sizes="76x76" href="{% static 'apple-touch-icon-76x76.png' %}" />
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="{% static 'apple-touch-icon-152x152.png' %}" />
    <link rel="icon" type="image/png" href="{% static 'favicon-196x196.png' %}" sizes="196x196" />
    <link rel="icon" type="image/png" href="{% static 'favicon-96x96.png' %}" sizes="96x96" />
    <link rel="icon" type="image/png" href="{% static 'favicon-128.png' %}" sizes="128x128" />
    <meta name="application-name" content="IL2 stats {{ VERSION }}"/>
    <meta name="msapplication-TileColor" content="#353535" />
    <meta name="msapplication-TileImage" content="{% static 'mstile-144x144.png' %}" />
    <meta name="msapplication-square70x70logo" content="{% static 'mstile-70x70.png' %}" />
    <meta name="msapplication-square150x150logo" content="{% static 'mstile-150x150.png' %}" />
    <meta name="msapplication-wide310x150logo" content="{% static 'mstile-310x150.png' %}" />
    <meta name="msapplication-square310x310logo" content="{% static 'mstile-310x310.png' %}" />

    <title>{% block title %}{{ server_name.title }} (IL2 stats){% endblock title %}</title>

    <link href='//fonts.googleapis.com/css?family=Cookie|Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&amp;subset=latin,latin-ext,cyrillic,cyrillic-ext' rel='stylesheet' type='text/css'>

    <link href="{% static 'css/style.css' %}" rel="stylesheet">
    <script>
        var LANGUAGE_CODE = '{{ LANGUAGE_CODE }}';
        var TOUR_ID = {{ request.tour.id }};
    </script>

    {% block head %}{% endblock head %}
</head>

<body>
<noscript>
    <div id="enable_javascript">
        {% blocktrans trimmed %}
            For full functionality of this site it is necessary to enable JavaScript.
            Here are the <a href="//www.enable-javascript.com" target="_blank">
            instructions how to enable JavaScript in your web browser</a>.
        {% endblocktrans %}
    </div>
</noscript>

<header>
    <div class="wrapper">
        <div class="head_title_sm">{{ server_name.content }}</div>
        <div class="head_title">{{ server_name.title }}</div>
        <div class="user_menu">
            {% if user.is_authenticated %}
                {% if user.is_staff %}
                <a href="{% url 'admin:index' %}">{% trans 'Admin panel' %}</a>
                {% endif %}
                <a href="{% url 'users:profile' %}">{% trans 'Profile' %} ({{ user.username }})</a>
                <form id="logout" method="post" action="{% url 'users:logout' %}" style="display: none;">
                    {% csrf_token %}
                    <input type="hidden" name="next" value="{% url 'stats:main' %}">
                </form>
                <a href="#" onclick="$('form#logout').submit();">{% trans 'Logout' %}</a>
            {% else %}
            <a href="{% url 'users:registration' %}">{% trans 'Registration' context 'action' %}</a>
            <a href="{% url 'users:login' %}">{% trans 'Login' context 'action' %}</a>
            {% endif %}
        </div>
    </div>
</header>

<nav id="nav_main">
    <div class="nav_main">
        <div class="nav_menu">
            <a href="{% url 'stats:main' %}?tour={{ request.tour.id }}">{% trans 'Main' context 'nav_menu' %}</a>
            <div class="nav_sub_menu">
                {% trans 'Rankings' %} &#x25BE;
                <div class="nav_sub_menu_items">
                    <a href="{% url 'stats:pilots' %}?tour={{ request.tour.id }}">{% trans 'Pilot Rankings' %}</a>
                    <a href="{% url 'stats:tankmans' %}?tour={{ request.tour.id }}">{% trans 'Tankman Rankings' %}</a>
                    <a href="{% url 'stats:squads' %}?tour={{ request.tour.id }}">{% trans 'Squad Rankings' %}</a>
                </div>
            </div>
            <a href="{% url 'stats:missions_list' %}?tour={{ request.tour.id }}">{% trans 'Missions' %}</a>
            {% if server_forum_url.content %}
                <a href="{{ server_forum_url.content }}" target="_blank">{% trans 'Forum' %}</a>
            {% endif %}
            <a href="{% url 'faq' %}">FAQ</a>
            <a href="{% url 'info' %}">{% trans 'Info' %}</a>
        </div>
        <div class="nav_tour">
            {% trans 'Tour' %}:
            <div class="nav_tour_select">
                <div class="nav_tour_selected">
                    {{ request.tour.get_title }}
                </div>
                <div class="nav_tour_items">
                    {% for tour in TOURS.values %}
{#                        {% if tour.id != request.tour.id %}#}
                        <a href="?tour={{ tour.id }}">
                            <div class="nav_tour_item">{{ tour.get_title }}</div>
                        </a>
{#                        {% endif %}#}
                    {% endfor %}
                </div>
            </div>
        </div>
    </div>
</nav>

{% block nav_tabs %}{% endblock nav_tabs %}

{% if messages %}
<div class="messages">
{% for message in messages %}
    <div class="message {{ message.tags }}">
        {{ message }}
        <div class="close"></div>
    </div>
{% endfor %}
</div>
{% endif %}

{% block content %}{% endblock content %}

<footer>
    <div class="footer">
        <div class="wrapper">
            <div class="footer_il2_stats_logo">
                {% if LANGUAGE_CODE == 'ru' %}
                    <a href="https://forum.il2sturmovik.ru/topic/3548-il2-stats" target="_blank">
                        <img src="{% static 'img/il2_stats_logo_sm.png' %}" width="53" height="36" alt="" title="">
                    </a>
                {% else %}
                    <a href="https://forum.il2sturmovik.com/topic/19083-il2-stats" target="_blank">
                        <img src="{% static 'img/il2_stats_logo_sm.png' %}" width="53" height="36" alt="" title="">
                    </a>
                {% endif %}
            </div>
            <div class="footer_left">
                {% now 'Y' as current_year %}
                Powered by <strong>IL2 <i>stats</i> {{ VERSION }}</strong>
{#                © 2015{% if current_year != '2015' %}-{{ current_year }}{% endif %} Some Name#}
                <div class="footer_lang">
                    |
                    {# TODO хак, переделать на шаблонный тег #}
                    {% if LANGUAGE_CODE == 'ru' %}
                        <a class="lang" href="/en{{ request.get_full_path|slice:'3:' }}">English version</a>
                        <a class="lang" href="/de{{ request.get_full_path|slice:'3:' }}">Deutsche Version</a>
                        <a class="lang" href="/es{{ request.get_full_path|slice:'3:' }}">Spanish version</a>
                        <a class="lang" href="/fr{{ request.get_full_path|slice:'3:' }}">Française version</a>
                    {% elif LANGUAGE_CODE == 'en' %}
                        <a class="lang" href="/ru{{ request.get_full_path|slice:'3:' }}">Русская версия</a>
                        <a class="lang" href="/de{{ request.get_full_path|slice:'3:' }}">Deutsche Version</a>
                        <a class="lang" href="/es{{ request.get_full_path|slice:'3:' }}">Spanish version</a>
                        <a class="lang" href="/fr{{ request.get_full_path|slice:'3:' }}">Française version</a>
                    {% elif LANGUAGE_CODE == 'de' %}
                        <a class="lang" href="/en{{ request.get_full_path|slice:'3:' }}">English version</a>
                        <a class="lang" href="/ru{{ request.get_full_path|slice:'3:' }}">Русская версия</a>
                        <a class="lang" href="/es{{ request.get_full_path|slice:'3:' }}">Spanish version</a>
                        <a class="lang" href="/fr{{ request.get_full_path|slice:'3:' }}">Française version</a>
                    {% elif LANGUAGE_CODE == 'es' %}
                        <a class="lang" href="/en{{ request.get_full_path|slice:'3:' }}">English version</a>
                        <a class="lang" href="/ru{{ request.get_full_path|slice:'3:' }}">Русская версия</a>
                        <a class="lang" href="/de{{ request.get_full_path|slice:'3:' }}">Deutsche Version</a>
                        <a class="lang" href="/fr{{ request.get_full_path|slice:'3:' }}">Française version</a>
                    {% elif LANGUAGE_CODE == 'fr' %}
                        <a class="lang" href="/en{{ request.get_full_path|slice:'3:' }}">English version</a>
                        <a class="lang" href="/ru{{ request.get_full_path|slice:'3:' }}">Русская версия</a>
                        <a class="lang" href="/de{{ request.get_full_path|slice:'3:' }}">Deutsche Version</a>
                        <a class="lang" href="/es{{ request.get_full_path|slice:'3:' }}">Spanish version</a>
                    {% else %}
                        <a class="lang" href="/en{{ request.get_full_path|slice:'3:' }}">English version</a>
                        <a class="lang" href="/ru{{ request.get_full_path|slice:'3:' }}">Русская версия</a>
                        <a class="lang" href="/de{{ request.get_full_path|slice:'3:' }}">Deutsche Version</a>
                        <a class="lang" href="/es{{ request.get_full_path|slice:'3:' }}">Spanish version</a>
                        <a class="lang" href="/fr{{ request.get_full_path|slice:'3:' }}">Française version</a>
                    {% endif %}
                </div>
            </div>
            <div class="footer_coffee">
                <a class="bmc-button" target="_blank" href="https://www.buymeacoffee.com/IL2stats">
                    <img src="{% static 'bmc-new-btn-logo.svg' %}" alt="Buy us a coffee">
                    <span style="margin-left:5px; font-size:24px;">Buy us a coffee</span>
                </a>
            </div>
        </div>
    </div>
</footer>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/URI.js/1.16.0/URI.min.js"></script>
{#<script src="{% static 'js/bootstrap.min.js' %}"></script>#}
<script src="{% static 'js/common.js' %}"></script>
<script src="{% static 'js/paginator3000.js' %}"></script>


{% block bottom %}{% endblock bottom %}

<!-- Yandex.Metrika counter --><script type="text/javascript"> (function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter32171674 = new Ya.Metrika({ id:32171674, clickmap:true, trackLinks:true, accurateTrackBounce:true, webvisor:true, trackHash:true }); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = "https://mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } })(document, window, "yandex_metrika_callbacks");</script><noscript><div><img src="https://mc.yandex.ru/watch/32171674" style="position:absolute; left:-9999px;" alt="" /></div></noscript><!-- /Yandex.Metrika counter -->

<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    ga('create', 'UA-10792172-15', 'auto');
    ga('send', 'pageview');
</script>

<script>
    var $buoop = {c: 2};
    function $buo_f() {
        var e = document.createElement("script");
        e.src = "//browser-update.org/update.min.js";
        document.body.appendChild(e);
    };
    try {
        document.addEventListener("DOMContentLoaded", $buo_f, false)
    }
    catch (e) {
        window.attachEvent("onload", $buo_f)
    }
</script>

</body>
</html>
