// JavaScript Document

$(document).ready(function(){
					  
	var collapsedHeight = 60;
	
	$('.leadershipBody').each(function(){
		if ($(this).height() < collapsedHeight + 16) return;
		$(this).css('height', collapsedHeight);
		$(this).parent().append('<div class="leadershipMore">Read More</div>');
	});
	
	$('.leadershipMore').click(function(){
								 
		var target = $(this).prev('.leadershipBody');
		
		if (target.height() <= collapsedHeight + 16){
			
			$('.leadershipBody').not(target).each(function(){
				if ($(this).height() <= collapsedHeight + 16) return;
				$(this).next('.leadershipMore').html('Read More');
				$(this).animate({'height' : collapsedHeight}, 1000, function(){
					$(window).trigger('resize');
				});
			});
			
			$(this).html('Collapse');
			var height = 0;
			target.children().each(
				function(){
					height += $(this).outerHeight(true);
				}
			);
			target.animate({'height' : height+10}, 1000, function(){
				$(window).trigger('resize');
			});
			
		} else {
			
			$('.leadershipBody').each(function(){
				if ($(this).height() <= collapsedHeight + 16) return;
				$(this).next('.leadershipMore').html('Read More');
				$(this).animate({'height' : collapsedHeight}, 1000, function(){
					$(window).trigger('resize');
				});
			});
			
		}
	});
});
