{% load i18n %}
{% 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 %}	

        <link rel="stylesheet" href="{{ MEDIA_URL }}web_theme_media/stylesheets/base.css" type="text/css" media="screen" />
        <link rel="stylesheet" id="current-theme" href="{{ MEDIA_URL }}web_theme_media/stylesheets/themes/{{ web_theme }}/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> 
        {% block web_theme_stylesheets %}{% endblock %}

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

        {% block web_theme_javascript %}{% endblock %}
       
        <script type="text/javascript">
            $(document).ready(function() {
                $(".message").fadeIn("slow");
                $(".dismiss").click(function(){
                    $(this).parent().parent().fadeOut("slow"); return false;
                });
                $(".dismiss-all").click(function(){
                    $(".message").each(function(){
                        $(this).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>
	</head>
	<body>
        <div id="container">
            {% if user.is_anonymous %}
                <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="user-navigation">
                                <ul class="wat-cf">
                                    {% block web_theme_user_navigation %}{% endblock %}
                                </ul>
                            </div>
                        <div id="main-navigation">
                            <ul class="wat-cf">
                                {% block web_theme_main_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="message{% if message.tags %}{% if 'success' in message.tags %} notice{% endif %} {{ message.tags }}{% else %} notice{% endif %}" style="display: none;">
                                            <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-->
    </body>
</html>
