// JavaScript Document
	// This controls the accordion property of the chapter menu.
	function initMenu() {
	  $('#menu ul').hide();
	  //$('#menu ul:first').hide();
	  $('#menu li a').click(
		function() {
		  var checkElement = $(this).next();
		  if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
			return false;
			}
		  if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
			$('#menu ul:visible').slideUp('normal');
			checkElement.slideDown('normal');
			return false;
			}
		  }
		);
	  }

	$(document).ready(function() {
		// hides the slickbox as soon as the DOM is ready
		// (a little sooner than page load)
		$('#navbox').hide();
		$('#toolbox').hide();
		$('#basketbox').hide();
		
		// toggles the chapter select on and off  
		$('a#chaptertoggle').click(function(){
			$('#navbox').stop().slideToggle(400)
			return false;
		});
		
		// hover off the nav and the div slides up afer 2 seconds.
		$('#navbox').hover(function() {
			$(this).show();
		}, function() {
			$('#navbox').animate({opacity: 1.0}, 5000).slideUp('slow', function() {$(this).hide();});
		});
		
		// toggles the printbasket on and off
		$('a#baskettoggle').click(function() {
			$('#basketbox').stop().slideToggle(400);
			return false;
		});
		// hover off the print basket and the div slides up afer 2 seconds.
		$('#basketbox').hover(function() {
			$(this).show();
		}, function() {
			$('#basketbox').animate({opacity: 1.0}, 5000).slideUp('slow', function() {$(this).hide();});
		});
		
		// hover function for all browsers for the xls div hover. 
		$('div.xl_bg').hover( 
			function() {$(this).addClass('hover');}, 
			function() {$(this).removeClass('hover'); 
		});
		
		$('div.search_results').hover( 
			function() {$(this).addClass('shover');}, 
			function() {$(this).removeClass('shover'); 
		});
		
		initMenu();
	});