{% load snippet_tags %}


{% block doctype %}<!DOCTYPE html>{% endblock doctype %}
{% block html_open %}<html lang="en">{% endblock html_open %}
<head>
    <meta charset="utf-8">
    {% block x_ua_compatible %}<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">{% endblock x_ua_compatible %}
    {% block full_title %}
    <title>{% block title %}Django Things{% endblock title %}</title>
    {% endblock full_title %}

    <meta name="description" content="{% block description %}{% endblock description %}" />

    {% block bootstrap_css_link %}
    <link href="{{ STATIC_URL }}css/bootstrap-custom.css" rel="stylesheet">
    {% endblock bootstrap_css_link %}

    <!-- HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    {% block head %}{% endblock head %}

    <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', '{% snippet "google-analytics-ua" striptags %}{% endsnippet %}']);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    </script>
</head>

<body>

    {% include "_edit_bar.html" %}

    {% include "_messages.html" %}

    {% block body %}{% endblock body %}

    {% block jquery %}
    <script type="text/javascript" src="{{ STATIC_URL }}js/jquery-1.8.3.min.js"></script>
    {% endblock jquery %}

    {% if request.user.is_superuser %}
    <script type="text/javascript">
    $(document).ready(function() {
        $(document).keyup(function(){
            if ( event.which == 27 ) {
                {% if edit_mode %}
                    window.location = "{{ request.path }}?mode=";
                {% else %}
                    window.location = "{{ request.path }}?mode=edit";
                {% endif %}
            }
        })
    });
    </script>
    {% endif %}

    {% if messages %}
    <script type="text/javascript">
    $(document).ready(function() {
        var alerts = $(".alert-success, .alert-info").parent();
        if (alerts) {
            alerts.delay(3000).fadeOut(1000, function () { $(this).remove(); });
        }
    });
    </script>
    {% endif %}

    {% block js %}{% endblock js %}

</body>

</html>