
$(function()
	{
	var counter = 0;
	var figures = ['triangle','square','rectangle'];

	$('#jplayer').on($.jPlayer.event.ended,function(event)
		{
		$('.figure').addClass(figures[0]).parent().fadeIn();

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

			swfPath: '../../styles/flash',
			supplied: 'mp3',
			cssSelectorAncestor: '#jp_container_figure'
			});

		$('#jplayer_figure').on($.jPlayer.event.ended,function(event)
			{
			++counter;

			$('.figure').removeClass(figures[counter-1]).addClass(figures[counter]);
			$('#jplayer_figure').jPlayer('setMedia', {mp3: './media/'+figures[counter]+'.mp3'});
			});
		});
	});
