<?php $__env->startSection('content'); ?>

<style type="text/css" media="screen">
	<?php foreach ($offerings as $offering): ?>
	a.more-info-hover-<?php echo $offering->offering_id; ?>:hover { background-color: <?php echo (substr($offering->color, 0, 1) == '#')?$offering->color:'#'.$offering->color ?>; }
	<?php endforeach; ?>
</style>

<?php $__env->startSection('sub_menu'); ?>
    <?php if ($types): ?>
        <div class="wrap-second-nav">
            <div class="second-nav" style="margin-bottom:0;">
                <a href="<?php echo URL::to('offerings'); ?>"<?php echo (!Input::get('type'))?' class="active"':''; ?>>ALL</a>
                <?php foreach ($types as $type): ?>
                <span><a href="<?php echo URL::to('offerings'); ?>?type=<?php echo $type->type_id; ?>"<?php echo (Input::get('type') == $type->type_id)?' class="active"':''; ?>><?php echo $type->type_name; ?></a></span>
                <?php endforeach; ?>
                <div class="pull-right">
                    <a href="<?php echo URL::to('offerings'); ?>" class="active">Tombstone view</a>
                    <span><a href="<?php echo URL::to('events'); ?>">Event view</a></span>
                </div>
            </div>
        </div>
   <?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo HTML::style('css/fancybox/jquery.fancybox.css'); ?>   
<?php $__env->startSection('scripts'); ?>
	<?php echo HTML::script('js/fancybox/jquery.fancybox.pack.js'); ?> 
    <script type="text/javascript">
		$(document).ready(function() {
			$(".vimeo").fancybox({
				type : 'iframe',
				width		: '70%',
				height		: '70%',
				padding		: 7,
				margin		: 7,
				autoSize	: false,
				closeClick	: false,
				openEffect	: 'none',
				closeEffect	: 'none'
			});
			
			<?php if(!Agent::isMobile() && !Agent::isTablet()): ?>
			var currentPage = 0; 
			if(currentPage==0) {
				$("#prev-button").removeClass("scroll-prev-button");
				$("#prev-button").addClass("scroll-prev-button-hide");
			}
			
			var countItems = $(".section").length;
			$('#next-button').click(function(e){
				$("#next-button").addClass("scroll-next-button");
				$("#prev-button").addClass("scroll-prev-button");
				if(currentPage < countItems-1) {
					
					currentPage++;
					$("html, body").animate({ scrollTop: $(".section").eq(currentPage).offset().top - 120}, 800);		
				} else {
					$("#next-button").removeClass("scroll-next-button");
					$("#next-button").addClass("scroll-next-button-hide");
				}
				
				e.preventDefault();
			});
			
			$('#prev-button').click(function(e){
				$("#next-button").addClass("scroll-next-button");
				$("#prev-button").addClass("scroll-prev-button");
				if(currentPage > 0) {
					currentPage--;
					$("html, body").animate({ scrollTop: $(".section").eq(currentPage).offset().top - 120}, 800);
				} else {
					$("#prev-button").removeClass("scroll-prev-button");
					$("#prev-button").addClass("scroll-prev-button-hide");
				}
				e.preventDefault();
			});
			<?php endif; ?>
		});
	</script>
<?php $__env->stopSection(); ?>

<?php if(!Agent::isMobile() && !Agent::isTablet() && $offerings->count() > 1): ?>
<div class="scroll-page-buttons">
    <a id="prev-button" href="#"><span id="prev-button" class="scroll-prev-button"></span></a>
    <a id="next-button" href="#"><span id="next-button" class="scroll-next-button"></span></a>
</div>
<?php endif; ?>

