$(document).ready(function(){
	$('div.article:not(".static") > div:gt(0)').hide();
	$('div.article > h2').each(function(index){ 
		if (!$(this).parent().hasClass('static')){
			$(this).css('cursor', 'pointer');
			if (index > 0) {
				$(this).append('<span>[mehr]</span>');
			} else {
				$(this).append('<span>[weniger]</span>');
			}
			$(this).bind('click', function(){
				// $(this).next().slideToggle('slow');
				mySlideToggle($(this).next());
				var span = $(this).children(':first');
				var text = span.text();
				text = (text == '[mehr]' ? '[weniger]' : '[mehr]');
				span.text(text);
			});
		} else {
			//$(this).next().show();
		}
	});
	$('area').each(function(){
	    $(this).bind('click', function(){
			$('.article div').hide();
	        target = $(this).attr('href');
	        $(target + ' div').show();
	    });
	});
	
	if ( $('#movie-container').length > 0) {
		var so = new SWFObject("/inc/player.swf?nocache=172257093","mpl","656","373","9");
		so.addParam("allowfullscreen","true");
		so.addParam("allowscriptaccess","always");
		so.addParam("wmode","transparent");
		so.addVariable("file","http://mammascreening-hamburg.de/files/content/film.flv");
		so.addVariable("backcolor","#FFFFFF");
		so.addVariable("frontcolor","#666666");
		so.addVariable("lightcolor","#666666");
		so.addVariable("screencolor","#FFFFFF");
		so.addVariable("controlbar","over");
		so.addVariable("autostart","true");
		so.addVariable("displayclick","none");
		so.addVariable("repeat","no");
		so.addVariable("stretching","fill");
		so.addVariable("icons","false");
		so.write("movie");
	}

});

function mySlideToggle(el, bShow){
  var $el = $(el), height = $el.data("originalHeight"), visible = $el.is(":visible");
  
  // if the bShow isn't present, get the current visibility and reverse it
  if( arguments.length == 1 ) bShow = !visible;
  
  // if the current visiblilty is the same as the requested state, cancel
  if( bShow == visible ) return false;
  
  // get the original height
  if( !height ){
    // get original height
    height = $el.show().height();
    // update the height
    $el.data("originalHeight", height);
    // if the element was hidden, hide it again
    if( !visible ) $el.hide().css({height: 0});
  }

  // expand the knowledge (instead of slideDown/Up, use custom animation which applies fix)
  if( bShow ){
    $el.show().animate({height: height}, {duration: 500});
  } else {
    $el.animate({height: 0}, {duration: 500, complete:function (){
        $el.hide();
      }
    });
  }
}
