<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
    <head>
        <title>{% block title %}{{ CILANTRO.site_name }}{% endblock %}</title>

        <meta charset="utf-8"> 
        <!-- Use the .htaccess and remove these lines to avoid edge case issues.
             More info: h5bp.com/b/378 -->
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
        <!-- Mobile viewport optimized: j.mp/bplateviewport -->
        <meta name="viewport" content="width=device-width,initial-scale=1">

        <link rel="stylesheet" href="{{ CILANTRO_CSS_URL }}main.css">

        {% block styles %}{% endblock %}
    
        {% block head_scripts %}
            <script src="{{ CILANTRO_JAVASCRIPT_URL }}vendor/modernizr.js"></script>
            {% if CILANTRO.google_analytics and not debug %}
                <script>
                    var _gaq = _gaq || [];
                    _gaq.push(['_setAccount', '{{ CILANTRO.google_analytics }}']);
                    _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>
            {% endif %}
        {% endblock %}
    </head>
    
    <body>
        {# standard global header #}
        {% include "snippets/header.html" %}

        {# navigation proxy, use "base_nav.html" to implement #}
        {% block _navigation %}{% endblock %}

        <noscript>
            <span class="message error">JavaScript must be enabled. Turn it on and refresh the page.</span>
        </noscript>

        {# general area for display messages #}
        {% block messages %}
            <div id="messages"></div>
        {% endblock %}

        {# primary area for displaying page content. override CSS for a page specific style #}
        <div id="content">
            {% block content %}{% endblock %}
        </div>

        {# standard global footer #}        
        {% include "snippets/footer.html" %}

        {# any extra markup that needs to be included in the page for #}
        {# additional functionality, templates, hidden elements, etc. #}
        {% block extra_markup %}{% endblock %}

        {# the configuration for RequireJS which ensures the paths are #}
        {# correctly setup and able to be extended. #}
        <script>
            // namespace for the application. defined here are all the
            // necessary endpoints. this liste will hopefully decrease over
            // time...
            var App = {
                csrftoken: '{{ csrf_token }}',
                endpoints: {
                    session: {
                        scope: '{% url api:scope:session %}',
                        perspective: '{% url api:perspectives:session %}',
                        report: '{% url api:reports:session %}'
                    },
                    reports: '{% url api:reports:read %}',
                    domains: '{% url api:categories:read %}',
                    criteria: '{% url api:criteria:read %}',
                    define: '{% url define %}',
                    report: '{% url report %}'
                }
            };

            var require = {
                // Everything should be relative to the project's javascript
                // url for convenience. Cilantro is namespaced within the
                // project anyway
                baseUrl: '{{ JAVASCRIPT_URL }}',
                paths: {
                    'cilantro': '{{ CILANTRO_JAVASCRIPT_URL }}',
                    'order': '{{ CILANTRO_JAVASCRIPT_URL }}order',
                    'common': '{{ CILANTRO_JAVASCRIPT_URL }}common',
                    'vendor': '{{ CILANTRO_JAVASCRIPT_URL }}vendor',
                    'jquery': '{{ CILANTRO_JAVASCRIPT_URL }}vendor/jquery',
                    'backbone': '{{ CILANTRO_JAVASCRIPT_URL }}vendor/backbone',
                    'underscore': '{{ CILANTRO_JAVASCRIPT_URL }}vendor/underscore',
                    'pubsub': '{{ CILANTRO_JAVASCRIPT_URL }}vendor/pubsub'
                },
                priority: ['cilantro/core']
            };
        </script>

        <script data-main="cilantro/main" src="{{ CILANTRO_JAVASCRIPT_URL }}vendor/require.js"></script>

        {% block scripts %}{% endblock %}
    </body>
</html>
