jQuery(
	function($) {
		if ($('div.accordion').length) {
			$('div.accordion')
				.accordion(
					{
						active: 1,
						autoHeight: false,
						clearStyle: true,
						collapsible: true,
						header: 'h1'
					}
				);
		}

		// handle management board togglers
		$('#management-board-list')
			// hide toggle contents on page load
			.find('.toggle')
				.hide()
			.end()
			// define opening/closing animation
			.delegate(
				'.toggler',
				'click',
				function()
				{
					var
						$board = $(this).closest('.managementBoard'),
						$toggle = $('.toggle', $board),
						$teaser = $('.teaserInfo', $board),
						$thumb = $('.thumb', $teaser),
						$big = $('.big', $teaser);

					$board.slideUp();
					if($thumb.is(':visible'))
					{
						$board
							.queue(
								function(n)
								{
									$thumb.hide();
									$big.show();
									$toggle.show();
									n();
								}
							);
					}
					else
					{
						$board
							.queue(
								function(n)
								{
									$thumb.show();
									$big.hide();
									$toggle.hide();
									n();
								}
							)
					}
					$board.slideDown();
				}
			);
	}
);
