$(document).ready(function(){

  // Match all link elements with href attributes within table class="calendar"
  $('table.calendar a[href]').each(function() {
    var self = this;

    // Setup title and content text
    var _title = $(self).siblings('span.tooltip').find('h3').text();
    var _text = $(self).siblings('span.tooltip').find('span.events').html();

    $(self).qtip({
      content: {
        title: _title,
        text: _text
      },
      position: {
        corner: {
          tooltip: 'rightMiddle',
          target: 'leftMiddle'
        }
      },
      hide: {
        when: 'mouseout',
        fixed: true
      },
      style:{
        border:{
          width: 3,
          radius: 3
        },
        padding: '5px 10px',
        title: {
          padding: '7px 10px'
        },
        tip: true,
        name: 'violet'
      }
    });
  });
});

