{#
    basic/layout.html
    ~~~~~~~~~~~~~~~~~

    Master layout template for Sphinx themes.

    :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
#}
{%- block doctype -%}
<!DOCTYPE html>
{%- endblock %}
{%- set reldelim1 = reldelim1 is not defined and ' &raquo;' or reldelim1 %}
{%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %}
{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and
                         (sidebars != []) %}
{%- set script_files = script_files + ["_static/bootstrap.js",
                         "_static/overrides.js"] -%}                         

{%- set url_root = pathto('', 1) %}
{# XXX necessary? #}
{%- if url_root == '#' %}{% set url_root = '' %}{% endif %}
{%- if not embedded and docstitle %}
  {%- set titlesuffix = " &mdash; "|safe + docstitle|e %}
{%- else %}
  {%- set titlesuffix = "" %}
{%- endif %}

{%- macro relbar() %}

{% if theme_blackbar != "false" %}
    {% set navb_classes = "navbar navbar-inverse navbar-fixed-top" %}
{% else %}
    {% set navb_classes = "navbar navbar-fixed-top" %}
{% endif %} 

{% if theme_new_page_external_links != "false" %}
<script type="text/javascript">
//<![CDATA[
    window.new_page = 1
//]]>
</script>
{% endif %} 

<div class="{{ navb_classes }}">
    <div class="navbar-inner">
        <div class="container">

            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
               <span class="icon-bar"></span>
               <span class="icon-bar"></span>
               <span class="icon-bar"></span>
            </a>


            <a class="brand" href="{{ pathto(master_doc) }}"><img
            {%- if not logo %}
                src="{{ pathto('_static/img/logo.png', 1) }}" 
            {%- else %}
                src="{{pathto('_static/' + logo, 1)}}" 
            {%- endif %}
            alt="home">{{project}}</a>
        <div class="nav-collapse collapse"> 
            <ul class="nav">
                {%- for parent in parents %}
                <li class="scroll"><a href="{{ parent.link|e }}" {% if loop.last %}{{ accesskey("U") }}{% endif %}>{{ parent.title }}</a></li>
                {%- endfor %}
      
                <li class="dropdown scroll">
                    <a href="#" class="dropdown-toggle"
                        data-toggle="dropdown">Documentation <b class="caret"></b></a>

        <ul id="nav" class="dropdown-menu" role="menu" aria-labelledby="dLabel">
        {%- for item in raw_toctree() recursive %}

            {%- if not item.childs -%}
            <li class="scroll"> <a tabindex="-1" href="{{ item.href|e }}">{{ item.text }}</a> </li>
            {% else %}
            <li class="dropdown-submenu scroll">
                <a href="{{ item.href|e }}">{{ item.text }}</a>
                <ul class="dropdown-menu"> {{ loop(item.childs) }}</ul>
            </li>
            {%- endif %}
        {%- endfor %}
        </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle"
                        data-toggle="dropdown">Sections <b class="caret"></b></a>

        <ul id="nav" class="dropdown-menu" role="menu" aria-labelledby="dLabel">
        {%- for item in raw_localtoc() recursive %}

            {%- if not item.childs -%}
            <li class="scroll"> <a tabindex="-1" href="{{ item.href|e }}">{{ item.text }}</a> </li>
            {% else %}
            <li class="dropdown-submenu scroll">
                <a href="{{ item.href|e }}">{{ item.text }}</a>
                <ul class="dropdown-menu"> {{ loop(item.childs) }}</ul>
            </li>
            {%- endif %}
        {%- endfor %}
        </ul>

                </li>
               {%- if prev %}
               <li> <a title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}">Prev</a></li>
                {%- endif %}
               {%- if next %}
               <li> <a title="{{ next.title|striptags|e }}" href="{{ next.link|e }}">Next</a></li>
               {%- endif %}
            </ul>
            <ul class="nav pull-right">
                      <li class="divider-vertical"></li>
                      <li>
                         <form class="navbar-search pull-left"
                             action="{{ pathto('search')}}" method="GET">
                            <input type="text" name="q" class="search-query span2" placeholder="Search">
                        </form>
                      </li>
                    </ul>
            </div>
        </div>
    </div>
</div>
{%- endmacro %}

{%- macro sidebar() %}
      {%- if render_sidebar %}
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
          {%- block sidebarlogo %}
          {%- if logo %}
            <p class="logo"><a href="{{ pathto(master_doc) }}">
              <img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/>
            </a></p>
          {%- endif %}
          {%- endblock %}
        </div>
      </div>
      {%- endif %}
{%- endmacro %}

{%- macro script() %}
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '{{ url_root }}',
        VERSION:     '{{ release|e }}',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '{{ '' if no_search_suffix else file_suffix }}',
        HAS_SOURCE:  {{ has_source|lower }}
      };
    </script>
    {%- for scriptfile in script_files %}
    <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
    {%- endfor %}
{%- endmacro %}

