/* ===================================================================== */
/* TEAM */

function preparePersons(label){

	$("span.person").each(function(i){
		openHtml = '<div class="openControl" id="show_'+this.id+'" onclick="openInfo(this)">' + label + '</div>';
		$("#_" + this.id).before(openHtml);
	});
	
	$("span.person").toggle(function() {
		$("#_" + this.id).show('slow');
		$("#show_" + this.id).hide();
	}, function() {
		$("#_" + this.id).hide('fast');
		$("#show_" + this.id).show();
	});
}


function closeInfo(el){
	$('#' + el.parentNode.id.substring(1)).click();
}

function openInfo(el){
	$('#' + el.id.substring(5)).click();
	$("#" + el.id).hide();
}

$(document).ready(function(){
   
   
	$("a[rel=gallery]").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'titlePosition' : 'inside',
		'autoScale' : false,
		'hideOnOverlayClick' : true,
		'hideOnContentClick' : true,
		'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
			if ($(this).attr('title')){
				return '<span class="photo_title">' + $(this).attr('title') + '</span>';
			} else {
				return '';
			}
		}
	});
   
	$("a.fancy").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'titlePosition' : 'inside',
		'autoScale' : true,
		'hideOnOverlayClick' : true,
		'hideOnContentClick' : true,
		'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
			if ($(this).attr('title')){
				return '<span class="photo_title">' + $(this).attr('title') + '</span>';
			} else {
				return '';
			}
		}
	});
   
   
   
})
