;(function($){
	$.fn.accordion = function() {
		
	var heightSpeed = 900
	
	$('div.collapsing').each(function() {
									  
								var thisDiv = $(this);
								$(thisDiv).append('<div class="teaser_button">[ + ]</div>');
							   	var teaserHeight = (   ($(this).find('span.teaser').height())  +  ($('h2').height())  +  ($('div.teaser_button').height()) + 30);
							   	$(thisDiv).css({'height':teaserHeight, 'overflow':'hidden'}).addClass('closed');
								$(thisDiv).find('li.thumb a:first').append('<div class="slide_button">+</div>');
								$(thisDiv).find('span.teaser').append('<span class="teaser_break">...<br /><br /><br /><br /><br /><br /><br /><br /><br /></span>');
							   });
	
	$('#mainContent_bottom_main').addClass('accordionWrapper');
	$('#video_container iframe.no_script').removeClass('no_script');
	
	
	$('.teaser_button').bind('click', function(){
					var thisButton = $(this);
					var thisSection = $(thisButton).parent(); 
					var thisTeaserBreak = $(thisSection ).find('span.teaser_break');
					var thisImage = $(thisSection).find("li.thumb");
					var teaserHeight = (   ($(thisSection).find('span.teaser').height())  +  ($('h2').height())  +  ($('div.teaser_button').height()) + 30);
					var thisHeight
					
					if($(thisSection).hasClass('closed')){
						
						$(thisImage).animate({"width": "180px"}, heightSpeed);
						$(thisButton).css( 'display','none');
						$(thisTeaserBreak).css( 'display','none');
						thisHeight = $(thisSection).children('div.content').height() + 30;
						$(thisSection).animate({"height":thisHeight}, heightSpeed, function(){
																							$(thisButton).html($(thisButton).html().replace('+', '-')).css( 'display','block');
																							$(thisSection).addClass('open').removeClass('closed')
																							});
						
					} else {
						$(thisButton).css( 'display','none');
						$(thisImage).animate({"width": "0"}, heightSpeed);
						$(thisSection).animate({"height":teaserHeight}, heightSpeed, function(){
																							$(thisTeaserBreak).css( 'display','inline');
																							$(thisButton).html($(thisButton).html().replace('-', '+')).css( 'display','block');
																							$(thisSection).addClass('closed').removeClass('open')
																							});
					}
				});
	}
	
	$.fn.randomSlogan = function() {
		var ixString = (Math.round(Math.random () * 100000) % textArray.length);
		var randomText = textArray [ixString];
		$('#slogan').html(randomText);
	}
	
	
})(jQuery);

