var toggler = {
  init: function() {
    $('.toggle-box .toggle.expand').each(function(i) {
      $this = $(this);

      $this.parent().next('.toggle-content').hide();
    });

    $('.toggle-box .toggle').bind('click', function(e) {
      e.preventDefault();

      $this = $(this);

      $this.toggleClass('collapse').toggleClass('expand');
      $this.parent().next('.toggle-content').slideToggle();
    });
  }
}

var tabs = {
  init: function() {
    var tabLinks = $('.tabs li');
    var tabContent = $('#tabcontent');

    tabLinks.bind('click', function(e) {
      e.preventDefault();

      $this = $(this);

      tabLinks.removeClass('current');
      $this.addClass('current');
      
      $.ajax({
        url: $this.find('a').attr('href'),
        success: function(data) {
          tabContent.html(data);
        }
      });
    });
  }
}

var newWindow = {
  init: function(){
    $('A[rel*="external"]').bind('click', function(e) {
      e.preventDefault();

      window.open($(this).attr('href'));
    });
  }
}

$(document).ready(function(){
  toggler.init();
//  tabs.init();
  newWindow.init();
});
