$(document).ready(function() {
  // Anpassungen mit CSS ermöglichen
  $('html').addClass('js');
  
  // Sprunglinks animiert scrollen
  if($('#inhalt').css('position') == 'relative') {
    $('#inhalt a[href^=#]').each(function() {
      var href = $(this).attr('href');
      
      if(href != '#') {
        $(this).click(function(event) {
          $('#inhalt').animate({
            scrollTop: $(href).position().top
          });
          
          event.preventDefault();
        });
      }
    });
  }

  // Klappboxen
  $('a.klapplink').addClass('closed');
  $('a.klapplink').parent().next().hide();
  
  $('a.klapplink').click(function(event) {
    if($(this).parent().next().css('display') == 'none') {
      $(this).removeClass('closed');
      $(this).parent().next().slideDown();
    } else {
      $(this).parent().next().slideUp();
      $(this).addClass('closed');
    }
    
    event.preventDefault();
  });
});

