$(function()
{
var order = [["marsz","maszerowanie"],["bieg","bieg"],["podskoki","podskoki"],
		["marsz-wysoki-rejestr","wysoki-rejestr"],["marsz-niski-rejestr","niski-rejestr"],
		["marsz","maszerowanie"]];
var index = 0;
	$('#jplayer').on($.jPlayer.event.ended,function(event)
		{
		$('.sound').fadeIn();
		$('.'+order[index][1]).fadeIn();

		$('#jplayer_sound').jPlayer(
			{
			ready: function()
				{
				$(this).jPlayer('setMedia', {mp3: './media/'+order[index][0]+'.mp3'});
				},

			swfPath: '../../styles/flash',
			supplied: 'mp3',
			cssSelectorAncestor: '#jp_container_sound'
			}).jPlayer('play');
		});
	$('#jplayer_sound').on($.jPlayer.event.ended,function(event)
		{
		if (index <=5){
		setTimeout(function()
					{
						$('.'+order[index][1]).fadeOut();
						index++;
						$('.'+order[index][1]).fadeIn();
						$('#jplayer_sound').jPlayer('setMedia', {mp3: './media/'+order[index][0]+'.mp3'}).jPlayer('play');

					}, 100);
			}
		});


});
