{#
    sphinxdoc/layout.html
    ~~~~~~~~~~~~~~~~~~~~~

    Sphinx layout template for the sphinxdoc theme.

    :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
#}
{%- extends "./basic_layout.html" %}

{# put the sidebar before the body #}
{% block sidebar1 %}{{ sidebar() }}{% endblock %}
{% block sidebar2 %}{% endblock %}

{% block extrahead %}
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,700'
          rel='stylesheet' type='text/css' />
{{ super() }}
{%- if not embedded %}
    <style type="text/css">
      table.right { float: right; margin-left: 20px; }
      table.right td { border: 1px solid #ccc; }
    </style>
    <script>
      // intelligent scrolling of the sidebar content
      $(window).scroll(function() {
        var sb = $('.sphinxsidebarwrapper');
        var win = $(window);
        var sbh = sb.height();
        var offset = $('.sphinxsidebar').position()['top'];
        var wintop = win.scrollTop();
        var winbot = wintop + win.innerHeight();
        var curtop = sb.position()['top'];
        var curbot = curtop + sbh;
        // does sidebar fit in window?
        if (sbh < win.innerHeight()) {
          // yes: easy case -- always keep at the top
          sb.css('top', $u.min([$u.max([0, wintop - offset - 10]),
                                $(document).height() - sbh - 200]));
        } else {
          // no: only scroll if top/bottom edge of sidebar is at
          // top/bottom edge of window
          if (curtop > wintop && curbot > winbot) {
            sb.css('top', $u.max([wintop - offset - 10, 0]));
          } else if (curtop < wintop && curbot < winbot) {
            sb.css('top', $u.min([winbot - sbh - offset - 20,
                                  $(document).height() - sbh - 200]));
          }
        }
      });
    </script>
{%- endif %}
{% endblock %}

{% block rootrellink %}
    <li>[ <a href="{{ pathto('intro') }}">intro</a> |</li>
    <li><a href="{{ pathto('parameters') }}">parameters</a> |</li>
    <li><a href="{{ pathto('fitting') }}">minimize</a> |</li>
    <li><a href="{{ pathto('model') }}">model</a> |</li>
    <li><a href="{{ pathto('builtin_models') }}">built-in models</a> |</li>
    <li><a href="{{ pathto('confidence') }}">confidence intervals</a> |</li>
    <li><a href="{{ pathto('bounds') }}">bounds</a> |</li>
    <li><a href="{{ pathto('constraints') }}">constraints</a> ]</li>
{% endblock %}

{% block header %}
<div class="pageheader">
  <ul>
    <li><a href="{{ pathto('contents') }}">Contents</a></li>
    <li><a href="{{ pathto('examples/index') }}">Examples</a></li>
    <li><a href="{{ pathto('installation') }}">Installation</a></li>
    <li><a href="{{ pathto('faq') }}">FAQ</a></li>
    <li><a href="{{ pathto('support') }}">Support</a></li>
    <li><a href="https://github.com/lmfit/lmfit-py">Develop</a></li>
  </ul>
  <div>
    <a href="{{ pathto('index') }}">
      <img src="{{ pathto('_static/lmfitheader.png', 1) }}" alt="LMFIT" />
    </a>
  </div>
</div>
{% endblock %}
