<!DOCTYPE html>

{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and (sidebars != []) %}
{%- set url_root = pathto('', 1) %}
{%- if url_root == '#' %}{% set url_root = '' %}{% endif %}

{%- macro relbar(bottom=False) %}
    <div class="related{% if bottom %} related-bottom{% endif %}">
        <ul class="nav">
            {%- block rootrellink %}
                <li class=""><a class="brand" href="{{ pathto(master_doc) }}">{{ project|e }}</a></li>
            {%- endblock %}
            {% block navbartoc %}
              {% include "globaltoc.html" %}
              {% include "localtoc.html" %}
            {% endblock %}
            {%- for rellink in rellinks %}
                <li>
                    <a href="{{ pathto(rellink[0]) }}"
                       title="{{ rellink[1]|striptags|e }}" {{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a>
                    {%- if not loop.first %}{% endif %}
                </li>
            {%- endfor %}
            {%- for parent in parents %}
                <li><a href="{{ parent.link|e }}"
                        {% if loop.last %}{{ accesskey("U") }}{% endif %}>{{ parent.title }}</a>
                </li>
            {%- endfor %}
            {%- block relbaritems %} {% endblock %}
        </ul>
    </div>
{%- endmacro %}

{%- macro sidebar() %}
    {%- if render_sidebar %}
        <div class="sphinxsidebar">
            <div class="sphinxsidebarwrapper">
                {%- if sidebars != None %}
                    {#- new style sidebar: explicitly include/exclude templates #}
                    {%- for sidebartemplate in sidebars %}
                        {%- include sidebartemplate %}
                    {%- endfor %}
                {%- else %}
                    {#- old style sidebars: using blocks -- should be deprecated #}
                    {%- block sidebartoc %}
                        {%- include "localtoc.html" %}
                    {%- endblock %}
                    {%- block sidebarrel %}
                        {%- include "relations.html" %}
                    {%- endblock %}
                    {%- block sidebarsourcelink %}
                        {%- include "sourcelink.html" %}
                    {%- endblock %}
                    {%- if customsidebar %}
                        {%- include customsidebar %}
                    {%- endif %}
                {%- endif %}
            </div>
        </div>
    {%- endif %}
{%- endmacro -%}

{%- macro seachbox() %}
    {%- if pagename != "search" %}
        <form class="navbar-search" action="{{ pathto('search') }}"
              method="get">
            <input type="text" name="q" placeholder="search"/>
            <input type="hidden" name="check_keywords" value="yes"/>
            <input type="hidden" name="area" value="default"/>
        </form>
    {%- endif %}
{%- endmacro -%}

<html>
<head>
    <meta http-equiv="Content-Type"
          content="text/html; charset={{ encoding }}"/>
    {{ metatags }}
    {%- if not embedded and docstitle %}
        {%- set titlesuffix = " &mdash; "|safe + docstitle|e %}
    {%- else %}
        {%- set titlesuffix = "" %}
    {%- endif %}
    {%- block htmltitle %}
        <title>{{ title|striptags|e }}{{ titlesuffix }}</title>
    {%- endblock %}
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href='http://fonts.googleapis.com/css?family=Crete+Round' 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"/>
    {%- for cssfile in css_files %}
        <link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css"/>
    {%- endfor %}
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    {%- if not embedded %}
        <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 + ["_static/bootstrap-dropdown.js"] %}
            <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
        {%- endfor %}

        {%- 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 %}
        {%- if favicon %}
            <link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
        {%- endif %}
    {%- 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 %}
<script type="text/javascript">
(function () {
  /**
   * Patch TOC list.
   *
   * Will mutate the underlying span to have a correct ul for nav.
   *
   * @param $span: Span containing nested UL's to mutate.
   * @param minLevel: Starting level for nested lists. (1: global, 2: local).
   */
  var patchToc = function ($ul, minLevel) {
    var findA;

    // Find all a "internal" tags, traversing recursively.
    findA = function ($elem, level) {
      var level = level || 0,
        $items = $elem.find("> li > a.internal, > ul, > li > ul");

      // Iterate everything in order.
      $items.each(function (index, item) {
        var $item = $(item),
          tag = item.tagName.toLowerCase(),
          pad = 15 + ((level - minLevel) * 10);

        if (tag === 'a' && level >= minLevel) {
          // Add to existing padding.
          $item.css('padding-left', pad + "px");
          console.log(level, $item, 'padding-left', pad + "px");
        } else if (tag === 'ul') {
          // Recurse.
          findA($item, level + 1);
        }
      });
    };

    console.log("HERE");
    findA($ul);
  };

  $(document).ready(function () {
    // Add styling, structure to TOC's.
    $(".dropdown-menu").each(function () {
      $(this).find("ul").each(function (index, item){
        var $item = $(item);
        $item.addClass('unstyled');
      });
      $(this).find("li").each(function () {
        $(this).parent().append(this);
      });
    });

    // Patch in level.
    patchToc($("ul.globaltoc"), 2);
    patchToc($("ul.localtoc"), 2);

    // Enable dropdown.
    $('.dropdown-toggle').dropdown();
  });
}());
</script>
    {% endblock %}

    <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
    {% if theme_analytics_code %}
        <!-- analytics -->
        <script type="text/javascript">
            var _gaq = _gaq || [];
            _gaq.push(['_setAccount', '{{ theme_analytics_code }}']);
            {% if theme_analytics_domain %}
                _gaq.push(['_setDomainName', '{{ theme_analytics_domain }}']);
            {% endif %}
            _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 %}
</head>
<body>


{%- block header %}

    <div class="navbar navbar-static-top">
        <div class="navbar-inner">
            <div class="container">

                {%- block headerlogo %}
                    {%- if logo %}
                        <a href="{{ pathto(master_doc) }}">
                            <img class="logo" src="{{ pathto('_static/' + logo, 1) }}"
                            {% if theme_logo_width %} width="{{ theme_logo_width }}"{% endif %}
                            {% if theme_logo_height %} height="{{ theme_logo_height }}"{% endif %}
                            alt="{{ project|e }}" title="{{ project|e }}"/>
                        </a>
                    {%- else %}
{#                        <a class="brand" href="./index.html">Bootstrap</a>#}
                    {%- endif %}
                {%- endblock %}

                {%- block relbar1 %}{{ relbar() }}{% endblock %}
                <div class="pull-right">
                    {{ seachbox() }}
                </div>
            </div>
        </div>
    </div>
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=185895481442185";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
{% endblock %}

<ul class="quick-links">
    <li><strong>Quick links</strong></li>
    <li>
        <a href="https://github.com/{{ theme_github_user }}/{{ theme_github_repo }}/">GitHub</a>
    </li>
    <li>
        <a href="https://github.com/{{ theme_github_user }}/{{ theme_github_repo }}/issues?state=open">Issues</a>
    </li>
    <li class="divider">&middot;</li>
    <li>
        <iframe class="github-btn"
                src="http://ghbtns.com/github-btn.html?user={{ theme_github_user }}&repo={{ theme_github_repo }}&type=watch&count=true"
                allowtransparency="true" frameborder="0" scrolling="0"
                width="110px" height="20px"></iframe>
    </li>
    <li>
        <iframe class="github-btn"
                src="http://ghbtns.com/github-btn.html?user={{ theme_github_user }}&repo={{ theme_github_repo }}&type=fork&count=true"
                allowtransparency="true" frameborder="0" scrolling="0"
                width="94px" height="20px"></iframe>
    </li>

    <li class="divider">&middot;</li>
    <li class="follow-btn">
        <a href="https://twitter.com/{{ theme_twitter_username }}"
           class="twitter-follow-button" data-width="145px"
           data-link-color="#0069D6" data-show-count="false">Follow
            @{{ theme_twitter_username }}</a>
    </li>
    <li class="tweet-btn">
        <a href="https://twitter.com/share" class="twitter-share-button"
           data-url="{{ theme_home_url }}" data-count="none"
           data-via="twbootstrap"
           data-related="{{ theme_twitter_username }}:Creator of {{ project|e }}">Tweet</a>
    </li>
    <li class="plusone-container">
        <g:plusone size="medium"></g:plusone>
    </li>
    <li class="like-container">
      <div class="fb-like" data-send="false" data-width="60" data-show-faces="false"></div>
    </li>
</ul>

{%- block content %}
    {%- block sidebar1 %} {# possible location for sidebar #} {% endblock %}
    <div class="container">
        <div class="content row">
            {%- block document %}
                <div class="span9">
                    {% block body %} {% endblock %}
                    {% if theme_disqus_shortname %}
                        <div id="disqus_thread"></div>
                        <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
                    {% endif %}
                </div>
            {%- endblock %}
            {%- block sidebar2 %}
                <div class="span3">
                    {{ sidebar() }}
                </div>
            {% endblock %}
        </div>
    </div>
{%- endblock %}

{%- block footer %}
    <div class="footer">
        {#        {%- block relbar2 %}{{ relbar(bottom=True) }}{% endblock %}#}
        <div class="container">
            {%- 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 {{ copyright }}.{% endtrans %}
                {%- endif %}
            {%- endif %}
            {%- if last_updated %}
                {% trans last_updated=last_updated|e %}Last updated
                    on {{ last_updated }}.{% endtrans %}
            {%- endif %}
            {%- if show_sphinx %}
                {% trans sphinx_version=sphinx_version|e %}Created using <a
                        href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}
                    .{% endtrans %}
                Theme <a href="https://github.com/scotch/sphinx-bootstrap">Sphinx-Bootstrap</a>
                adapted from
                <a href="http://twitter.github.com/bootstrap/">Twitter's
                    Bootstrap</a> by <a href="http://www.scotchmedia.com">Scotch
                Media</a>
            {%- endif %}
        </div>
    </div>
{%- endblock %}

{% if theme_disqus_shortname %}
    <!-- disqus -->
    <script type="text/javascript">
        var disqus_title = '{{ title|striptags|e }}{{ titlesuffix }}';
        var disqus_identifier ='code' + '.' + "{{ theme_disqus_shortname }}" + window.location.pathname.replace('/', '.');
    </script>

    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = "{{ theme_disqus_shortname }}"; // required: replace example with your forum shortname

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
{% endif %}

<script type="text/javascript">
    $('.nav .active').on('click', function () {
        e.preventDefault()
        $(this).siblings().toggle()
    });
</script>

<!-- plusone -->
<script type="text/javascript">
    (function () {
        var po = document.createElement('script');
        po.type = 'text/javascript';
        po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(po, s);
    })();
</script>

<!-- twitter -->
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>

</body>
</html>
