

$(document).ready(function()
{
  //hide the all of the element with class SP_NewsContent
  $(".BD_MapContent").hide();
  $(".BD_ToolbarContent").hide();
  $(".BD_Toolbar2Content").hide();
  //show the clicked one
  $(".SP_NewsContent_active").show();

  
  //toggle the componenet with class SP_NewsContent
  $(".BD_MapOpen").click(
    function()
    {
        $(".BD_MapContent").slideToggle(600);
         var $this = $(this);
         if( $this.is('.BD_MapOpen') ) {
            $this.removeClass('BD_MapOpen');
            $this.addClass('BD_MapClose');
         }
         else{
            $this.removeClass('BD_MapClose');
            $this.addClass('BD_MapOpen');
         }
    }
  );

  $(".BD_ToolbarOpen").click(
    function()
    {
        $(".BD_ToolbarContent").slideToggle(600);
         var $this = $(this);
         if( $this.is('.BD_ToolbarOpen') ) {
            $this.removeClass('BD_ToolbarOpen');
            $this.addClass('BD_ToolbarClose');

	    var $temp = $(".BD_Toolbar2Close")
	    $(".BD_Toolbar2Content").hide();
            $temp.removeClass('BD_Toolbar2Close');
            $temp.addClass('BD_Toolbar2Open');
         }
         else{
            $this.removeClass('BD_ToolbarClose');
            $this.addClass('BD_ToolbarOpen');
         }
    }
  );
  $(".BD_Toolbar2Open").click(
    function()
    {
        $(".BD_Toolbar2Content").slideToggle(600);
         var $this = $(this);
         if( $this.is('.BD_Toolbar2Open') ) {
            $this.removeClass('BD_Toolbar2Open');
            $this.addClass('BD_Toolbar2Close');

	    var $temp = $(".BD_ToolbarClose")
	    $(".BD_ToolbarContent").hide();
            $temp.removeClass('BD_ToolbarClose');
            $temp.addClass('BD_ToolbarOpen');
         }
         else{
            $this.removeClass('BD_Toolbar2Close');
            $this.addClass('BD_Toolbar2Open');
         }
    }
  );

  //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');
        }
    }
  );
  
  
});

