$(function()
{
	$('#jplayer').on($.jPlayer.event.ready,function()
		{
			$('#jplayer').jPlayer('setMedia', {mp3: './media/file2.mp3'});

		});
	var top;
	var left;
	var count = 0;
	$(".shape").draggable({revert: true});
	$(".target").droppable({
	tolerance: "pointer",
        drop: function(event, ui) {
		console.log('drop');
		if (ui.draggable.data('value') === $(this).data('value'))
		{
			top = $(this).position().top;
			left = $(this).position().left + ($(this).width() / 2) - (ui.draggable.width() / 2);
			ui.draggable.draggable({ revert: false });
			ui.draggable.draggable('disable').animate({'left':left+'px','top':top+'px'});
			count++;
			if (count === 2) {$('#jplayer_well').jPlayer('play');
			$('.shape').draggable('disable');}
		} else $('#jplayer_wrong').jPlayer('play');

		}
	});

});