<!-- Subscribe Modal -->
<div class="modal fade" id="subscribe-modal" role="dialog">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-body text-center">
                <button type="button" class="close setcookie" data-dismiss="modal">&times;</button>
                <h4>Stay current with a recap of today's Maritime News.</h4>
                <button type="button" name="button" class="btn btn-primary setcookie">Subscribe Now</button>
            </div>
        </div>
    </div>
</div>

@if (!Auth::check() && !Cookie::has('subscribe') && !Session::has('subscribe'))
<script type="text/javascript">
    if (!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))) {
        $(window).on('load',function(){
            setTimeout(function(){
                $('#subscribe-modal').modal({backdrop: 'static', keyboard: false});
                $('#subscribe-modal').modal('show');
            }, 15000)
        });
    }

    $('.setcookie').click(function(){
        $.post('/subscribe/create_cookie', {}, function(data){
            console.log(data);
        });
        if ($(this).hasClass('btn')) {
            setTimeout(function(){
                window.location.href = '/subscribe';
            }, 500)
        }
    })
</script>
@endif