<div class="row" id="wrapper">
    <div class="col-md-12" id="main">
        <?php if ($offerings): ?>
        	<?php foreach ($offerings as $offering): ?>
            	<?php 
				$percent_sum = ($offering->amount / $offering->size) * 100; 
				?>
        <div class="section offer_box" >
			<div class="social">
				<?php if(!empty($team->linkedin)): ?>
                <a href="<?php echo $team->linkedin; ?>" target="_blank" class="in"></a>
                <?php endif; ?>
                <?php if(!empty($team->facebook)): ?>
                <a href="<?php echo $team->facebook; ?>" target="_blank" class="facebook"></a>
                <?php endif; ?>
                <?php if(!empty($team->twitter)): ?>
                <a href="<?php echo $team->twitter; ?>" target="_blank" class="twitter"></a>
                <?php endif; ?>
				
                <a href="javascript:;" onclick="open_popup('https://www.linkedin.com/cws/share?url=<?php echo URL::to('offerings/'.$offering->offering_id); ?>')" class="in"></a>
                <a href="javascript:;" onclick="open_popup('https://www.facebook.com/sharer/sharer.php?u=<?php echo URL::to('offerings/'.$offering->offering_id); ?>');" class="facebook"></a>
                <a href="javascript:;" onclick="open_popup('https://twitter.com/share?url=<?php echo URL::to('offerings/'.$offering->offering_id); ?>');" class="twitter"></a>
                
            </div>
            <div class="frame_video" style="background-image: url(<?php echo URL::to('uploads/video_image/'.$offering->video_image); ?>);">
				<?php if(!empty($offering->video)): ?>
                <a class="vimeo" href="<?php echo $offering->video; ?>">
				<div class="banner-play-button" style="background: <?php echo (substr($offering->color, 0, 1) == '#')?$offering->color:'#'.$offering->color ?>;">
					<div class="play-video"></div>
				</div>
				</a>
                <?php else: ?>
              	<a class="vimeo" href="<?php echo $offering->presentation; ?>">
				<div class="banner-play-button" style="background: <?php echo (substr($offering->color, 0, 1) == '#')?$offering->color:'#'.$offering->color ?>;">
					<div class="play-presentation"></div>
				</div>
				</a>
                <?php endif; ?>
			</div>
            <div class="gray_box">
                <?php echo $offering->description; ?><br>
                <?php echo !empty($offering->starts_at)?'<p>Next Webcast Presentation,'.date("l, M d, h:i a", strtotime($offering->starts_at)).' <a href="#">Register here...</a> </p>':''; ?>
            </div>
            <div class="box1">
                <div class="progress">
                  <div class="progress-bar" style="background: <?php echo (substr($offering->color, 0, 1) == '#')?$offering->color:'#'.$offering->color ?>; width: <?php echo $percent_sum; ?>%;" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
                    <span class="sr-only"><?php echo $percent_sum; ?>% Complete</span>
                  </div>
                </div>
                <p class="funds"> $<?php echo number_format($offering->amount, 2); ?> &nbsp;/&nbsp;  $<?php echo number_format($offering->size, 2); ?></p>
                <p><?php echo $offering->name; ?></p>
            </div>
            <div class="box2">
                <p>Offering Size:<span>$<?php echo number_format($offering->size, 2); ?></span></p>
                <p>Price Per Unit:<span>$<?php echo number_format($offering->per_share, 2); ?></span></p>
                <p>Minimum units:<span> <?php echo $offering->min_units; ?></span></p>
            </div>
            <div class="box3">
                <a href="<?php echo URL::to('offerings/'.$offering->offering_id); ?>" class="more-info-hover-<?php echo $offering->offering_id; ?>">
                    <span class="text">MORE INFO</span>
                </a>
            </div>
            <p class="info">OFFERING PERIOD ENDS AT <?php echo date("g:iA M d Y", strtotime($offering->ends_at)); ?></p>
        </div><!-- /offer_box -->
        	<?php endforeach; ?>
    	<?php endif; ?>
    </div>
</div><!-- /offerings end -->

<div class="wpagination"><?php echo $offerings->appends(array('type' => Input::get('type')))->links(); ?></div>
        
<?php $__env->stopSection(); ?>