{% load i18n coop_edition coop_bar_tags %}
{% if_cms_edition %}
<!DOCYTPE HTML>
<html>
{% else %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="{{LANG}}" xml:lang="{{LANG}}">
{% endif %}
<head>
  <meta charset="utf-8">
  <title>{{newsletter.subject}}</title>
  {% if editable %}
    {% if_cms_edition %}
      {% cms_form_media %}
    {% else %}
      <link rel="stylesheet" href="{{STATIC_URL}}css/colorbox.css" type="text/css" />
      <script type="text/javascript" src="{{STATIC_URL}}js/jquery-1.7.1.min.js"></script>
      <script type="text/javascript" src="{{STATIC_URL}}js/jquery.form.js"></script>
      <script type="text/javascript" src="{{STATIC_URL}}js/jquery.pageslide.js"></script>
      <script type="text/javascript" src="{{STATIC_URL}}js/jquery.colorbox-min.js"></script>
      <script type="text/javascript" src="{{STATIC_URL}}js/colorbox.coop.js"></script>
    {% endif %}
    {% coop_bar_headers %}
  {% endif %}
  {% if_cms_edition %}
  <script>
    $(function(){
        //move the form submit to the coop_bar
        $("form#cms_form input[type='submit']").hide();
        $('.post-form').click(function(event) {
            $("form#cms_form").submit();    
            event.preventDefault();
        });
    })
    </script>
  {% endif %}
</head>
<body {% block body_args%}style="background: #eee;"{% endblock %}>
    {% if by_email %}
    {% block email_only_header %}
    <div style="font-size: 11px; text-align: center; width: 100%;">
        <div class="item">
            {% trans "If you can't view this email, " %}
            <a href="{{SITE_PREFIX}}{{ newsletter.get_absolute_url }}">
                {% trans "read the online version" %}
            </a>
        </div>
    </div>
    {% endblock %}
    {% endif %}
    
    {% block newsletter %}
    <div style="font-size: 12px; width: 600px; padding: 20px 20px; border: solid thin #ccc; background: #fff; margin: auto;">
        {% cms_edit newsletter %}
            <div id="content">{{ newsletter.content }}</div>
            {% include "coop_cms/_newsletter_articles.html" %}
        {% end_cms_edit %}
    </div>
    {% endblock %}
    
    {% if by_email %}
    {% block email_only_footer %}
        {% comment %}Put unsunbscribe link here{% endcomment %}
    {% endblock %}
    {% endif %}

    {% if editable %}
      {% include "coop_cms/_messages.html" %}
      {% coop_bar %}
    {% endif %}
</body>
