;(function($){
	$(function(){
		$(".expandingListWrapper > :not(:header)").hide();
		
		$('.expandingListWrapper').prepend('<div class="expandCollapse">Expand All</div>');
		
		$('.expandCollapse').css({cursor:"pointer"}).click(function(){
			if ($(this).html() == "Expand All") {
				
				$(this).html("Collapse All");
				
				$(".expandingListWrapper :header").each(function(){
					if($(this).nextUntil(":header", "*").is(":hidden")){
						slideDown(this);
					}
				});
				
			} else{
				
				$(this).html("Expand All");
				
				$(".expandingListWrapper :header").each(function(){
					if($(this).nextUntil(":header", "*").is(":visible")){
						slideUp(this);
					}
				});
			}
		});
			
		$(".expandingListWrapper :header").css({cursor:"pointer"}).click(function(){
			if($(this).nextUntil(":header", "*").is(":visible")){
				slideUp(this);
			} else {
				slideDown(this);
			}
		});
		
		var slideUp = function(trigger){
			$(trigger).nextUntil(":header", "*").slideUp();
		};
		
		var slideDown = function(trigger){
			$(trigger).nextUntil(":header", "*").slideDown();
		};
	});
})(jQuery);
