<%#
Copyright 2008-2013 Concur Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
%>
<% var language_tabs = current_page.data.language_tabs || []; %>
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title><%= current_page.data.title || "API Documentation" %></title>

    <style>
    </style>
    <%- stylesheet_link_tag('screen','screen') %>
    <%- stylesheet_link_tag('print','print') %>
    <%- stylesheet_link_tag(current_page.data.highlight_theme||'darkula','screen') %>
    <% if (current_page.data.search) {%>
      <%- javascript_include_tag("all") %>
    <% } else { %>
      <%- javascript_include_tag("all_nosearch") %>
    <% } %>
  </head>

  <body <% if (current_page.page_classes) {%>class="<%= current_page.page_classes %>" <% } %>data-languages="<%- language_array(current_page.data.language_tabs) %>">
    <a href="#" id="nav-button">
      <span>
        NAV
        <%- image_tag('navbar.png','Navigation') %>
      </span>
    </a>
    <div class="toc-wrapper">
      <%- image_tag("logo.png", 'Logo', 'logo') %>
      <% if (language_tabs.length>0) {%>
        <div class="lang-selector">
          <% for (var lang in language_tabs) { %>
            <% if (typeof language_tabs[lang] === 'object') { %>
              <a href="#" data-language-name="<%= Object.keys(language_tabs[lang])[0] %>"><%= language_tabs[lang][Object.keys(language_tabs[lang])[0]] %></a>
            <% } else { %>
              <a href="#" data-language-name="<%= language_tabs[lang] %>"><%= language_tabs[lang] %></a>
            <% } %>
          <% } %>
        </div>
      <% } %>
      <% if (current_page.data.search) { %>
        <div class="search">
          <input type="text" class="search" id="input-search" placeholder="Search">
        </div>
        <ul class="search-results"></ul>
      <% } %>
      <div id="toc" class="toc-list-h1">
	  	<ul class="toc-list-h1">
        <% for (var h1 of toc_data(page_content)) { %>
          <li>
            <a href="#<%= h1.id %>" class="toc-h1 toc-link" data-title="<%= h1.content %>"><%= h1.content %></a>
            <% if (h1.children && (h1.children.length > 0)) { %>
              <ul class="toc-list-h2">
                <% for (var h2 of h1.children) { %>
                  <li>
                    <a href="#<%= h2.id %>" class="toc-h2 toc-link" data-title="<%= h1.content %>"><%= h2.content %></a>
                  </li>
                <% } %>
              </ul>
            <% } %>
          </li>
        <% } %>
		</ul>
      </div>
      <% if (current_page.data.toc_footers) { %>
        <ul class="toc-footer">
          <% for (var footer in current_page.data.toc_footers) { %>
            <li><%- current_page.data.toc_footers[footer] %></li>
          <% } %>
        </ul>
      <% } %>
    </div>
    <div class="page-wrapper">
      <div class="dark-box"></div>
      <div class="content">
        <%- page_content %>
        <% if (current_page.data.includes) { for (var include in current_page.data.includes) { %>
          <%- partial(current_page.data.includes[include]) %>
        <% } %>
      </div>
      <div class="dark-box">
        <% if (language_tabs) %>
          <div class="lang-selector">
            <% for (var lang in language_tabs) { %>
              <% if (typeof language_tabs[lang] === 'object') { %>
                <a href="#" data-language-name="<%= Object.keys(language_tabs[lang])[0] %>"><%= language_tabs[lang][Object.keys(language_tabs[lang])[0]]  %></a>
              <% } else { %>
                <a href="#" data-language-name="<%= language_tabs[lang] %>"><%= language_tabs[lang] %></a>
              <% } %>
            <% } %>
          </div>
        <% } %>
      </div>
    </div>
  </body>
</html>
