<?php $__env->startSection('page_title'); ?>
    OSAA - Radio Network
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_sub_title'); ?>    
    
    OSAA Radio Network powered by Pacific Office Automation    

<?php $__env->stopSection(); ?>

<?php $__env->startSection('live_alert'); ?>
<?php
   GeneralController::getLiveAlert();   
?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    @parent

    <style type="text/css">
    	
        h3 {
    		color: #1C43A6 !important;
    	}    	    	   	

    	.page_functions {
    		width: auto !important;
    	}        

    </style>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('jquery_init'); ?>		
	
    $('.main_content')
        .css({ 'background-image' : 'url(<?php echo url('/images/abstract-wallpapers-blue-abstract-backgrounds-wallpaper-37219.png'); ?>)',
               'min-height' : '660px'});

    <?php if (!$info['schedule']->is_live): ?>
        
        <?php if (strtotime($info['schedule']->contest->event->start_at . ' -5 minutes') > time()): ?>
            CountDownTimer('<?php echo date('m/d/Y h:i:s A', strtotime($info['schedule']->contest->event->start_at . ' -5 minutes')); ?>');            
        <?php endif; ?>
        
        function CountDownTimer(dt)
        {
            var end = new Date(dt);

            var _second = 1000;
            var _minute = _second * 60;
            var _hour = _minute * 60;
            var _day = _hour * 24;
            var timer;

            function showRemaining() {
                var now = new Date();
                var distance = end - now;
                if (distance < 0) {

                    clearInterval(timer);

                    location.reload();
                    
                    var link = $('<a href="#"><b>[ refresh this page to start listening ]</b></a>')                
                               .click(function(event)
                               {
                                   event.preventDefault();   
                                   location.reload();
                               })
                               .appendTo('.countdown');                

                    return;
                }
                var days = Math.floor(distance / _day);
                var hours = Math.floor((distance % _day) / _hour);
                var minutes = Math.floor((distance % _hour) / _minute);
                var seconds = Math.floor((distance % _minute) / _second);

                var html = "in ";
                if (days > 0)
                {
                    html += days + ' days ';
                }
                if (hours > 0)
                {
                    html += hours + ' hours ';
                }
                if (minutes > 0)
                {
                    html += minutes + ' minutes ';
                }
                html += seconds + ' seconds';
                html += ", starting at <?php echo Helpers::formatDateTime('%SCHEDULE%',
                                                                  strtotime($info['schedule']->contest->event->start_at . ' -5 minutes'),
                                                                  $info['schedule']->contest->event->time_zone); ?>";                

                $('.countdown').html(html);
            }

            timer = setInterval(showRemaining, 1000);
        }
    <?php endif; ?>
    
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_functions'); ?>  	

     <img src="<?php echo asset('/images/ads/sponsors/POA_111x50px.png'); ?>" alt="" title="" style="position: relative; top: -10px;" />
    
<?php $__env->stopSection(); ?>


<?php $__env->startSection('main_content'); ?>    		

    <?php /*  Errors  */ ?>
     <?php if (Session::has('errors')): ?>                
        <div class="error ui-state-error" style="font-weight: bold; padding: 1em;">
            <span class="ui-icon ui-icon-alert box_icon"></span>
            <?php foreach ($errors->all() as $error): ?>
                <?php echo $error; ?>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>   

    <h1><?php echo $info['schedule']->title; ?></h1>

    <iframe src="https://mixlr.com/<?php echo strtolower($info['schedule']->network->slug); ?>/embed?color=1c43a6&autoplay=true" width="1030px" height="180px" scrolling="no" frameborder="no" marginheight="0" marginwidth="0"></iframe>

    <?php if ($info['schedule']->is_live): ?>
        <img src="<?php echo asset('/images/icons/on_air_tiny.png'); ?>" alt="" title="" style="" />
    <?php endif; ?>
    Live from <?php echo $info['schedule']->location_name; ?> on <?php echo $info['schedule']->network->name; ?>
    <?php if (!$info['schedule']->is_live): ?>
        <span class="countdown"></span>        
    <?php endif; ?>

<?php $__env->stopSection(); ?>
