{% load i18n %}
{% load static %}

{% load compress %}

{% load theme_tags %}

{% get_theme as web_theme %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="Content-Language" content="{{ LANGUAGE_CODE }}" />
        <title>{% block html_title %}{% endblock %}</title>

        {% block web_theme_head %}{% endblock %}

        {% compress css %}
        <link rel="stylesheet" href="{% static 'web_theme_media/stylesheets/base.css' %}" type="text/css" media="screen" />
        <link rel="stylesheet" id="current-theme" href="{{ STATIC_URL }}web_theme_media/stylesheets/themes/{{ web_theme|default:'activo' }}/style.css" type="text/css" media="screen" />
        <style type="text/css">
            .message span.dismiss {
                padding:0 5px;
                cursor:pointer;
                float:right;
                margin-right:10px;
            }
            .message span.dismiss-all {
                padding:0 5px;
                cursor:pointer;
                float:right;
                margin-right:10px;
            }
            .message a {
                text-decoration:none;
                font-weight:bold
            }
        </style>
        <link rel="stylesheet" href="{% static 'packages/animate-custom.css' %}" type="text/css" media="screen" />
        {% block web_theme_stylesheets %}{% endblock %}
        {% endcompress %}
    </head>
    <body>
        <div id="container">
            {% if web_theme_view_type == 'plain' %}
                <div id="box">
                    {% block content_plain %}{% endblock %}
                </div>
            {% else %}
                {% if not web_theme_hide_menus %}
                    <div id="header">
                        <h1><a href="{% url 'home' %}">{% block web_theme_project_name %}{% endblock %}</a></h1>
                        <div id="main-navigation">
                            <ul class="wat-cf" style="width: 73%;">
                                {% block web_theme_main_navigation %}{% endblock %}
                            </ul>
                        </div>
                        <div id="user-navigation">
                            <ul class="wat-cf">
                                {% block web_theme_user_navigation %}{% endblock %}
                            </ul>
                        </div>
                    </div>
                {% endif %}
                <div id="wrapper" class="wat-cf">
                    <div id="main">
                        {% if messages %}
                            <div class="inner">
                                <div class="flash">
                                    {% for message in messages %}
                                        <div class="animated fadeInDown message{% if message.tags %}{% if 'success' in message.tags %} notice{% endif %} {{ message.tags }}{% else %} notice{% endif %}">
                                            <p>
                                                {{ message }}
                                                <span class="dismiss-all"><a title="{% trans 'dismiss all notifications' %}">[{% trans 'close all' %}]</a></span>
                                                <span class="dismiss"><a title="{% trans 'dismiss this notification' %}">[{% trans 'close' %}]</a></span>
                                            </p>
                                         </div>
                                    {% endfor %}
                                </div>
                            </div>
                        {% endif %}
                        {% block web_theme_messages %}{% endblock %}
                        <div class="block" id="block-text">
                            {#{% if not web_theme_hide_menus %}#}
                                {% block web_theme_secondary_navigation %}{% endblock %}
                            {#{% endif %}#}
                            {% block web_theme_content %}{% endblock %}
                        </div><!--end .block #block-text-->
                        {% block web_theme_footer %}{% endblock %}
                    </div><!--end #main-->
                    <div id="sidebar">
                        {% block web_theme_sidebar %}{% endblock %}
                    </div><!--end #sidebar-->
                </div><!--end #wrapper .wat-cf-->
            {% endif %}
        </div><!--end #container-->

        {% compress js %}
        <script type="text/javascript" charset="utf-8" src="{% static 'packages/jquery-2.1.1.min.js' %}"></script>

        {% if enable_scroll_js %}
            <script type="text/javascript" charset="utf-8" src="{% static 'web_theme_media/javascripts/jquery.scrollTo.js' %}"></script>
            <script type="text/javascript" charset="utf-8" src="{% static 'web_theme_media/javascripts/jquery.localscroll.js' %}"></script>
        {% endif %}

        {% block web_theme_javascript %}{% endblock %}

        <script type="text/javascript">
            $(document).ready(function() {
                $(".dismiss").click(function(){
                    $(this).parent().parent().addClass("fadeOutUp").fadeOut("slow"); return false;
                });
                $(".dismiss-all").click(function(){
                    $(".message").each(function(){
                        $(this).addClass("fadeOutUp").fadeOut("slow");
                    });
                    return false;
                });
                $('th input:checkbox').click(function(e) {
                    var table = $(e.target).closest('table');
                    $('td input:checkbox', table).attr('checked', e.target.checked);
                });
            });
        </script>
        {% endcompress %}

    </body>
</html>
