<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<!--[if IE]>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<![endif]-->
	<?php $settings = DB::table('settings')->first(); ?>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="<?= $settings->headline ?>">
	<?php 
    if (isset($settings->sitename)){ ?>
    	<title><?= $settings->sitename ?> - @yield('title')</title>
    <?php }else {?>
		<title>Pixel - @yield('title')</title>
	<?php }?>
	<meta property="og:url"           content="<?= Request::url(); ?>" />
    <meta property="og:type"          content="website" />
    <meta property="og:title"         content="<?php if(isset($imgshare)) echo ucwords($imgshare->title); ?>" />
    <meta property="og:description"   content="<?php if(isset($imgshare)) echo ucwords(str_replace('"', '\'', $imgshare->description)); ?>" />
    <meta property="og:image"         content="<?php if(isset($imgshare)) echo URL::to('/') . config('view.filepath') . $imgshare->name ?>" />
    <link rel="canonical" href="<?php if(isset($imgshare)) echo $media_url . '/path/' . $imgshare->name ?>" />
    <?php
    if (isset($settings->favicon)){ ?>
	<link rel="icon" href="{{ config('view.settingspath') }}/<?= $settings->favicon ?>" type="image/x-icon">
	<?php }else {?>
	<link rel="icon" href="{{ config('view.rootpath') }}/img/favicon.png" type="image/x-icon">
	<?php }?>
	<!-- BEGIN CSS FRAMEWORK -->
	<link rel="stylesheet" href="{{ config('view.rootpath') }}plugins/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="{{ config('view.rootpath') }}css/pixel.css">
	<link rel="stylesheet" href="{{ config('view.rootpath') }}plugins/font-awesome/css/font-awesome.min.css">
	<!-- END CSS FRAMEWORK -->	
	<!-- CUSTOM CSS -->
	<link rel="stylesheet" href="/content/custom.css">
	<!-- END CUSTOM CSS -->
	<!-- ANIMATE CSS -->
	<link rel="stylesheet" href="{{ config('view.rootpath') }}css/animate.css">
	<!-- END ANIMATE CSS -->
	<!-- BEGIN CSS TEMPLATE -->
	<link rel="stylesheet" href="{{ config('view.rootpath') }}css/main.css">

	<?php if(Request::cookie('theme') == 'dark' || $settings->theme == 'dark'): ?>
		<link rel="stylesheet" href="{{ config('view.rootpath') }}css/dark.css">
	<?php endif; ?>


	<!-- END CSS TEMPLATE -->

	<!-- BEGIN JS FRAMEWORK -->
	<script src="{{ config('view.rootpath') }}plugins/jquery-2.1.0.min.js"></script>
	<script src="{{ config('view.rootpath') }}plugins/bootstrap/js/bootstrap.min.js"></script>
	<script src="{{ config('view.rootpath') }}js/iscroll.js"></script>
	<!-- END JS FRAMEWORK -->
</head>

