$(document).ready(function() {
	
		sh_highlightDocument();

		// Add the Convert button.
		$('#Again').before('<input type="button" id="convertButton" value="Convert" />');
		$('#convertButton').click(function() {

			$('#Options').toChecklist({
				addSearchBox : true,
				showSelectedItems : true
			});
			$(this).remove();
			$('#Again').show();
			
			// Enable the "check all" and "uncheck all" buttons after converting the demo checklist.
			$('input:button:disabled','#myForm').attr('disabled',false);
		});

		// Convert the two SELECT boxes at the bottom of the page when the document is ready.
		$('#selectBox1').toChecklist({
			useIncludedPluginStyle : false,
			showCheckboxes : false
		});
		$("#selectBox2").toChecklist({
			useIncludedPluginStyle : false,
			showCheckboxes: true,
			addSearchBox: true,
			addScrollBar: false,
			maxNumOfSelections : 3
		});
		
		// Table of contents
		var headers = 'div.explanation :header:not(.noIndex)';
		$(headers).toc({before:'div.explanation'});
		
		// Animate page load.
		/*
		(function() {
			$('div.explanation :header:first, #toc').hide();
			var t = setTimeout(function() {
				var showFirstHeader = function() { $('div.explanation :header:first').show(900); }
				var showToc = function() { $('#toc').slideDown('slow',showFirstHeader); };
				// var showOptions = function() { $('#Options').show('slow',showToc); };
				$('#toc').slideDown(900,showFirstHeader);
			}, 250);
		})();
		*/

});
