@extends('layouts.content')
@section('title')
	Download page
@stop
@section('content')
	<div class="content contentHome">
			<div class="container">
				<div class="row">	
					@include('partials.ads728x90')
					<div class="contentdownload">
						<div class="col-sm-8">
						<?php foreach($images as $item): ?>
							<div class="titledownload">
								<h3><?= ucwords($item->title) ?></h3>
								<p>
									<span style="font-style:italic;color:#9BA0A5;padding-left:5px;"><?= date("F j, Y", strtotime($item->created_at)) ?></span> /

									<?php 
									$tags = explode ( ", " , $item->tags);
									foreach($tags as $itemtags):?>								
										<a href="/tags/<?= $itemtags ?>"><?= $itemtags ?></a>,
									<?php endforeach; ?>
								</p>
							</div>
							<div class="imgdownload">							
								<div class="imagescnt">
									<img src="{{ '/' . config('view.downloadpath') }}<?= $item->name ?>">
								</div>
								<div class="sharedownload">
									<?php $media_url = URL::to('downloadpage') . '/' . $item->id; ?>
									<div class="share_twitter share col-md-3">
										<a href="https://twitter.com/intent/tweet?text=<?= ucwords($item->title) ?>&url=<?=$media_url?>" target="_blank" onclick="javascript:window.open(this.href, '_blank', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600');return false;">Share on Twitter</a>
									</div>
									<div class="share_facebook share col-md-3">
										<a href="http://www.facebook.com/sharer.php?u=<?=$media_url?>" target="_blank" onclick="javascript:window.open(this.href, '_blank', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600');return false;">Share on Facebook</a>
									</div>
									<div class="share_pinterest share col-md-3">
										<a href="http://pinterest.com/pin/create/button/?url=<?=$media_url?>" target="_blank" onclick="javascript:window.open(this.href, '_blank', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600');return false;">Share on Pinterest</a>
									</div>
									<div class="share_google share col-md-3">
										<a href="https://plus.google.com/share?url=<?=$media_url?>" target="_blank" onclick="javascript:window.open(this.href, '_blank', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600');return false;">Share on Google+</a>
									</div>
									
									<div style="clear:both"></div>
								</div>
								<div class="description">
									<h3>Description and Details</h3>
									<p><?= $item->description ?></p>
								</div>
								<div class="btn-down-like">
									<input type="hidden" name="_token" value="{{ csrf_token() }}">
									<input type="hidden" name="_token2" value="{{ csrf_token() }}">
									<a href="javascript:void(0);" class="btndownload btn btn-success" image-id="<?= $item->id ?>"><i class="fa fa-cloud-download"></i> Download (<span id="id<?= $item->id ?>"><?= $item->count_download ?></span>)</a>
									<a href="javascript:void(0)" class="buttonlike buttonlike2 btn btn-danger" image-id="<?= $item->id ?>"><i class="fa fa-heart"></i> Like (<b id="id<?= $item->id ?>"><?= $item->count_like ?></b>)</a>
								</div>
							</div>
							<?php endforeach; ?>
							<div class="alsolike">
								<h3>You may also like</h3>
								<?php foreach($alsolike as $itemAlso): ?>
									<div class="alsoimg col-sm-4">
										<a href="<?= route('downloadpage', $itemAlso->id) ?>">
											<div>
												<img src="{{ '/' . config('view.downloadpath') }}<?= $itemAlso->name ?>">
											</div>
											<p class="titleAlso"><?= ucwords($itemAlso->title) ?><br /><small>Added on <?= date("F j, Y", strtotime($itemAlso->created_at)); ?></small></p>
										</a>
									</div>
								<?php endforeach; ?>
							</div>

							<div class="commentdownload">
								<h3>Comments</h3>
								<div id="disqus_thread"></div>
								<script type="text/javascript">
								    /* * * CONFIGURATION VARIABLES * * */
								    var disqus_shortname = '<?= $settings->disqus; ?>';
								    
								    /* * * DON'T EDIT BELOW THIS LINE * * */
								    (function() {
								        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
								        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
								        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
								    })();
								</script>
								<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>

							</div>
						</div>
						<div class="col-sm-4">
							<div class="btn-next-prev">
								<?php if(isset($previous)): ?>
									<a href="{{ URL::to( 'downloadpage/' . $previous ) }}" class="btn btn-danger"><i style="font-size:10px; position:relative; top:-1px;" class="fa fa-chevron-left"></i> <span>Previous</span></a>
								<?php endif; ?>
								<?php if(isset($next)): ?>
								<a href="{{ URL::to( 'downloadpage/' . $next ) }}" class="btn btn-danger"><span>Next</span> <i class="fa fa-chevron-right" style="font-size:10px; position:relative; top:-1px;"></i></a>
								<?php endif; ?>
							</div>
							<div class="ads300x250">
								@include('partials.ads300x250')
							</div>
							<div class="popular">
								<h3>Popular</h3>
								<?php foreach($popular as $itemPop): ?>
									<a href="<?= route('downloadpage', $itemPop->id) ?>" class="popular-child">
										<div class="img_popular">
											<img src="{{ '/' . config('view.downloadpath') }}<?= $itemPop->name ?>">
										</div>
										<p class="titlepop"><?= ucwords($itemPop->title) ?><br /><small>Added on <?= date("F j, Y", strtotime($itemPop->created_at)); ?></small></p>
									</a>
								<?php endforeach; ?>
							</div>
							<div class="mostlike">
								<h3>Most Liked</h3>
								<?php foreach($mostlike as $itemMost): ?>
									<a href="<?= route('downloadpage', $itemMost->id) ?>" class="popular-child">
										<div class="img_popular">
											<img src="{{ '/' . config('view.downloadpath') }}<?= $itemMost->name ?>">
										</div>
										<p class="titlepop"><?= ucwords($itemMost->title) ?><br /><small>Added on <?= date("F j, Y", strtotime($itemMost->created_at)); ?></small></p>
									</a>
								<?php endforeach; ?>
							</div>
						</div>
				</div><!-- .contentdownload -->
			</div><!-- .row -->
		</div><!-- .container -->
	</div><!-- .contentHome -->
	<!-- BEGIN JS FRAMEWORK -->
	<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>
	<script type="text/javascript">
		$(document).ready(function () {
			$("iframe").contents().find(".FP").css("background", "blue");
		});
	</script>
@stop