<!doctype html>
<html class="no-js" lang="en">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />

		<title>{% block windowtitle %}{{ SITENAME }}{% endblock %}</title>
		<meta name="description" content="">
		<meta name="author" content="{{ AUTHOR }}">

		<link rel="stylesheet" href="{{ SITEURL }}/theme/css/foundation.css" />
		{% if not FOUNDATION_PYGMENT_THEME %}
		{% set FOUNDATION_PYGMENT_THEME = 'monokai' %}
		{% endif %}
		<link rel="stylesheet" href="{{ SITEURL }}/theme/css/pygment/{{ FOUNDATION_PYGMENT_THEME }}.css" />
		<link rel="stylesheet" href="{{ SITEURL }}/theme/css/custom.css" />

		{% if FOUNDATION_ALTERNATE_FONTS %}
		<!-- GOOGLE WEB FONTS -->
		<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700|Droid+Sans+Mono|Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
		<link rel="stylesheet" href="{{ SITEURL }}/theme/css/alt-fonts.css" />
		{% endif %}

		<script src="{{ SITEURL }}/theme/js/modernizr.js"></script>

		<!-- Feeds -->
		{% if FEED_ALL_ATOM %}
		<link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Atom Feed" />
		{% endif %}
		{% if FEED_ALL_RSS %}
		<link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS Feed" />
		{% endif %}

		{% include "analytics.html" %}

		<!-- mathjax config similar to math.stackexchange -->
		<script type="text/x-mathjax-config">
		MathJax.Hub.Config({
			jax: ["input/TeX", "output/HTML-CSS"],
			tex2jax: {
				inlineMath: [ ['$', '$'] ],
				displayMath: [ ['$$', '$$']],
				processEscapes: true,
				skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
			},
			messageStyle: "none",
			"HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"] }
		});
		</script>
		<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
	</head>
	<body>
		<div class="off-canvas-wrap">
			<div class="inner-wrap">
				<!-- mobile top bar to activate nav -->
				<nav class="tab-bar show-for-small">
					<section class="left-small">
						<a class="left-off-canvas-toggle menu-icon" ><span></span></a>
					</section>

					<section class="middle tab-bar-section">
						<h1 class="title">{{ SITENAME|replace(' ', '&nbsp;') }}</h1>
					</section>
				</nav>

				<!-- mobile side bar nav -->
				<aside class="left-off-canvas-menu">
					<ul class="off-canvas-list">
						<li><a href="{{ SITEURL }}">Home</a></li>
						<li><label>Categories</label></li>
						{% for cat, articles in categories %}
							<li {% if cat == category %}class="active"{% endif %}><a href="{{ SITEURL }}/{{ cat.url }}">{{ cat }}</a></li>
						{% endfor %}

						<li><label>Places</label></li>
							{% for name, link in LINKS %}
							<li><a href="{{ link }}">{{ name }}</a></li>
							{% endfor %}

						{% if FOUNDATION_TAGS_IN_MOBILE_SIDEBAR %}
						<li><label>Tags</label></li>
							{% for tag, articles in tags|sort %}
							<li><a href="{{ SITEURL }}/{{ tag.url|replace(' ', '-') }}">{{ tag }}</a></li>
							{% endfor %}
						{% endif %}

						{% if MONTH_ARCHIVE_SAVE_AS %}
						<li><label>Monthly Archives</label></li>
							{% for year, date_year in dates|groupby( 'date.year' )|sort(reverse=True) %}
								{% for month, articles in date_year|groupby( 'date.month' )|sort(reverse=True) %}
									<li><a href="/{{ MONTH_ARCHIVE_SAVE_AS.format(date=articles[0].date) }}">{{ articles[0].date.strftime('%B') }} {{ year }} ({{ articles|count }})</a></li>
								{% endfor %}
							{% endfor %}
						{% endif %}

						<li><label>Links</label></li>
							{% for name, link in SOCIAL|sort %}
							<li><a href="{{ link }}">{{ name }}</a></li>
							{% endfor %}
					</ul>	
				</aside>

				<!-- top bar nav -->
				<nav class="top-bar hide-for-small-only" data-topbar>
					<ul class="title-area">
						<li class="name">
							<h1><a href="{{ SITEURL }}/">{{ SITENAME }}</a></h1>
						</li>
					</ul>

					<section class="top-bar-section">
						<ul class="left">
							{% for cat, articles in categories %}
								<li {% if cat == category %}class="active"{% endif %}><a href="{{ SITEURL }}/{{ cat.url }}">{{ cat }}</a></li>
							{% endfor %}
						</ul>
					</section>
				</nav>

				<!-- Main Page Content and Sidebar -->
				<section class="main-section">
					<div class="row">
						<!-- Main Content -->
						<div class="medium-9 small-12 columns" role="content">
							{% if pagetitle is defined %}
							<div class="row">
								<div class="small-12 columns">
									<h2>{{ pagetitle }}</h2>
								</div>
							</div>
							{% endif %}
							{% block content %}{% endblock %}
						</div>
						<!-- End Main Content -->
						<!-- Sidebar -->
						<aside class="medium-3 hide-for-small-only columns">
							<div class="panel">
								<h5>Places</h5>
								<ul class="side-nav">
									{% for name, link in LINKS %}
									<li><a href="{{ link }}">{{ name }}</a></li>
									{% endfor %}
								</ul>
							</div>

							<div class="panel">
								<h5>Tags</h5>
								<ul class="tag-cloud">
									{% for tag in tag_cloud %}
										<li class="tag-{{ tag.1 }}"><a href="{{ SITEURL }}/{{ tag.0.url }}">{{ tag.0 }}</a></li>
									{% endfor %}
								</ul>
							</div>

							{% if MONTH_ARCHIVE_SAVE_AS %}
							<div class="panel">
								<h5>Monthly Archives</h5>
								<ul class="side-nav">
									{% for year, date_year in dates|groupby( 'date.year' )|sort(reverse=True) %}
										{% for month, articles in date_year|groupby( 'date.month' )|sort(reverse=True) %}
											<li><a href="/{{ MONTH_ARCHIVE_SAVE_AS.format(date=articles[0].date) }}">{{ articles[0].date.strftime('%B') }} {{ year }} ({{ articles|count }})</a></li>
										{% endfor %}
									{% endfor %}
								</ul>
							</div>
							{% endif %}

							<div class="panel">
								<h5>Links</h5>
								<ul class="side-nav">
									{% for name, link in SOCIAL|sort %}
									<li><a href="{{ link }}">{{ name }}</a></li>
									{% endfor %}
								</ul>
							</div>
						</aside>
						<!-- End Sidebar -->
					</div>

					<!-- Footer -->
					<footer class="row">
						<div class="medium-9 small-12">
							<hr/>
							{% if not FOUNDATION_FOOTER_TEXT %}
							{% set FOUNDATION_FOOTER_TEXT = 'Powered by <a href="http://getpelican.com">Pelican</a> and <a href="http://foundation.zurb.com/">Zurb Foundation</a>. Theme by <a href="http://hamaluik.com">Kenton Hamaluik</a>.' %}
							{% endif %}
							<p class="text-center">{{ FOUNDATION_FOOTER_TEXT }}</p>
						</div>
					</footer>
					<!-- End Footer -->
				</section>
				<a class="exit-off-canvas"></a>
			</div><!--off-canvas inner-->
		</div><!--off-canvas wrap-->

		<script src="{{ SITEURL }}/theme/js/jquery.js"></script>
		<script src="{{ SITEURL }}/theme/js/foundation.min.js"></script>
		<script>
			$(document).foundation();
		</script>
	</body>
</html>
