$(function() {

	//$('div#content').hide().fadeIn(300);
	
	//fonts
	Cufon.replace('h1,h5', { fontFamily: 'Gotham Medium' });
	Cufon.replace('div.image-words p', { fontFamily: 'Gotham Book' });
	
	//words
	$('div.image-words').each(function(){
	
		var thisHeight = $(this).height();
		var parentHeight = $(this).parent('div').height();
		var thisPosition = (parentHeight - thisHeight) / 2;
		
		$(this).css('bottom',thisPosition);
	
	});
	
	// Q&A
	var activeIndex = $('dl.toggle dd .current-page').parents('dd').index('dd');
	
	$('dl.toggle dd').delay(100).queue(function() {
		
		$('dl.toggle dt a span').show();
		
		if ($('dl.toggle dd .current-page').length == 1) {
			$('dl.toggle dd:eq(' + activeIndex + ')').siblings('dd').hide();
			$('dl.toggle dt:eq(' + activeIndex + ')').siblings('dt').removeClass('active').children('a').attr('title','Show');
			$('dl.toggle dt:eq(' + activeIndex + ') a').attr('title','Hide');
		} else {
			$('dl.toggle dd').hide();
			$('dl.toggle dt').removeClass('active');
			$('dl.toggle dt a').attr('title','Show');
		}

	});
	
	$('dl.toggle dt').click(function(){
	
		var $x = $(this);
		var rel = $(this).attr('rel');
		
		//$('a.people-thumb').hide();
		//$('a.' + rel).fadeIn();
	
		if ($x.next('dd').is(':visible')){
			$x.next('dd').hide();
			$x.removeClass('active');
			$x.children('a').attr('title','Show');
			$x.children('a').children('span').html('+');
		} else {
			$x.next('dd').show();
			$x.addClass('active');
			$x.children('a').attr('title','Hide');
			$x.children('a').children('span').html('-');
		}
		
		return false;
	
	});
	
	$('dl.toggle dt').hover(
		function () {$(this).addClass('hover');}, 
		function () {$(this).removeClass('hover');}
	);
	
	jQuery.fn.peopleFilter = function() {
		
		var thisVal = $(this).val();
		
		$('a.people-thumb').hide();
		
		if ($('p#people-filter select').val()){
			$('a.' + thisVal).fadeIn();
		} else {$('a.people-thumb').fadeIn();}
		
	};
	
	
	if ($('p#people-filter select').val()){ $('p#people-filter select').peopleFilter(); }
	
	
	$('p#people-filter select').change(function(){$(this).peopleFilter();});
	
	
	
	

});
