$(document).ready(function() {
	// functions to hide and show the full category listings
	// choose text for the show/hide link
	var showcatText="<< Show all categories";
	var hidecatText="<< Hide extra categories";

	// hide the category links and h2 on main product page
	$("#cats p").not(".active").addClass("out").hide();
	$(".notnow").remove();

	// create the toggle link
	$("#cats").before("<a href='#' id='theswitch'>"+showcatText+"</a>");


	// capture clicks on the newly created link
	$("a#theswitch").click(function() {

	// change the link text and toggle relevant text
	if ($(this).text()==showcatText) {
	$("#cats .out").show('slow');
	$(this).text(hidecatText);
	}
	else {
	$("#cats .out").hide('slow');
	$(this).text(showcatText);
	}

	// return false so any link destination is not followed
	return false;
	});




	// functions to show full descriptions on the main category listings page
	// choose text for the show/hide link
	var showText="info...";
	var hideText="hide...";

	// hide the content
	$(".categories h3").siblings("p.desc").hide();

	// create the toggle link
	$(".categories h3").before("<a href='#' class='toggle_link'>"+showText+"</a>");


	// capture clicks on the newly created link
	$("a.toggle_link").click(function() {

	// change the link text and toggle relevant text
	if ($(this).text()==showText) {
	$(this).text(hideText).siblings('.desc').toggle("slow");
	}
	else {
	$(this).text(showText).siblings('.desc').toggle("slow");
	}

	// return false so any link destination is not followed
	return false;
	});

});
