$(document).ready(function(){
  // Hide menu item descriptors for inactive pages
  $('#masthead .nav li span').not('li.active span').hide();
  // Show menu item descriptor on hover
  $('#masthead .nav li:not(.active) a').hover(function () {$(this).parent().next().show(); }, function () {$(this).parent().next().hide(); });
 
 //add click events for content section menu
  $('#contentTop .nav li a').each(
		function (	intIndex ) {
			$(this).click(function (event) {
				event.preventDefault();
				// Hide any visible content section
				if($('.content-section').hasClass('visible')) {
					$('.content-section.visible').hide('normal', function () {
																		   
																		   $('#contentTop h2').hide('normal',function(){
								// Show content section associated with the clicked item on the content section menu.
								$('#contentSection'+intIndex).show('normal').addClass('visible');
														   });
             	$('.info-button').attr('src','img/btn_info-more.png');
			 	$('.info-button').addClass('collapsed');
																		   
																		   }).removeClass('visible');
				}
				else {
					// Collapse content info header and change info-button class
				$('#contentTop h2').hide('normal',function(){
								// Show content section associated with the clicked item on the content section menu.
								$('#contentSection'+intIndex).show('normal').addClass('visible');
														   });
             	$('.info-button').attr('src','img/btn_info-more.png');
			 	$('.info-button').addClass('collapsed');
				}
											
			});
		}
  );
  //add click handler for toggle info button  
  $('.info-button').click(function () {
	  	if ( $(this).hasClass("collapsed") ) {
			// Hide any visible content section
			if($('.content-section').hasClass('visible')){
     		 $('.content-section.visible').hide('normal', function () { 
					 $('#contentTop h2').show('normal', function () {
				     $('.info-button').attr('src','img/btn_info-less.png');
			    	 $('.info-button').removeClass('collapsed');				  
														  });
															
															});
			}
			else {
				 $('#contentTop h2').show('normal', function () {
				     $('.info-button').attr('src','img/btn_info-less.png');
			    	 $('.info-button').removeClass('collapsed');				  
														  });
			}
			 
			 
		}
		else {
			 $('#contentTop h2').hide('normal');
             $(this).attr('src','img/btn_info-more.png');
			 $(this).addClass('collapsed');
		}
									
	});
						  
 });

