$(document).ready(function() {

	var COOKIE_NAME = 'Expand ' + document.title;
	var options = {
		expires : 10,
		path : '/'
	};

	$(".cHeadSlow, .cHeadFast, .cHeadInstant").each(function() {

		if ($.cookie(COOKIE_NAME + " - " + $(this).attr("id")) == 'X') {

			$("+ .cBody ", this).show();
			$(this).toggleClass("cPlus");
		}
	});

	$(".cHeadSlow").click(function() {

		$("+ .cBody ", this).slideToggle("slow");
		$(this).toggleClass("cPlus");

		if ($(this).attr("id")) {

			if (!$(this).hasClass("cPlus")) {
				$.cookie(COOKIE_NAME + " - " + $(this).attr("id"), 'X', options);
			} else {
				$.cookie(COOKIE_NAME + " - " + $(this).attr("id"), '', options);
			}
		}
	});

	$(".cHeadFast").click(function() {

		$("+ .cBody ", this).slideToggle("fast");
		$(this).toggleClass("cPlus");

		if ($(this).attr("id")) {

			if (!$(this).hasClass("cPlus")) {
				$.cookie(COOKIE_NAME + " - " + $(this).attr("id"), 'X', options);
			} else {
				$.cookie(COOKIE_NAME + " - " + $(this).attr("id"), '', options);
			}
		}
	});

	$(".cHeadInstant").click(function() {

		$("+ .cBody ", this).toggle();
		$(this).toggleClass("cPlus");

		if ($(this).attr("id")) {

			if (!$(this).hasClass("cPlus")) {
				$.cookie(COOKIE_NAME + " - " + $(this).attr("id"), 'X', options);
			} else {
				$.cookie(COOKIE_NAME + " - " + $(this).attr("id"), '', options);
			}
		}
	});

});