$(document).ready(function() {
	$('ol#biography_list').tabs('div.biography');

	if (navigator.appName == 'Microsoft Internet Explorer') {
		$('ol#biography_list a').bind('focus', function() {
			this.blur();
		});
	}
	
	$('ol#biography_list a').bind('click', function() {
		$('ol#biography_list .thumbnail img').css('visibility', 'hidden');
		$(this).find('img').css('visibility', 'visible');

		$('ol#biography_list a').removeClass('current');
		$(this).addClass('current');
		
		slideshow($(this).context.hash);
	});
	
	slideshow(document.location.hash);
});

function slideshow(hash) {
	var sleep = 3;
	var fade = 1;
	
	switch (hash) {
		case "":
		case "#nedelcu":
			$('#nedelcu .slideshow').crossSlide({sleep: sleep, fade: fade}, [
				{src: 'templates/web/images/team/nedelcu_1.jpg'},
				{src: 'templates/web/images/team/nedelcu_2.jpg'},
				{src: 'templates/web/images/team/nedelcu_3.jpg'}
			]);
			break;
		case "#peter":
			$('#peter .slideshow').crossSlide({sleep: sleep, fade: fade}, [
				{src: 'templates/web/images/team/peter_1.jpg'},
				{src: 'templates/web/images/team/peter_2.jpg'}
			]);
			break;
		case "#sommer":
			$('#sommer .slideshow').crossSlide({sleep: sleep, fade: fade}, [
				{src: 'templates/web/images/team/sommer_1.jpg'},
				{src: 'templates/web/images/team/sommer_2.jpg'},
				{src: 'templates/web/images/team/sommer_3.jpg'}
			]);
			break;
		case "#pelz-vetter":
			$('#pelz-vetter .slideshow').crossSlide({sleep: sleep, fade: fade}, [
					{src: 'templates/web/images/team/pelz-vetter_1.jpg'},
					{src: 'templates/web/images/team/pelz-vetter_2.jpg'},
					{src: 'templates/web/images/team/pelz-vetter_3.jpg'}
			]);
			break;
		case "#heinsius":
			$('#heinsius .slideshow').crossSlide({sleep: sleep, fade: fade}, [
				{src: 'templates/web/images/team/heinsius_1.jpg'},
				{src: 'templates/web/images/team/heinsius_2.jpg'}
			]);
			break;
	}
}
