var splash_delay = 7 * 1000;


jQuery(document).ready(function(){
  // Put the video overlay icon 'on top' of video thumbnails
  jQuery(".gallery li.type-video img").each(function(i){
      var src = jQuery(this).attr("src");
      var newbg = 'transparent url(' + src + ') no-repeat center center';
      jQuery(this).css({'background':newbg});
      jQuery(this).attr({'src':'/wp-content/themes/griffin/libs/images/video-icon-overlay.png'});
  });
  
  
	jQuery("h2 a.reveal").toggle(
		function() {
			jQuery(this).parents('div.season').find('div.post').show('fast');
		},
		function() {
//			jQuery(this).parents('div.season').find('div.post:not(.post-index-0)').hide('fast');
			jQuery(this).parents('div.season').find('div.post').hide('fast');
		}
	);
	
	
/****	the `splash` page overlay ****/
//	why do we have to do this ?
//	remove the onclick function
	jQuery(".splash").attr('onclick', null);

//	timer
	t = setTimeout( 
		function() {
			jQuery(".splash").fadeOut('slow');
		}, splash_delay
	);
	
//	any key removes the splash
	if ( jQuery(".splash:visible").size() ) {
		jQuery(window).keydown(function (e) {
			jQuery(".splash").fadeOut('slow');
			jQuery(window).unbind('keydown');
			return false;
		});
	}

	
//	redirect on click
	jQuery(".splash").click(
		function() {
			location.href = '/tickets/ahead-of-the-pack/';
			return false;	//	stop propogation
		}
	);
  
});
