<!DOCTYPE html>
<html>
	<head>
		<title><?php echo Site::Appname(); ?><?php echo $meta->title ? ' - '.$meta->title : '' ?></title>
		<link rel="shortcut icon" href="<?php echo $meta->shortcut_icon ? $meta->shortcut_icon : '/media/img/favicon.ico' ?>" type="image/vnd.microsoft.icon" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta http-equiv="Content-Language" content="<?php echo $meta->language; ?>" />

		<meta name="keywords" content="<?php echo $meta->keywords; ?>" />
		<meta name="description" content="<?php echo $meta->description; ?>" />
		<meta name="copyright" content="<?php echo Config::copywrite(); ?>" />

		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">

		<?php
			if (Kohana::$environment >= Kohana::TESTING OR (Request::current() AND Request::current()->secure())) {
				echo HTML::style('media/theme/bootstrap/css/bootstrap.min.css');
				echo HTML::style('media/theme/bootstrap/css/bootstrap-theme.min.css');
				echo HTML::style('media/vendor/font-awesome/css/font-awesome.min.css');
			} else {
				echo HTML::style(Site::Protocol('maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'));
				echo HTML::style(Site::Protocol('maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css'));
			}

			echo HTML::style(Site::Protocol('fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800'));
			echo HTML::style('media/theme/bootstrap/css/custom.css');
			echo Style::factory()->render_all();
		?>
	</head>

	<body>
		<?php if (! empty($shownavbar)) : ?>
		<div class="navbar navbar-inverse navbar-fixed-top">
			<div class="navbar-inner">
				<div class="container">
					<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><i class="glyphicon glyphicon-cog"></i> </a>
					<a class="brand" href="<?php echo URL::site(); ?>"><?php echo Site::Appname(); ?><sup></sup></a>
				</div> <!-- /container -->
			</div> <!-- /navbar-inner -->

		</div> <!-- /nvarbar -->

		<div class="subnavbar">
			<div class="subnavbar-inner">
				<div class="container">
					<a class="btn-subnavbar collapsed" data-toggle="collapse" data-target=".subnav-collapse"><i class="icon-reorder"></i></a>

					<div id="nav" class="clearfix">
						<div class="container">
							<?php echo $navbar; ?>
						</div> <!-- /container -->
					</div> <!-- /nav -->

				</div> <!-- /container -->
			</div> <!-- /subnavbar-inner -->
		</div> <!-- /subnavbar -->
		 <?php endif ?>

		<div class="error_container">
			<div class="error_details">
				<div class="row">
					<div class="col-md-8 col-md-offset-2">
						<?php echo SystemMessage::factory()->render_all(); ?>
					</div>
				</div> <!-- /row -->
			</div> <!-- /error_details -->
		</div> <!-- /error_container -->

		<div class="main">
			<div class="container">
				<div class="row">
					<?php echo $content; ?>
				</div> <!-- /row -->
			</div> <!-- /container -->
		</div> <!-- /main -->

<!--
		<div class="extra">
			<div class="container">
				<div class="row">
					<div class="col-md-3">
						<h4>About</h4>
						<ul>
							<li><a href="javascript:;">About Us</a></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
-->

		<div class="footer">
			<div class="container">
				<div class="row">
					<div id="footer-copyright" class="col-md-6"><?php echo Config::Copywrite(TRUE); ?>. </div>
			
					<div id="footer-terms" class="col-md-6">
						All rights reserved
					</div> <!-- /.span6 -->
				</div> <!-- /row -->
			</div> <!-- /container -->
		</div> <!-- /footer -->

		<?php
			if (Kohana::$environment >= Kohana::TESTING OR (Request::current() AND Request::current()->secure())) {
				echo HTML::script('media/js/jquery/jquery-1.9.1.min.js');
				echo HTML::script('media/theme/bootstrap/js/bootstrap.min.js');
				echo HTML::script('media/js/lodash/lodash-1.2.1.min.js');
			} else {
				echo HTML::script(Site::Protocol('code.jquery.com/jquery-1.9.1.min.js'));
				echo HTML::script(Site::Protocol('maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js'));
				echo HTML::script(Site::Protocol('cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js'));
			}

			echo HTML::script('media/theme/bootstrap/js/bootstrap.validator.js');
			echo HTML::script('media/js/typeahead.bundle.min.js');
			echo HTML::script('media/js/search.js');
			echo HTML::script('media/js/custom.js');
			echo Script::factory()->render_all();
		?>
	</body>
</html>