$(document).ready(function() {
	
	// placeholder for 2011 launch
	setOverlaySize();
	
	$('ul#eventSelection li:last').addClass('last');
	
	//Frontpage's tooltip
	$('a#duplicate').tooltip({
		'tip'		:	'#tip',
		'relative'	:	true,
		'offset'	: [0, 100]
	});
   	
	//Fancybox	$("a#videoplay").fancybox({	 	'hideOnContentClick': false,	 	'frameWidth': 830,	 	'frameHeight': 505,
	 	'title': 'No'	});		$("a#subVideoPlayLink1").fancybox({	 	'hideOnContentClick': false,	 	'frameWidth': 853,	 	'frameHeight': 505	});		$("a#subVideoPlayLink2").fancybox({	 	'hideOnContentClick': false,	 	'frameWidth': 853,	 	'frameHeight': 505	});
	
	//Video nav	$('#videoNavigator a').live('click', function() {		//hide all video players		$('.videoPlayer').hide();				//Remove and add current class		$('#videoNavigator a').removeClass('current');		$(this).addClass('current');		//Show correct video player		$('#fancy_div #vp-'+$(this).attr('id').split('-')[1]).show();				return false;	});		//Page load first video	$('#videoNavigator a:first').addClass('current');	$('.videoPlayer:first').show();
	
	//Leaderboard tabs
	$('ul#leaderboard a').click(function() {
		var curChildIndex = $(this).parent().prevAll().length + 1;
		$(this).parent().parent().children('.current').removeClass('current');
		$(this).parent().addClass('current');
		$(this).parent().parent().next('.freedrop').children('.current').show(function() {
			$(this).removeClass('current');
			$(this).parent().children('div:nth-child('+curChildIndex+')').hide(function() {
				$(this).addClass('current');
				$(this).children('iframe').delay(500).focus();
			});
		});
		return false;
	});
	
});

//Gallery pagination
//Tweets pagination
$(function(){
	$(".flickr-thumb").quickpaginate({ perpage: 12, pager : $(".pager") });
	$(".tb_tweet").quickpaginate({ perpage: 6, pager : $(".pagerTwitter") });
});

// placeholder for 2011 launch
$(window).resize(setOverlaySize);

// placeholder for 2011 launch
/* set overlay size */
function setOverlaySize() {
	var overlayHeight = $("#container").height() + $("#footer").height()+100;
	$("#launchOverlay").css({
			display : "block",
			width : $(window).width(),
			height : overlayHeight
	});
}

