(function($) {
	$.fn.teamLoad = function(options) {
	
		var defaults = {}
		var options = $.extend(defaults, options);
						 
		return this.each(function() {

			var obj = $(this);			

			var isActive = false;

			obj.children().each(function() {
				
				$(this).bind('click', function(event) {
					event.preventDefault();
					
					if(isActive == false) {
						isActive = true;					
					
					
						var temp = $(this).attr('id').split('-');
						var currentActive = $('.logoactive').attr('id');
						var activeTemp = currentActive.split('-');

						$('#'+currentActive).find('img').attr('src', '/images/people/'+activeTemp[0]+'-small-grey.gif');
						$('#'+currentActive).removeClass('logoactive');

						$(this).find('img').attr('src', '/images/people/'+temp[0]+'-small.gif');
						$(this).addClass('logoactive');

						var oldCase = $('.infoactive').attr('id').split('-');
						$('#'+oldCase[0]+'-large').animate({
							top: '50%',
							right: '50%',
							height: '0px',								
							width: '0px'
							}, { duration: 400, complete: function() {
								
								$('#'+temp[0]+'-large').animate({
									marginTop: '0', 
									marginLeft: '0',
									top: '0',
									right: '0',	
									width: '328px',
									height: '323px'
								}, {duration: 400}, function() {
						
								});
							
							}
						});
						$('.infoactive').fadeOut('slow', function() {
							$(this).removeClass('infoactive');
							$('#'+temp[0]+'-info').fadeIn('slow', function() {
								$(this).addClass('infoactive');
								isActive = false;												
							});									
						});										
					}
				});

				$(this).hover(function() {
					var temp = $(this).attr('id').split('-');
					$(this).find('img').attr('src', '/images/people/'+temp[0]+'-small.gif');
				} , function() {
					var temp = $(this).attr('id').split('-');
					if(!$('#'+temp[0]+'-icon').hasClass('logoactive')) {
						$(this).find('img').attr('src', '/images/people/'+temp[0]+'-small-grey.gif');					
					}
				});
			});
	
	
		});
	}
})(jQuery);