/*	TABS: Homepage tabs function
	-------------------------------------------------- */
	$(function () {
		// Add "tabs_on" class
		$(".login_search").addClass("tabs_on");
		
		// If there is a class of "tabs_on", do the following... 
		if ( $(".login_search").hasClass("tabs_on") ) {
			
			// Add a class to each <h3>: 
			$(".login_search h3:nth-child(1)").addClass("tab_1");
			$(".login_search h3:nth-child(3)").addClass("tab_2");
			
			// Add "selected" class to the first tab (the one
			// we want to display by default) and hide the other's
			// containing div:
			$("h3.tab_1").addClass("selected");
			$("div.member_search").hide();
			
			// Click event to toggle between the tabs:
			$(".login_search h3").click(function () {
				if ( !$(this).hasClass("selected") ) {
					$(".login_search h3").removeClass("selected");
					$(this).addClass("selected");
					$("div.member_login, div.member_search").hide();
					$(this).next("div").show();
				};
			});
		};
	});


	
/*	TABS: Meet The Team tabs function (ajax call)
	-------------------------------------------------- */
	$(function () {
		
		// When the page loads, add a class of "selected"
		// to the first <li> and load in it's corresponding
	    // member profile page:
	    $.ajaxSetup({ cache: false });
		$(".team_tabs ul li:first").addClass("selected");
		$(".member_content").load($(".team_tabs ul li a:first").attr("href"));
		
		// Click function to load member profiles:
		$(".team_tabs ul li a").click(function (event) {
			
			// Prevent default link behaviour:
			event.preventDefault();
			
			// Setup a variable that contains the href
			// of the link that fired the click event:
			var loadMember = $(this).attr("href");
						
			// If there is no class of "selected" on the parent <li>, 
			// apply one then load in the content from our var, "loadMember":
			if (!$(this).parent().hasClass("selected")) {
				$(".team_tabs ul li").removeClass("selected");
				$(this).parent().addClass("selected");
				$(".member_content").load(loadMember);
			};
		
			// Display a loading image placeholder
			// until content has loaded fully:
			$(".loading").ajaxStart(function () {
				$(this).show();
				$(".member_content").html().hide();				
			}).ajaxStop(function () {
				$(this).hide();
				$(".member_content").html().show();
			});	
			
		});
		

	});


	
/*	TABS: Homepage Carousel (ajax call)
	-------------------------------------------------- */
	$(function () {
		
		// When the page loads, add a class of "selected"
		// to the first <li> and load in it's corresponding
		// carousel copy page:
		$("ul.carousel_nav li:first").addClass("selected");
		$(".panel").load($("ul.carousel_nav li a:first").attr("href"));
		
		// Click function to load member profiles:
		$("ul.carousel_nav li a").click(function (event) {
			
			// Prevent default link behaviour:
			event.preventDefault();
			
			// Setup a variable that contains the href
			// of the link that fired the click event:
			var loadPanel = $(this).attr("href");
						
			// If there is no class of "selected" on the parent <li>, 
			// apply one then load in the content from our var, "loadPanel":
			if (!$(this).parent().hasClass("selected")) {
				$("ul.carousel_nav li").removeClass("selected");
				$(this).parent().addClass("selected");
				$(".panel").load(loadPanel);
			};
		});
		
		// Display a loading image placeholder
		// until content has loaded fully:
		$(".loading").ajaxStart(function () {
			$(this).show();
			$(".panel").html().hide();				
		}).ajaxStop(function () {
			$(this).hide();
			$(".panel").html().show();
		});
	});


	
/*	IE6: Function to fix :hover on <li>
	-------------------------------------------------- */
	$(function () {
		$("body#IE6 ul#navlist > li, body#IE6 .team_tabs ul > li").hover(function(){
	           $(this).addClass("over");
	    }, function() {
	           $(this).removeClass("over");
	    });
	});

	$(function() {
	$("body#IE6 ul#membersNavList > li, body#IE6 .team_tabs ul > li").hover(function() {
	        $(this).addClass("over");
	    }, function() {
	        $(this).removeClass("over");
	    });
	})

