// Start jQuery

$(document).ready(function() {
	
	// Wrap each list item. 
	// <ul class="toggle"><li>Content</li></ul> === Becomes this: ===>
	// <ul class="toggle"><li><ul class="toggle-item"><li>Content</li></ul></li></ul>
	$('.toggle ul li, .toggle ol li').wrap('<li><ul class="toggle-item"></ul></li>');
	
	// Prepend title to parent list item
	// <ul class="toggle"><li><ul class="toggle-item"><li><h3>Title</h3> Content</li></ul></li></ul> === Becomes this: ===>
	// <ul class="toggle"><li><h3>Title</h3><ul class="toggle-item"><li>Content</li></ul></li></ul>
	$('.toggle-item li h3').each(function() {
		$(this).prependTo(this.parentNode.parentNode.parentNode);
	});
	
	// Append +/– symbols to toggle titles
	$('.toggle h3').append('<span class="plus">+</span><span class="minus">–</span>');
	
	// Hide all toggle items
	$('.toggle-item, .toggle h3 .minus').hide();
	
	// Toggle list items
	$('.toggle h3').click(function () {
		$(this).siblings('ul').slideToggle();
		$(this).children('.plus, .minus').toggle();
		$(this).toggleClass('active');
	});
	
	// Append testimonial content to the sidebar
	$('#sidebar').append($('.testimonial'));
	
	
}); // End jQuery