<!DOCTYPE HTML>
{% load staticfiles %}
{% load i18n %}
{% load i18n_filters %}
{% load my_filters %}
{% load compress %}

{% get_current_language as lang_code %}
<html lang="{{ lang_code }}">
    <head>
        <!--[if lt IE 9]>
              <script src="{% static "js/html5shiv.js" %}"></script>
        <![endif] -->

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="wot-verification" content="075abe861486e6bb3ab9"/>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        {% block titletag %}
        <title>{% block title %}{% trans "Welcome" %}{% trans title %}{% endblock title %} | KA Lite</title>
        {% endblock %}

        {% compress css file basecss %}
        <link rel="stylesheet" type="text/css" href="{% static 'css/jquery-ui/jquery-ui.min.css' %}">
        <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.min.css' %}">
		<link rel="stylesheet" type="text/css" href="{% static 'css/distributed/bootstrap-overrides.css' %}">
		<link rel="stylesheet" type="text/css" href="{% static 'css/coachreports/events_view.css' %}">
        <link rel="stylesheet" type="text/css" href="{% static 'css/distributed/khan-site.css' %}">
        <link rel="stylesheet" type="text/css" href="{% static 'css/distributed/khan-lite.css' %}">
        <link href="{% static "fonts/style.css" %}" rel="stylesheet" type="text/css">
        <link rel="stylesheet" type="text/css" href="{% static 'css/distributed/search_autocomplete.css' %}">
        <link rel="stylesheet" type="text/css" href="{% static 'css/jquery.qtip.min.css' %}">
        {% endcompress %}

        <!-- INTROJS.CSS testing -->
        <link rel="stylesheet" type="text/css" href="{% static 'css/inline/introjs.css' True %}">

        <!-- CSS for dynamic settings -->
        <link rel="stylesheet" type="text/css" href="{% url 'dynamic_css' %}">

        {% block headcss %}{% endblock headcss %}
        <link rel="shortcut icon" href="{% static "images/distributed/favicon.ico" %}">
        {# In some versions of IE, console isn't defined, which can lead to JS errors #}
        <script type="text/javascript">
            window.console = window.console || {log: function() {}};
        </script>

        <script type="text/javascript" src="{% url 'dynamic_js' %}"></script>

        {# Use JS to help IE5.5-IE8 support modern browser features, especially for CSS and PNGs #}
        <!--[if lt IE 8]>
        {# <script src="{% static "js/IE8.js" %}"></script> #}
        <![endif]-->

        <script type="text/javascript">
            window.onerror=function(msg){
                window.js_errors = window.js_errors || [];
                window.js_errors.push(msg);
            }
        </script>

        {% if request.in_context_localized %}
            <script type="text/javascript">
              var _jipt = [];
              _jipt.push(['project', 'ka-lite']);
            </script>
            <script type="text/javascript" src="//cdn.crowdin.com/jipt/jipt.js"></script>
        {% endif %}

        {% if settings.DEBUG %}
        <script src="{% url 'js_reverse' %}" type="text/javascript"></script>
        {% else %}
        <script src="{% static 'django_js_reverse/js/reverse.js' %}"></script>
        {% endif %}

        <!-- JS translation file statically included as a back-up, so that if the saved file below isn't available, we don't choke. -->
        <script type="text/javascript" src="{% static 'js/i18n/en.js' %}"></script>

        {% if current_language != "en" %}
            <!-- JS translation files dynamically generated by django, then saved to the static file below -->
            <script type="text/javascript" src="{{ settings.CONTENT_URL }}locale/js/i18n/{{ request.language }}.js"></script>
        {% endif %}

        {% compress js file basejs %}

        {# Older versions of IE didn't have a JSON object, so this library adds it back in if needed #}
        <script type="text/javascript" src="{% static 'js/json2.js' %}"></script>

        {% block jqueryjs %}
        <script type="text/javascript" src="{% static 'js/jquery-1.9.1.min.js' %}"></script>
        <script type="text/javascript">
            jQuery.migrateMute = true;
        </script>
        {% endblock jqueryjs %}

        <script type="text/javascript" src="{% static 'js/fastclick.js' %}"></script>
        <script>

        $(function() {
            FastClick.attach(document.body);
        });
        </script>
        <script type="text/javascript" src="{% static 'js/underscore-min.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/backbone/backbone.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/backbone/backbone-tastypie.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/backbone/backbone-helpers.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/jquery-ui/jquery-ui.min.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/jquery.ui.touch-punch.min.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/bootstrap.min.js' %}"></script>

        <script type="text/javascript" src="{% static 'js/sprintf.min.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/purl.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/modernizr.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/jquery.ui.autocomplete.html.js' %}"></script>

        <!-- Imports for handlebars, our JS templating engine -->
        <script src="{% static "js/handlebars/handlebars-v1.3.0.js" %}"></script>
        <script src="{% static "js/handlebars/handlebars-helpers.js" %}"></script>
        <script src="{% static "js/handlebars/handlebars-wrapper.js" %}"></script>

        <script type="text/javascript" src="{% static 'js/distributed/session/models.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/khan-lite.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/distributed/distributed-server.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/jquery.qtip.min.js' %}"></script>

        {% endcompress %}

        <script src="{% url 'handlebars_templates' module_name='search' %}"></script>
        <script src="{% url 'handlebars_templates' module_name='user' %}"></script>

        {% compress js file baseviews %}
        <script src="{% static 'js/distributed/user/views.js' %}"></script>
        <script src="{% static 'js/distributed/search/views.js' %}"></script>
        {% endcompress %}


        {# Trigger tooltips for help icons #}
        <script>
            $(function(){
                $('.help-tooltip').tooltip({
                    trigger: "hover click"
                });
            });
        </script>

        <script>
        window.sessionModel.set({
          USER_URL                    : "{% url 'api_dispatch_list' resource_name='user' %}",

          STATIC_URL                  : "{% static "" %}",

          ALL_ASSESSMENT_ITEMS_URL    : "{% url 'api_dispatch_list' resource_name='assessment_item' %}",
          GET_VIDEO_LOGS_URL          : "{% url 'api_dispatch_list' resource_name='videolog' %}",
          GET_EXERCISE_LOGS_URL       : "{% url 'api_dispatch_list' resource_name='exerciselog' %}",
          GET_CONTENT_LOGS_URL        : "{% url 'api_dispatch_list' resource_name='contentlog' %}",

          KHAN_EXERCISES_SCRIPT_URL : "{% static 'perseus/ke/khan-exercise.js' %}",

          CENTRAL_SERVER_HOST         : "{{ central_server_host }}",
          SECURESYNC_PROTOCOL         : "{{ securesync_protocol }}",
          CURRENT_LANGUAGE            : "{{ current_language }}",
          CHANNEL                     : "{{ channel }}",
        });
        $(function() {
          window.statusModel.fetch_data();
          window.toggleNavbarView = new ToggleNavbarView({model: statusModel, el: "#topnav"});
        });
        </script>

        {% block headjs %}{% endblock headjs %}
        {% block analytics %}{% endblock analytics %}

        {% if inline_help %}
        <!-- inline help, introjs -->
        <script src="{% url 'handlebars_templates' module_name='inline' %}"></script>
        <script type="text/javascript" src="{% static 'js/inline/intro.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/inline/models.js' %}"></script>
        <script type="text/javascript" src="{% static 'js/inline/views.js' %}"></script>
        {% endif %}
    </head>

    <body class="{% block bodyclass %}{% endblock %}">
        <div id="wrapper">

            {# Header / Navbar #}
            <div class="navbar kalite-navbar header-footer-bg" role="banner">
              <div class="container">
                  <div class="row">
                      <div class="navbar-header">
                          {# collapse entire menu #}
                          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse" aria-hidden="true" id="navbar_toggle">
                              <span class="icon-bar"></span>
                              <span class="icon-bar"></span>
                              <span class="icon-bar"></span>
                          </button>
                          <div class="navbar-brand">
                              <a href="{% url 'homepage' %}" title="{{ channel_data.channel_name }} {% trans 'Home' %}">
                                  <img src="/data/{{ channel }}/images/horizontal-logo-small.png" alt="{{ channel_data.channel_name }} {% trans 'logo' %}">
                              </a>
                              <div class="pull-right visible-xs sitepoint" id="points-xs"></div>
                          </div>

                      </div>

                      <div class="collapse navbar-collapse top-nav" role="navigation" aria-label="Main menu">
                          <ul class="nav navbar-nav navbar-right nav-tabs" id="topnav" role="tablist"></ul>
                      </div>

                    </div>
                </div>
            </div>
          {# End Header / Navbar #}

            {# Body #}
            <div id="content-container" class="container" role="main">
                {% block outer_content %}
                    {% block precontent %}
                        {% include "distributed/partials/_messages.html" %}
                    {% endblock precontent %}
                    {% block content %}
                        {% block subnavbar %}{% endblock subnavbar %}
                    {% endblock content %}
                {% endblock outer_content %}
            </div>
        </div> {# End wrapper #}
        {# Footer #}
        {% include "distributed/partials/_footer.html" %}
    </body>

</html>
