/* our team ---------- */

if($('#team-members').length) {
	// setup variables
	var $members = $('#team-members .member'),
		$bios = $('#banner .bio'),
		total = $members.length;
	
	// pick random index
	var current = Math.floor(Math.random() * total);
	
	// set default active
	$members.eq(current).find('a').addClass('active');
	$bios.eq(current).fadeIn();
	
	// change bios on click
	$('a', $members).click(function() {
		// vars
		var $this = $(this);
		
		if($this.hasClass('active')) {
			return false;
		}
		
		// add and remove active class
		$this.parents('#team-members').find('a.active').removeClass('active').end().end().addClass('active');
		
		// get index
		var idx = $members.index($this.parent());
		
		// change bio
		$bios.filter(':visible').fadeOut('normal', function() {
			$bios.eq(idx).fadeIn();
		});
		
		return false;
	});
}
