$(function() {
	
	$(".logos .logo_img:nth-child(3n)").css('margin-right', '0px');
	
	$('.white_bg').hover(function() {
		if ($(this).next().is(':visible')) {
			return false;
		}
		
		$(this).css({
			'padding': '20px 10px 20px',
			'margin': '0',
			'background': '#ffffff'
		});
	}, function() {
		if ($(this).next().is(':visible')) {
			return false;
		}
		
		$(this).css({
			'padding': '20px 10px 10px',
			'margin': '0 0 10px',
			'background': 'transparent'
		});
	});
	
	$('.client_header').toggle(function() {
		$(this).find('a').text('Click to Collapse');
		
		$(this).next().show();
		
		$(this).parent().css('background-color', 'white');
		$(this).parent().css('padding', '20px 10px 10px');
		$(this).parent().css('margin', '0 0 10px');
		
		$(this).parent().next().slideDown();
		
		$(this).find('h4').css('background', 'url(http://www.slaterfund.com/wp-content/themes/slater/images/close.png) no-repeat');
	}, function() {
		var that = $(this);
		
		$(this).find('a').text('Click to Expand');
		
		$(this).parent().next().slideUp(function() {
			that.parent().css('background-color', 'transparent');
			that.next().hide();
		});
		
		$(this).find('h4').css('background', 'url(http://www.slaterfund.com/wp-content/themes/slater/images/open.png) no-repeat');
	});
	
	//
	$('body.scientific_advisory_boards h3').nextUntil("h3").hide();
	$('body.scientific_advisory_boards h3').css('cursor', 'pointer');
	
	$('body.scientific_advisory_boards h3').toggle(function() {
		$(this).nextUntil("h3").slideDown();
	}, function() {
		$(this).nextUntil("h3").slideUp();
	});
	
	//
	$('.archive h3').nextUntil("h3").hide();
	$('.archive h3').css('cursor', 'pointer');
	
	$('.archive h3.current').nextUntil("h3").show();
	
	$('.archive h3').toggle(function() {
		$(this).nextUntil("h3").slideDown();
	}, function() {
		$(this).nextUntil("h3").slideUp();
	});
	
	//
	$('.news_item').not('.current_year').hide();
	$('.archives a').click(function() {
		$('.news_item').hide();
		
		var clazz= '.' + $(this).attr('href');
		
		$(clazz).show();
		
		return false;
	});
	
	$('.archives a').not('.archives a:last').after(' | ');
	
	//
	$(".logos .logo_img:nth-child(3n)").addClass("last");
	
	$('.logo_img img').each(function() {
		$(this).css('margin-top', (150 - $(this).height()) / 2);
	});
});
