jQuery.fn.collapsable = function()
{
	return this.each(function()
	{
		var self = $(this);
		var toggle = $('<a class="collapsable-toggle"></a>');

		// Set the wrapped, relative content
		toggle._rel = self.wrapInner('<div class="collapsable-content"></div>').find('div.collapsable-content');

		if (self.hasClass('open'))
		{
			// Set toggle text
			toggle.html('<span>Close</span> '+ self.attr('title'));

			// Set the state
			toggle._rel.show();
		}
		else
		{
			// Set toggle text
			toggle.html('<span>Open</span> '+ self.attr('title'));

			// Set the state
			toggle._rel.hide();
		}

		// Bind clicks
		toggle.click(function()
		{
			if (self.hasClass('open'))
			{
				// Hide the content
				toggle._rel.stop().slideUp('fast');

				// Change the text
				toggle.find('span').text('Open')
			}
			else
			{
				// Hide the content
				toggle._rel.stop().slideDown('fast');

				// Change the text
				toggle.find('span').text('Close')
			}

			// Toggle state
			self.toggleClass('open').toggleClass('closed');
		});

		// Append the toggle to the con
		self.append(toggle);
	});
};