$(document).ready(function() {
  
  $(".freeThingsToDo ul li").after("<li> | </li>");
  $(".freeThingsToDo ul li:last-child").hide();
  
  $.fn.nextUntil = function(expr) {
  var match = [];
  // We need to figure out which elements to push onto the array
  this.each(function(){
  // Traverse through the sibling nodes
  for( var i = this.nextSibling; i; i = i.nextSibling ) {
  // Make sure that we're only dealing with elements
  if ( i.nodeType != 1 ) continue;
  // If we find a match then we need to stop
  if ( jQuery.filter( expr, [i] ).r.length ) break;
  // Otherwise, add it on to the stack
  match.push( i );
  }
  }); 
  return this.pushStack( match, arguments ); 
  };  

  $.fn.wrapAll = function() {
  if ( !this.length ) return this; 
  var b = jQuery.clean(arguments)[0];
  this[0].parentNode.insertBefore( b, this[0] ); 
  while ( b.firstChild ) b = b.firstChild; 
  return this.appendTo(b); 
  };

 //wrap all attractions sections in .attractuonToggle
  $(".freeThingsToDo h2").each(
  function(){
  $(this).nextUntil("h2").not(".back2top").wrapAll("<div class='collapsibleToggle'></div>");
  $(this).before("<a class='showhide'>show / hide</a>");
  }
  );  

  //make attractions description disappear
  $("a#collapse").click(
  function () {
  $("div.collapsibleToggle").hide();
  }
  );

 //make attractions description reappear like magic
  $("a#expand").click(
  function () {
  $("div.collapsibleToggle").show();
  }
  );

  //make individual show/hide feature toggle individual attraction description
  $("a.showhide").click(
  function () {
  $(this).next().next().toggle();
  }
  );
  
});