$(document).ready(function() {
	$(".ppc").click(function () {
		var ppc = $(this);
		var description = $($(".ppd:first", this.parentNode)[0]); // Select first sibling ".ppd" (preset param description).

		if (ppc.html() == "[+]") {
			ppc.html("[-]");
			description.show();
		} else {
			ppc.html("[+]");
			description.hide();
		}
	});

	$(".pp").click(function () {
		var pp = $(this);

		// Update caption.
		$(pp.parent().find(".pc:first")[0]).html(pp.attr("title"));

		var nclass = ".p" + pp.html();
		var oclass = pp.parent().data("class");
		if (oclass == undefined)
			oclass = ".p" + $(pp.parent().find(".pp:first")[0]).html();
		pp.parent().data("class", nclass);

		$(".pp", pp.parent()).each( function () {
			$(this).removeClass("pp-active");
		});

		pp.addClass("pp-active");

		$(oclass, pp.parent()).each( function () {
			$(this).hide();
		});
		$(nclass, pp.parent()).each( function () {
			$(this).show();
		});
	});
});
