$( document ).ready( function() {

	if( $( '#todays-list' ).length == 0 ) {
		return;
	}

	var timeNow = new Date();

	$( '.shows' ).each( function() {

		selected = 0;

		$( $( this ).children( 'tbody' ).first().children( '.show' ).get().reverse() ).each( function() {

			var timeStr = $( this ).children( '.datetime' ).first().text();

			var timeShow = new Date( timeStr );

			if( timeNow > timeShow ) {
				if( selected == 0 ) {
					$(this).addClass( 'listred' );
				}
				else if(selected < 3) {
					$(this).addClass( 'listgray' );
				}
				else {
					$(this).hide();
				}
				selected++;
			}
		} );
	} );
} );

