

$(document).ready(function()
{
  //hide the all of the element with class SP_NewsContent
  $(".SP_NewsContent").hide();
  //show the clicked one
  $(".SP_NewsContent_active").show();

  
  //toggle the componenet with class SP_NewsContent
  $(".SP_NewsTeaserOpen").click(
    function()
    {
        $(this).next(".SP_NewsContent").slideToggle(600);
         var $this = $(this);
         if( $this.is('.SP_NewsTeaserOpen') ) {
            $this.removeClass('SP_NewsTeaserOpen');
            $this.addClass('SP_NewsTeaserClose');
         }
         else{
            $this.removeClass('SP_NewsTeaserClose');
            $this.addClass('SP_NewsTeaserOpen');
         }
    }
  );

  //if link on startpage is clicked to the opposite to above  
  $(".SP_NewsTeaser_active").click(
    function()
    {
        $(this).next(".SP_NewsContent_active").slideToggle(600);
        var $this = $(this);
        if( $this.is('.SP_NewsTeaser_active') ) {
            $this.removeClass('SP_NewsTeaser_active');
            $this.addClass('SP_NewsTeaserOpen');
        }
        else{
            $this.removeClass('SP_NewsTeaserOpen');
            $this.addClass('SP_NewsTeaser_active');
        }
    }
  );
  
  
});
