| 
					
				 | 
			
			
				@@ -8,6 +8,32 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @license Licensed under the General Public License version 2 and later. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/*jslint white: true, onevar: true, undef: true, nomen: true, eqeqeq: true,  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true,  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ indent: 2 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/*global $*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Provide an appropriate toggle message depending on TOC display state 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @return string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+function ahToggleGetText(state) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  return state ? '[ + ]' : '[ - ]'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Toggle the state of the headings list and the label of the toggle text. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @return void 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+function ahTocToggle() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  var display = $('.ah-toc ul').css('display'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  $('.ah-toc .ah-toggle').text(ahToggleGetText(display !== 'none'));  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  $('.ah-toc ul').toggle(100);   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * Build a TOC div from the Hn elements in a given context 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  *  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -43,7 +69,7 @@ function ahTocBuildToc() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   list = "<ul>\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   index = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  elements.each(function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  elements.each(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     element = $(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     id = element.attr('id'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (id === '') { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -61,9 +87,11 @@ function ahTocBuildToc() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   $('div.ah-toc', context).remove();  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // @TODO use a theme function 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  context.prepend('<div class="ah-toc"><center>Contents</center></div>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  context.prepend('<div class="ah-toc"><div class="ah-toc-title">Contents</div></div>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   $('div.ah-toc').append(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  return elements; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  $('<span class="ah-toggle">' + ahToggleGetText(false) +  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    '</span>').appendTo($('div.ah-toc-title')).click(ahTocToggle); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 $(ahTocBuildToc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   
			 |