<body>
	<!-- BEGIN HEADER -->
	<header class="header">
		<div class="headerSocial">
			<div class="container">
				<div class="row headrow">
					<p class="topHeadline"><?= $settings->subheadline ?></p>
					<ul class="socialTop social">
						<li><a href="/latest" class="about"><i class="fa fa-calendar"></i> Latest</a></li>
						<li><a href="/popular" class="about"><i class="fa fa-star"></i> Popular</a></li>
						<li><a href="/about" class="about"><i class="fa fa-question-circle"></i> About</a></li>
						<li><a href="/contact" class="contact"><i class="fa fa-envelope"></i> Contact</a></li>
						<li class="social-btn"><a href="http://facebook.com/<?= $settings->facebook ?>" class="socialIcon facebook" target="_blank"><i class="fa fa-facebook"></i></a></li>
						<li class="social-btn"><a href="http://plus.google.com/<?= $settings->googleplus ?>" class="socialIcon" target="_blank"><i class="fa fa-google-plus"></i></a></li>
						<li class="social-btn"><a href="http://twitter.com/<?= $settings->twitter ?>" class="socialIcon" target="_blank"><i class="fa fa-twitter"></i></a></li>
						<li class="social-btn"><a href="/rss" class="socialIcon"><i class="fa fa-rss"></i></a></li>
					</ul>
				</div>
			</div>
		</div>

		<div class="headerMenu">
			<div class="container">
				<div class="row">
					<div class="menu">
						<?php if (isset($settings->logo) && trim($settings->logo) != ""){ ?>
						<a href="/" class="logo"><img src="{{ config('view.settingspath') }}/<?= $settings->logo ?>" /></a>
						<?php }else {?>
							<?php if(Request::cookie('theme') == 'dark' || $settings->theme == 'dark'): ?>
								<a href="/" class="logo"><img src="/application/assets/img/light-logo.png" /></a>
							<?php else: ?>
								<a href="/" class="logo"><img src="/application/assets/img/logo.png" /></a>
							<?php endif; ?>
						<?php }?>
						<div class="navRight">
							<ul class="nav nav-tabs ">
								<?php
								$category = DB::table('categories')->orderBy('order', 'ASC')->orderBy('id', 'DESC')->get();
								foreach($category as $item):
									$hasSub = false;
									foreach($category as $nitem):
										if($nitem->parentID == $item->id) {
											$hasSub = true;
											break;
										}
									endforeach;
									if ($item->parentID == 0 ){ ?>
						      		<li role="presentation" class="<?= ($hasSub)? 'dropdown' : '';?> ">
						      			<a <?= ($hasSub)? 'class="dropdown-toggle"' : '';?> href="<?php  if($item->url_slug != "home"): echo '/category/' . $item->url_slug; else: echo '/'; endif;  ?>">
						      			<?= ucwords($item->name) ?>
						      			<?php if ($hasSub): ?>
						      				<span class="caret"></span>
						      			<?php endif ?>
						      			</a>
						      		<?php }
							      		if ($hasSub) {
							      			echo '<ul class="dropdown-menu dropfixed">';
							      			foreach ($category as $value) :
												if ($value->parentID == $item->id):
													echo '<li><a href="/category/'. $value->url_slug .'">'.ucwords($value->name).'</a></li>';
												endif;
											endforeach;
											echo '</ul>';
										}?>
						      		</li>
						      	<?php endforeach; ?>
						    </ul>
						    <div class="mobile-menu menu_open"><i class="fa fa-bars"></i><i class="fa fa-times"></i></div>
				      		<div class="searchIcon" data-toggle="modal" data-target=".search_popup"><a href="javascript:void(0)"><i class="glyphicon glyphicon-search"></i></a></div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</header>
	<!-- END HEADER -->

	<section class="content">
		@yield('container')
	</section>
	<!-- BEGIN FOOTER -->
	<footer class="footer">
		<div class="container">
			<div class="row">
				<p><a href="#"><?= $settings->sitename ?></a> - Copyright <?= date("Y"); ?></p>
				<ul class="socialBot social">
					<?php if (Auth::check()) { ?>
					<li><a href="/admin" class="admin">Admin</a></li>
					<li><a href="/auth/logout" class="about">Logout</a></li>
					<?php }else { ?>
					<li><a href="/auth/login" class="about">Login</a></li>
					<?php } ?>
					<li><a href="/about" class="about">About</a></li>
					<li><a href="/contact" class="contact">Contact</a></li>
					<li><a href="http://facebook.com/<?= $settings->facebook ?>" class="socialIcon facebook" target="_blank"><i class="fa fa-facebook"></i></a></li>
					<li><a href="http://plus.google.com/<?= $settings->googleplus ?>" class="socialIcon" target="_blank"><i class="fa fa-google-plus"></i></a></li>
					<li><a href="http://twitter.com/<?= $settings->twitter ?>" class="socialIcon" target="_blank"><i class="fa fa-twitter"></i></a></li>
					<li><a href="/rss" class="socialIcon"><i class="fa fa-rss"></i></a></li>
				</ul>
			</div>
		</div>
	</footer>
	<div id="modalpage">
	    <div class="modal search_popup animated slideInUp" id="searchModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" style="padding:0;">
	        <div class="container">
	            <div class="search-modal modal-dialog col-sm-6 col-xs-6" style="float:none;">
	                <div class="modal-content row">
	                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
	                    <div class="col-sm-12 col-xs-12 slide">
	                        <h1 class="animated slideInLeft">Search with Name</h1>
	                    	{!! Form::open(array('action' =>array('HomeController@seacrh') , 'class'=>'form-horizontal formsettings','enctype'=>'multipart/form-data')) !!}
	                    		{!!Form::text('search', null,array('id'=>'search', 'class'=>'form-control', 'placeholder'=>'Enter name to search'))!!}
	                    		{!!Form::submit('Search', array('id'=>'submit', 'class'=>'btn btn-danger submit-media'))!!}
	                    	{!! Form::close() !!}
	                    </div>
	                </div>
	            </div>
	        </div>
	    </div>
	</div>
	<!-- END FOOTER -->
	<script>
		var rootpath = "{{ config('view.rootpath') }}";
	</script>
	<!-- END JS GLOBAL VARIABLE -->
	
	<script>
		$(document).ready(function(){
			$('#searchModal').on('shown.bs.modal', function() {
		        $('#search').focus();
		    });

		});
	</script>
	
	<!-- BEGIN JS BUTTON LIKE DOWNLOADPAGE -->
	<script type="text/javascript">
		$(document).ready(function () {
		    $("a.buttonlike").click(function() {
				var id     = $(this).attr("image-id");
				var _token = $('input[name=_token]').val();

				$.ajax
				({
					type: "POST",
					url: "/like/" + id,
					data: {id: id, _token: _token},
					success: function(msg)
					{
						$('.buttonlike b#id'+id+'').html(msg);
					}
				});
			});

			$("a.btndownload").click(function() {
				var id     = $(this).attr("image-id");

				$.ajax
				({
					type: "GET",
					url: "/countdownload/" + id,
					success: function(msg)
					{
						$('.btndownload span#id'+id+'').html(msg);
						window.location = '/afterdownload/' + id;
					}
				});
			});
		});
	</script>
	<!-- END JS BUTTON LIKE DOWNLOADPAGE -->
	<!-- BEGIN JS BUTTON LIKE HOMEPAGE -->
	
	<!-- END JS BUTTON LIKE HOMEPAGE -->
	<script type="text/javascript">
	    /* * * CONFIGURATION VARIABLES * * */
	    var disqus_shortname = '<?= $settings->disqus; ?>';
	    
	    /* * * DON'T EDIT BELOW THIS LINE * * */
	    (function () {
	        var s = document.createElement('script'); s.async = true;
	        s.type = 'text/javascript';
	        s.src = '//' + disqus_shortname + '.disqus.com/count.js';
	        (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
	    }());
	</script>
	<!-- BEGIN JS TEMPLATE -->
	<script src="{{ config('view.rootpath') }}js/main.js"></script>
	<script src="{{ config('view.rootpath') }}js/slug.js"></script>
	<script src="{{ config('view.rootpath') }}js/myscript.js"></script>
	<script src="https://apis.google.com/js/platform.js" async defer></script>
	<script type="text/javascript" src="{{ config('view.rootpath') }}js/tinymce/tinymce.min.js"></script>
	
	<script type="text/javascript">
	    tinymce.init({
	        selector: "#description",
	        toolbar: "styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | preview media | forecolor backcolor | code",
	        plugins: [
		         "advlist autolink link image code lists charmap print preview hr anchor pagebreak spellchecker code fullscreen",
		         "save table contextmenu directionality emoticons template paste textcolor code"
		   ],
		   menubar:false,
	    });
    </script>
	<!-- END JS TEMPLATE -->

	<!-- Google Analytics -->

	<?php if(isset($settings->gganalytic) && trim($settings->gganalytic) != ""): ?>
	  <script>
	    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
	    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
	    ga('create', '<?= $settings->gganalytic ?>', 'auto');
	    ga('send', 'pageview');
	  </script>
	<?php endif; ?>

	<!-- End Google Analytics -->

</body>
</html>