	$().ready(function(){
		$('#teamRiders a').click(
					function() {
						imgSrc = $(this).attr("href");
						imgId = imgSrc.substring(imgSrc.indexOf("rider_")+6, imgSrc.indexOf("_lg.jpg"));
						showTeamLightBox(imgId);
						return false;
					}
				);
	});
	
	var showingTeamLightBox = 0;
	
	function hideTeamLightBox(){
		destroyTeamLightBox();
	}
	
	function destroyTeamLightBox(doFade){
		showingTeamLightBox = 0;
		
		$('#teamItem-lightbox').remove();
		$('#teamItem-overlay').remove();
		$('select').css({ 'visibility' : 'visible' });
	}
	
	function showTeamLightBox(wId){
		if (showingTeamLightBox > 0) {
			destroyTeamLightBox();
		}
		showingTeamLightBox = wId;
		setupTeamLightBox();
		
		$('#teamItem-overlay').fadeIn();
		$('select').css({ 'visibility' : 'hidden' });
	}
	
	function setupTeamLightBox(){
		$('body').append('<div id="teamItem-overlay"></div><div id="teamItem-itemNav"></div><div id="teamItem-lightbox"><div id="teamItem-lightbox-back"></div><div class="lightbox-secNav"><a href="#_" class="lightbox-secNav-btnClose"></a></div><div class="lightbox-container-image-box"><div class="lightbox-container-image"><div class="lightbox-content"></div><div class="lightbox-loading"><a href="#" class="lightbox-loading-link"></a></div></div></div></div>');
		
		$('#teamItem-lightbox .lightbox-content').css({
				'background-image': 'url(/files_team/rider_'+showingTeamLightBox+'_lg.jpg)'
			});
		
		var arrPageSizes = ___getPageSize();
		$('#teamItem-overlay').css({
				width:				arrPageSizes[0],
				height:				arrPageSizes[1]
			}).fadeIn();
		var arrPageScroll = ___getPageScroll();
		$('#teamItem-lightbox').css({
				top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
				left:	arrPageScroll[0]
			}).show();
		$('#teamItem-overlay, #teamItem-lightbox-back').click(function() {
				hideTeamLightBox();
				return false;
			});
		$('#teamItem-lightbox .lightbox-loading-link, #teamItem-lightbox .lightbox-secNav-btnClose').click(function() {
				hideTeamLightBox();
				return false;
			});
		setupWindowResize();
	}
	
	function setupWindowResize(){
		$(window).resize(function() {
				// Get page sizes
				var arrPageSizes = ___getPageSize();
				// Style overlay and show it
				$('#teamItem-overlay, #jquery-overlay').css({
					width:		arrPageSizes[0],
					height:		arrPageSizes[1]
				});
				// Get page scroll
				var arrPageScroll = ___getPageScroll();
				// Calculate top and left offset for the jquery-lightbox div object and show it
				$('#teamItem-lightbox, #jquery-lightbox').css({
					top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
					left:	arrPageScroll[0]
				});
				$('#jquery-blank-anchor').css({
						top: arrPageScroll[1]
					})
			});
		
		var arrPageScroll = ___getPageScroll();
		$('#jquery-blank-anchor').css({
				top: arrPageScroll[1]
			})
	}
