var AKA = {
  page: 1,
  
  init: function() {
    AKA.init_body();
    AKA.ie_hover();
    AKA.init_nav_1();
    AKA.init_tab(5);
    AKA.init_exteral_links();
    AKA.init_quizhelp();
    AKA.init_iframe();
  },
  
  init_body: function() {
    jQuery('body').removeClass('nojs');
    jQuery('body').addClass('js');
  },

  ie_hover: function() {
    jQuery('.kat-info').hover(
      function() { jQuery(this).addClass('kat-hover'); },
      function() { jQuery(this).removeClass('kat-hover'); }
    )
  },
  
  init_nav_1: function() {
    jQuery('body.ie a.li-0, body.ie a.li-1').prepend('<span class="pixel nav-tl"></span><span class="pixel nav-tr"></span>');
  },
  
  init_tab: function( lines ) {
    AKA.crop_tab( lines );
    jQuery('body#home .table-btm').append('<a id="moredates">weitere Termine</a>');
    jQuery('body#home #content table tr').slice( lines + 1 ).hide().addClass('togglelines');
    jQuery('body#home #moredates').toggle( 
      function() { AKA.full_tab() },
      function() { AKA.crop_tab() }
    );
  },
  
  full_tab: function() {
    jQuery('body#home #moredates').hide();
    jQuery('body#home #content table tr.togglelines').fadeIn( 400, function() { jQuery('#moredates').fadeIn().text('weniger Termine') } );
  },
  
  crop_tab: function() {
    jQuery('body#home #moredates').hide();
    jQuery('body#home #content table tr.togglelines').fadeOut( 400, function() { jQuery('#moredates').fadeIn().text('weitere Termine') } );
  },
  
  init_exteral_links: function() {
    jQuery("a[href^='http']").attr('target','_blank');
  },
  
  init_quizhelp: function() {
    jQuery('body#wissensquiz.ie .resolution .qgroup').hover(
      function() { jQuery(this).addClass('hover'); },
      function() { jQuery(this).removeClass('hover'); }
    );
  },
  
  init_iframe: function() {
    va = document.URL.split('#')[1];
    if( va ) {
      buchung = 'https://www.b2ms.de/rbs/buchung.php?sem_id=';
      jQuery( '.signup').attr('src', buchung + va)
    }
  },
  
  dummy: function() {}
  
}

jQuery(document).ready( function() {
  AKA.init();
});
