// current link on subnav
if($('#sidebar .subnav').length) {
	var current = location.pathname;
	$('#sidebar .subnav a[href$=' + current + ']').parent().addClass('current');
	
	// make exception for company news
	/*
	if(/news\/company-news/i.test(current)) {
		$('#sidebar .subnav a[href$=news/blog]').parent().addClass('current');
	}
	*/
}

// open external links in new windows
$('a[href*=://]').not('[href^=' + location.protocol + '//' + location.hostname + ']').attr('target', '_blank');

// set class if no banner
if(!$('#banner').length) {
	$('#body').addClass('no-banner');
}

// homepage banner
if($('#body').hasClass('home')) {
	$('#banner .banner-images').addClass('cycle').cycle({
		easeIn: 'easeOutExpo',
		fx: 'cover',
		// speed: 750,
		timeout: 7000
	});
	$('#banner-caption').addClass('cycle').cycle({
		// easing: 'easeOutExpo',
		// fx: 'scrollLeft',
		fx: 'fade',
		timeout: 7000
	});
	$('.cycle').hover(function() {
		$('.cycle').cycle('pause');
	}, function() {
		$('.cycle').cycle('resume');
	});
}

// team bios
if($('#team-thumbnails').length) {
	var startingThumb = Math.floor(Math.random()*$('.team-thumb').length);
	
	// hide all but first
	$('.team-bio').not(':eq(' + startingThumb + ')').hide();
	
	// mark first as current
	$('.team-thumb:eq(' + startingThumb + ')').addClass('current');
	
	// click action for thumbnails
	$('#team-thumbnails .team-thumb a').click(function() {
		var index = $(this).parent().index('.team-thumb');
		$('.team-thumb.current').removeClass('current');
		$(this).parent().addClass('current');
		$('.team-bio:visible').fadeOut('normal', function() {
			$('.team-bio:eq(' + index + ')').fadeIn('normal');
		});
		return false;
	});
}
