/* ta ACCORDION 2.0 - custom */
(function($){
  $.fn.ta_accordion = function(options)
  {
    var defaults = {
      tab        : '.section',
      hook       : 'h3',
      hook_class : 'current',
      open_class : 'section_open'
    };
    var options =  $.extend(defaults, options);

    var id = this.selector;

    $(id+' '+options.hook).click(function() {
      if($(this).next().is(':hidden')) {
        $(this).addClass(options.hook_class);//.next();.slideDown(function(){
        $(this).parent().addClass(options.open_class);
    //});
      } else {
        $(this).removeClass(options.hook_class)//.next().slideUp(function(){
        $(this).parent().removeClass(options.open_class);
    //});
      }

      return false;
    });
  };
})(jQuery);


(function($){
  $.fn.ta_tabs = function(options)
  {
    var defaults = {
      index        : 0,
      afterChange  : null
    };
    var options =  $.extend(defaults, options);
    var id = this.selector;

    var tabs = $(id + ' .tab');
    var tabLinks = $(id + ' ul.tabs a');
    tabLinks.click(function () {
      tabs.hide();
      tabs.filter(this.hash).show();

      if(null != options['afterChange']){
        options['afterChange'](this.hash);
      }

      $(id + ' ul.tabs li').removeClass('selected');
      $(this).parent().addClass('selected');
      return false;
  });

    tabLinks.eq(options['index']).click();
  };
})(jQuery);

