{% load kegweblib %}
{% load humanize %}
{% if USE_FACEBOOK %}{% load facebook_tags %}{% endif %}
<!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" xml:lang="en" lang="en">
<head>
  <title>kegbot :: {% block title %}Default Page{% endblock %}</title>
  <link rel="stylesheet" href="{{ STATIC_URL }}style.css" />
  <link rel="icon" type="image/png" href="{{ STATIC_URL}}images/kegbot-icon-72x72.png" />
  <style>
    body {
  {% if kbsite %}{% if kbsite.background_image %}
      background-image: url({{kbsite.background_image.image.url}});
  {% else %}
      background-image: url({{ STATIC_URL }}images/background.png);
  {% endif %} {% endif %}
    }
  </style>

  <script type="text/javascript" src="http://www.google.com/jsapi"></script>
  <script type="text/javascript">
    google.load("jquery", "1");
    google.load("jqueryui", "1");
    google.load('visualization', '1', {'packages':['table']});
  </script>
  <script type="text/javascript" src="{{ STATIC_URL }}js/kegweb.js"></script>
  {% if kbsite.url %}
  <script>
    kegweb.API_BASE = "/{{ kbsite.url }}/api/";
  </script>
  {% endif %}
  <script type="text/javascript" src="{{ STATIC_URL }}js/jquery.cookie.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}js/jquery.timeago.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}js/jquery.autounits.js"></script>
  <script type="text/javascript">
    $(document).ready(function() {
        var defaultUseMetric = {% if kbsettings.display_units != 'metric' %}false{% else %}true{% endif%};
        kegweb.refreshDisplayUnits(defaultUseMetric);
        kegweb.onReady();
        $("abbr.timeago").timeago();
    });
  </script>
  <script type="text/javascript" src="{{ STATIC_URL }}highcharts/js/highcharts.js"></script>
  {% block kb-extrajs %}{%endblock%}
</head>

<body>

  <div id="kb-main-page">

    <div id="kb-main-header">
      <div class="clear"></div>

      {% block header-text %}{% endblock %}

      <div id="kb-main-header-links">
        {% if kbsite %}
        <div class="kb-header-link">
          <a href="{% url kb-home kbsite.url %}">main</a>
        </div>

        <div class="kb-header-link">
          <a href="{% url kb-kegs kbsite.url %}">kegs</a>
        </div>

        <div class="kb-header-link">
          <a href="{% url kb-stats kbsite.url %}">all-time stats</a>
        </div>

        {% if user.is_staff %}
        <div class="kb-header-link">
          <a href="{% url kegadmin-main kbsite.url %}">keg admin</a>
        </div>
        {% endif %}

        {% endif %}

        {% if user.is_authenticated %}
        <div class="kb-header-link">
          <a href="/account">account</a>
        </div>

        <div class="kb-header-link">
          <a href="{% url django.contrib.auth.views.logout %}">logout {{user.username}}</a>
        </div>
        {% else %}
        <div class="kb-header-link">
          <a href="/accounts/login">login</a>
        </div>
        {% endif %}

        <div style="clear: both;"> </div>
      </div>
    </div>

    {% if messages %}
    <div id="kb-message-container">
      {% for message in messages %}
        <div class="kb-message-box">
          <div class="kb-message-{{message.tags}}">
            {{message}}
          </div>
        </div>
      {% endfor %}
    </div>
    {% endif %}

    {% block header-margin %}
    <div id="kb-pagetitle">
      <h1>{% block pagetitle %}kegbot{% endblock %}</h1>
    </div>
    {% endblock %}

    <div id="kb-main-container">

      {% if page_node %}
      <div class="kb-main-content">
        {% render_page page_node %}
      </div>
      {% endif %}

      <div class="kb-main-content">
        {% block content %}{% endblock %}
      </div> <!-- kb-main-content -->

      {% block extra-content %}{% endblock %}

    </div> <!-- kb-main-container -->

    <div id="kb-footer">
      this is <a href="http://kegbot.org/">kegbot</a>:
      &copy; 2003-{% now "Y" %} mike wakerly<br>

      <span id="units-selector"></span> |
      charts by <a href="http://highcharts.com/">highcharts</a>
    </div>

  </div> <!-- kb-main-page -->

</body>

