$(document).ready(function(){

 //INVESTMENT TEAM PAGE //////////////////////////////////////////////////////////////
 $("#team li.teamMember .bio").hide();  
 
 $(".teamMember div a").click(function(event){
   $(this).parent("div").nextAll(".bio").toggle();
   $(this).parent("div").toggle();
   return false;
 });
 
 $("#team ul .teamMember .bio h4").click(function(event){
   //toggles Bio
   $(this).parent("div").toggle();
   $(this).parent("div").siblings("#col1").toggle();
   //toggles link
  // $(this).parents("li").next("#col1").next("a").toggle();
   return false;
 });
 
 
 
 //NAVIGATION SIDEBAR //////////////////////////////////////////////////////////////
 //includes/nav.php page
 $("#navshell span h1").click(function(event){
  //Toggles Nav arrow
  $(this).parent("span").toggleClass("closed");
  $(this).parent("span").next().toggle();
  return false;
 });
 
 //index page
 $("#nav2 ul").hide();
 $("#navshell ul ul").show();
 $("#nav2 a.disabled").click(function(event){
  //Toggles Nav arrow
  //$(this).parent("li").toggleClass("closed");
  //$(this).parent("li").toggleClass("open");
  $(this).parent("li").children("ul").toggle();
  return false;
 });
 
 
 
 //PAGINATES PAGES //////////////////////////////////////////////////////////////
 //Hides all pages, then shows only first page
 $("#paginate").children("div").hide();
 $("#paginate div:first").show();

 //var n = $("#paginate div").length - $(".figures").length; //Sets the number of page divs present
 var n = $("#paginate").children("div").length; //Sets the number of page divs present
 
 //Sets up the page number links ..................................................
 $("#paginate h2").before(
		"<ul class='pgnum'>Pages </ul>"
		);
	 
 pages($("#paginate ul.pgnum"));
	
 function pages(j){
	 for (i=1;i<=n;i++){
		 j.append("<li><a href=''>" + i + "</a></li>");
	 }
 } //Creates links for the appropriate number of divs present
 
 $("#paginate .pgnum:eq(0) li:first").addClass("bold"); //Sets the first page link to bold for top of the page
 $("#paginate .pgnum:eq(1) li:first").addClass("bold"); //Sets the first page link to bold for the bottom of the page
 
 //Sets the interactivity for the page number links ..................................................
  $("#paginate .pgnum a").click(function(event){
	 //Checks which page number has been clicked and sets to variable index
	 var index = $(this).text() - 1; // Subtract 1 since the index starts at 0
	 //Resets all pages to hidden
	 $("#paginate").children("div").hide();
	 $("#paginate .pgnum li").removeClass();
	 //Shows selected page
	 $("#paginate").children("div").eq(index).show();
	 $("#paginate .pgnum:eq(0) li").eq(index).addClass("bold");
	 $("#paginate .pgnum:eq(1) li").eq(index).addClass("bold");
	 return false;
	});

});