{%- macro css() %}
    <link
href='http://fonts.googleapis.com/css?family=Source+Code+Pro|Merriweather'
rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
    <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
    <link rel="stylesheet" href="{{ pathto('_static/bootstrap-responsive.min.css', 1) }}" type="text/css" />
    {%- for cssfile in theme_css_files %}
    <link rel="stylesheet" href="{{ pathto('_static/' + cssfile, 1) }}" type="text/css" />

    {%- endfor %}
{%- endmacro %}

<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset={{ encoding }}" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    {{ metatags }}
    {%- block htmltitle %}
    <title>{{ title|striptags|e }}{{ titlesuffix }}</title>
    {%- endblock %}
    {{ css() }}
    {%- if not embedded %}
    {{ script() }}
    {%- if use_opensearch %}
    <link rel="search" type="application/opensearchdescription+xml"
          title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
          href="{{ pathto('_static/opensearch.xml', 1) }}"/>
    {%- endif %}
    <link rel="shortcut icon" href="{{ pathto('_static/' + 'favicon.ico', 1) }}"/>
    {%- endif %}
{%- block linktags %}
    {%- if hasdoc('about') %}
    <link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
    {%- endif %}
    {%- if hasdoc('genindex') %}
    <link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
    {%- endif %}
    {%- if hasdoc('search') %}
    <link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
    {%- endif %}
    {%- if hasdoc('copyright') %}
    <link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
    {%- endif %}
    <link rel="top" title="{{ docstitle|e }}" href="{{ pathto('index') }}" />
    {%- if parents %}
    <link rel="up" title="{{ parents[-1].title|striptags|e }}" href="{{ parents[-1].link|e }}" />
    {%- endif %}
    {%- if next %}
    <link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
    {%- endif %}
    {%- if prev %}
    <link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
    {%- endif %}
{%- endblock %}
{%- block extrahead %} {% endblock %}
  </head>
  <body >
  
{%- block header %}{% endblock %}


{%- block content %}



    <div class="wrapper">
        <div class="container" id="toprow">
            <div class="row-12">
                <div class="span12">
                    {%- block relbar1 %}{{ relbar() }}{% endblock %}
                    {%- block document %}
                    <div class="documentwrapper">
                        <div class="body" id="bdy">
                            {% block body %} {% endblock %}
                        </div>
                    </div>
                    {%- endblock %}
                </div>
            </div>
        </div>
        <div class="push"><!--//--></div>
    </div>

{%- endblock %}


{%- block footer %}
    <div class="footer container">
        <div class="span12">
            {%- if show_copyright %}
              {%- if hasdoc('copyright') %}
                {% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
              {%- else %}
              {% trans copyright=copyright|e %}&copy; Copyright 
              <span id="contact">{{ copyright }}. </span>
              {% endtrans %}
              {%- endif %}
            {%- endif %}
            {%- if show_sphinx %}
              {% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
            {%- endif %}
        </div>
    </div>
    {% if theme_analytics != "false" %}
    <script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', '{{theme_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 %}
    </body>
</html>
