$(document).ready(function(){

	// Hides all of the information on page load
	$("div.instServ_info_box").hide();

	$("div.instServ_info_box").addClass("group");

	// Makes the entire div clickable and starts subsequent function
	$("div#instServSub h3").click(function(){
		// Upon clicking the information for the department will expand down
		$(this).next("div.instServ_info_box").slideToggle("slow").siblings("div.instServ_info_box").slideUp("slow");
		// This adds the 'active' class to the div changing the arrow to point down
		$(this).toggleClass("active");
		// This removes the 'active' class when another institute is clicked
		$(this).siblings("h3").removeClass("active");
	
		$("div.overview_content").show().siblings("div").hide();
		$("div.instServ_info_box li.overview_tab").addClass("active").siblings("li").removeClass("active");

		$("li.statistics_tab").click(function(){
			$("div.statistics_content").show(0).siblings("div").hide(0);
		});
		$("li.overview_tab").click(function(){
			$("div.overview_content").show(0).siblings("div").hide(0);
		});
		$("li.rankings_tab").click(function(){
			$("div.rankings_content").show(0).siblings("div").hide(0);
		});
		$("li.innovations_tab").click(function(){
			$("div.innovations_content").show(0).siblings("div").hide(0);
		});
		$("li.contact_tab").click(function(){
			$("div.contact_content").show(0).siblings("div").hide(0);
		});
	});
	
	$("div.instServ_info_box li").click(function(){
		$(this).addClass("active");
		$(this).siblings("li").removeClass("active");
	});
	
	$("div#instServSub h3").hover(function(){
		$(this).addClass("hover");
	}, function() {
		$(this).removeClass("hover");	
	});
	
	$("div.instServ_info_box li").hover(function(){
		$(this).addClass("hover");
	}, function() {
		$(this).removeClass("hover");	
	});
	
});