// JavaScript Document
$(function()
	{

	$('#expand h3').addClass('show-me').toggle(function()
		// toggle is inbuilt in jquery. this first function says add class to all h3 in example-two, then toggle on the following two functions
					{
						$(this).removeAttr('class').addClass('minimise').next().slideDown(500);
						// gets rid of the default class set up earlier, adds a new one
					},function()
					{
						// second function, do the opposite, but quicker
						$(this).removeAttr('class').addClass('show-me').next().slideUp(200);
					});

$('#expand p').addClass('show-me').toggle(function()
		// toggle is inbuilt in jquery. this first function says add class to all h3 in example-two, then toggle on the following two functions
					{
						$(this).removeAttr('class').addClass('minimise').next().slideDown(500);
						// gets rid of the default class set up earlier, adds a new one
					},function()
					{
						// second function, do the opposite, but quicker
						$(this).removeAttr('class').addClass('show-me').next().slideUp(200);
					});	


$('#expand div:nth(0), #expand div:nth(1), #expand div:nth(2), #expand div:nth(3)').hide();
// hide first & last divs, you dont have to but just so you can see how the next part works a bit better

$('#expand h3').click(function()
					{
						var element = $(this).next();
						if ($(element).is(":visible") == true)
						// sets variable and checks if next div is visible
							{
								$('#expand div:visible').not(element).slideUp(200);
								
							}

						else
							{
								$('#expand div:visible').slideUp(200);
								$(this).next().slideDown(500);
							}
							return false;
					});
	});



