jQuery(document).ready(function($) {
    var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth()+1; //January is 0!
    var yyyy = today.getFullYear();

    if(dd<10) {
        dd = '0'+dd
    } 

    if(mm<10) {
        mm = '0'+mm
    } 

    today = yyyy + '-' + mm + '-' + dd;

    $('#calendar').fullCalendar({
      header: {
        left: 'prev today',
        center: 'title',
        right: 'month,agendaWeek,agendaDay,listWeek next'//'month,agendaWeek,agendaDay,listWeek'
      },
      defaultDate: today,
      editable: true,
      navLinks: true, // can click day/week names to navigate views
      eventLimit: true, // allow "more" link when too many events
      events: {
        url: 'app/assets/js/page-scripts/fullcalendar/php/get-events.php',
        error: function() {
          $('#script-warning').show();
        }
      },
      loading: function(bool) {
        $('#loading').toggle(bool);
      }
    });

});