// this tells jquery to run the function below once the DOM is ready
$(document).ready(function() {

  // choose text for the show/hide link
  var showText="Show me the trails";
  var hideText="Hide the trails";
  
  // create the toggle link
  $("#toggle").before("<p><a href='#' id='toggle_link'>"+showText+"</a></p>");
  
  // hide the content
  $('#toggle').hide();
  
  // capture clicks on the newly created link
  $('a#toggle_link').click(function() {
  
	// change the link text
	if ($('a#toggle_link').text()==showText) {
	  $('a#toggle_link').text(hideText);
	}
	else {
	  $('a#toggle_link').text(showText);
	}
	
	// toggle the display
	$('#toggle').toggle(400);
	
	// return false so any link destination is not followed
	return false;
  
  });

});
