/**
 * Simple tabs plugin
 */
jQuery.fn.simpletabs = function(opts) {

  var opts = $.extend(opts, {
      current_class : 'current'
  });


  var _this = this;

  function hidePanels() {
    _this.find('a').each(function() {

      // Corresponding panel ID is in href, eg href="#panel"
      var panel = $(this).attr('href');
      
      // Hide the panel
      $(panel).hide();
    });
  }

  this.find('a').each(function(i, item) {

    // Corresponding panel ID is in href, eg href="#panel"
    var panel = $(this).attr('href');

    // When link clicked, show the panel
    $(this).click(function() {
      
      // Change currently selected link container
      $(this).parents('li').siblings().removeClass(opts.current_class);
      $(this).parents('li').addClass(opts.current_class);

      // Show this panel
      hidePanels();
      $(panel).fadeIn();
      return false;
    });
  });
  
  
  // Initialise - hide panels and show first
  hidePanels();
  $(this.find('a').attr('href')).show();



};
