jQuery().ready(function()
{
	$('.employees .employee').each(function()
	{
		var height = $(this).height();
		$(this).prepend($('<a href="#">' + $(this).children('strong.name').html() + '</a>').addClass('name'));
		$(this).children('strong.name').remove();
		if($(this).hasClass('closed'))
		{
			$(this).css({ height: $(this).children('.name').height() + 1 });
		}
		$(this).children('.name').click(function()
		{
			if($(this).parent().hasClass('opened'))
			{
				$(this).parent().removeClass('opened').addClass('closed').stop().animate({ height: $(this).height() + 1 }, 700);
			}
			else
			{
				$(this).parent().siblings('.employee.opened').each(function()
				{
					$(this).removeClass('opened').addClass('closed').stop().animate({ height: $(this).children('.name').height() + 1 }, 700);
				});
				$(this).parent().removeClass('closed').addClass('opened').stop().animate({ height: height }, 700);
			}
			return false;
		});
	});
});
