$(document).ready(function(){
	
	

	/* parse nav for js-controlled expand / collapse */
	
	if($('.search-results').length == 0) // just list fully expanded nav on search results page
	{

		//hide groups of chapter pages & re-wire chapter links to expand / collapse
		items = $('.nav-chapter-link');
		$(items).each(function(){
			$(this).next().toggleClass('hide');
			$(this).click(function(event)
			{
				event.preventDefault();
				$(this).next().toggleClass('hide');
			});
		});
		
		//re-expand anything with nav-current
		items = $('.nav-list1 .nav-current');
		$(items).each(function(){
			$(this).next().removeClass('hide');
		});
		
		// unwire section links
		items = $('.nav-section-link');
		$(items).each(function(){
			$(this).addClass('noUndies');
			$(this).click(function(event)
			{
				event.preventDefault();
			});
		});
	
	}
	
	
});
