<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="UTF-8">
    <link rel="stylesheet" href="../static/css/materialize.css"/>
    <link rel="stylesheet" href="../static/css/style-page.css">
    <link type="text/css" rel="stylesheet" href="../static/css/baguetteBox.min.css"  media="screen,projection"/>
    {% if gallery.panorama_enabled %}
    <link type="text/css" rel="stylesheet" href="../static/css/panorama_viewer.css"  media="screen,projection"/>
    {% endif %}
    {% if gallery.audio_enabled %}
    <link type="text/css" rel="stylesheet" href="../static/css/mediaelementplayer.css"  media="screen,projection"/>
    {% endif %}
    <link rel="stylesheet" href="../static/css/font-awesome.css">

    <!--Let browser know website is optimized for mobile-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    {% if gallery.description %}
    <meta name="description" content="{{ gallery.description }}" />
    {% endif %}
    {% if gallery.lang %}
    <meta name="language" content="{{ gallery.lang }}" />
    {% endif %}
    {% if settings.settings.og %}
    {% include "opengraph.html" %}
    {% endif %}

    <title>{{ gallery.title }} · {{ settings.title }}</title>
  </head>

  <body class="night">
    <main>

    {% for section in gallery.sections %}
    {% include "sections/" + section.type + ".html" %}
    {% endfor %}

    {% if settings.share %}
    {% include 'share.html' -%}
    {% endif %}
    <div class="container home center-align">
      <a href="../" class="btn-floating btn-xlarge blue-grey darken-1">
        <i class="fa fa-home"></i>
      </a>
    </div>

    <script type="text/javascript" src="../static/js/jquery-2.1.4.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="../static/js/materialize.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="../static/js/baguetteBox.min.js" charset="utf-8"></script>
    {% if gallery.panorama_enabled %}
    <script type="text/javascript" src="../static/js/jquery.panorama_viewer.min.js" charset="utf-8"></script>
    {% endif %}
    <script type="text/javascript" src="../static/js/jquery.lazyload.min.js" charset="utf-8"></script>
    {% if gallery.audio_enabled %}
    <script type="text/javascript" src="../static/js/mediaelement-and-player.min.js" charset="utf-8"></script>
    {% endif %}
    <script type="text/javascript" charset="utf-8">
$(document).ready(function(){
  $('.parallax').parallax();
});    

function goFullscreen(id) {
  var element = document.getElementById(id);
  if (element.requestFullscreen) {
    element.requestFullscreen();
  } else if (element.mozRequestFullScreen) {
    element.mozRequestFullScreen();
  } else if (element.webkitRequestFullScreen) {
    element.webkitRequestFullScreen();
  }  
}

{% if gallery.audio_enabled %}
$('audio').mediaelementplayer({
  alwaysShowControls: true,
  features: ['playpause','progress','volume'],
  audioVolume: 'horizontal',
  audioWidth: 450,
  audioHeight: 30,
  iPadUseNativeControls: true,
  iPhoneUseNativeControls: true,
  AndroidUseNativeControls: true
});
{% endif %}


$(function() {
  $("img.lazy").lazyload({
    threshold : 400,
    effect : "fadeIn"
  });
  $("video.lazy").lazyload({
    threshold : 400,
    effect : "fadeIn"
  });
});

$(function() {
  baguetteBox.run(".baguette", {});
  {% if gallery.panorama_enabled %}
  $(".panorama").panorama_viewer({
    repeat: true,
    direction: "horizontal",
    animationTime: 150,
    easing: "linear",
    overlay: true
  });
  {% endif %}
});

{% if settings.settings.light_mode %}
var slowLoad = window.setTimeout( function() {
  var html_node = document.getElementsByTagName('html')[0];
  var div = document.createElement('div');
  div.setAttribute('id', 'slow-notice');
  var t1 = document.createTextNode("The website is taking a long time to load.");
  var br = document.createElement('br');
  var t2 = document.createTextNode("You can switch to the ");
  var a = document.createElement('a');
  a.setAttribute('href', './light');
  a.innerHTML = 'Light Weight Site';

  var dismiss = document.createElement('span');
  dismiss.innerHTML = '[x] dismiss';
  dismiss.setAttribute('class', 'dismiss');
  dismiss.onclick = function() {
    html_node.removeChild(div);
  }

  var dismiss_container = document.createElement('div');
  dismiss_container.appendChild(dismiss);
  dismiss_container.setAttribute('class', 'dismiss-container');

  div.appendChild(t1);
  div.appendChild(br);
  div.appendChild(t2);
  div.appendChild(a);
  div.appendChild(dismiss_container);

  html_node.appendChild(div);
}, 10000 );

window.addEventListener( 'load', function() {
  try {
    window.clearTimeout( slowLoad );
    html_node.removeChild(div);
  } catch (e){
    // that's okay.
  }

});
{% endif %}

$(".button-collapse").sideNav();
    </script>
    </main>
    {% include 'footer.html'%}
  </body>
</html>
