var _globalWedstrijd = 0;
$(document).ready(function()
{
	$('#wedstrijdSamenvatting .nav-button').live('click',function(){
		if ($(this).hasClass('vorige'))
		{
			var iLoadWedstrijd = _globalWedstrijd+1;
		}
		else
		{
			var iLoadWedstrijd = _globalWedstrijd-1;
		}
		_globalWedstrijd = iLoadWedstrijd;
		$.getJSON('/ajaxcall.php?mode=wedstrijdSamenvatting', {nummer:iLoadWedstrijd,ajaxPointer:iLoadWedstrijd},
			function(response){
				if (response.data)
				{
					$('#wedstrijdSamenvatting .volgende-wedstrijd:eq(0)').animate({opacity:0},500,function(){
						$('#wedstrijdSamenvatting .container:eq(0) .volgende-wedstrijd').remove();
						$('#wedstrijdSamenvatting .container:eq(0)').append(response.data);
						countdownVolgendeWedstrijd();
					});
				}
			}
		);
		
	});
	
});
function countdownVolgendeWedstrijd()
{
	var newGame = new Date($('#volgendeWedstrijdStamp').val());
	$('#defaultCountdown').countdown({until: newGame,
		compact: true, 
		layout: '<li>{dn}</li><li>{hnn}</li><li>{mnn}</li><li>{snn}</li>'
	});
}
