function xpand(xref){
	if ($('.expand a.expand-this(#' + xref + ')').hasClass('selected')) {
		$('.expand-content#' + xref).slideUp('fast');
		
		//highlight current title
		$('.expand a.expand-this[href=#' + xref + ']').removeClass('selected');
		
	} else {
		
	
	$('.expand-content:not(#' + xref + ')').slideUp('fast', function(){
			$('.expand-content#' + xref).slideDown('fast');
		});
		
		
	//clear highlight from previous title
	$('.expand a.expand-this:not(#' + xref + ')').removeClass('selected');
	
	//highlight current title
	$('.expand a.expand-this[href=#' + xref + ']').addClass('selected');
	}
	
}

$(document).ready(function() {
	
	$('.expand-content').hide();
	
	$(".expand a.expand-this").click(function(){
		
		xref = $(this).attr("href").split('#')[1];
		
		xpand(xref);
		
		
		return false;
		
	});
	
	$("a.expand-all").click(function(){
		if ($(this).hasClass('selected')) {
			$(this).removeClass('selected');
			$('.expand-content').hide();
			$(this).text('Expand All');
		} else {
			$(this).addClass('selected');
			$('.expand-content').show();
			$(this).text('Collapse All');
		}
	});
});
