// Help tooltips
$(function() {
  
  // Global styling
  $.fn.qtip.styles.phonebooth = {
     width: { max: 320 },
     background: 'white',
     color: '#333',
     border: {
        width: 4,
        radius: 4,
        color: '#c00'
     },
     tip: 'leftMiddle'
  };
  
  // Show/hide on mouseover/mouseout
  $('a.tip').qtip({
    style: { name: 'phonebooth', width: 325 },
    position: { corner: { target: 'centerRight', tooltip: 'leftMiddle' } },
    show: 'mouseover',
    hide: 'mouseout',
    api: {
      onContentUpdate: function() {
        // Grab content from hidden div
        var css_selector = this.elements.target.attr('href');
        this.elements.content.append($(css_selector).html());
      }
    }
  });
  
  // Show/hide on mouseover/mouseout
  $('a.help').qtip({
    style: { name: 'phonebooth', tip: 'bottomLeft', width: 325 },
    position: { corner: { target: 'topMiddle', tooltip: 'bottomLeft' } },
    show: 'mouseover',
    hide: 'mouseout',
    api: {
      onContentUpdate: function() {
        // Grab content from hidden div
        var css_selector = this.elements.target.attr('href');
        this.elements.content.append($(css_selector).html());
      }
    }
  });
  
});