$(function ()
{
    var zindex = 10,
    positions=[
	[-13,292],
	[103,340],
	[166,462],
	[375,444],
	[332,151],
	[153,145]
    ],
            dropped = 0,
            drop = function (event, ui) {
                if (ui.draggable.data('value') === $(this).data('value')) {
                    dropped++;
                    ui.draggable
                            .draggable({revert: false})
                            .draggable("option", "disabled", true);
                    $('#jplayer_well').jPlayer('play');
		    
                    ui.draggable.animate({
                        top: positions[ui.draggable.data('value')][0],
                        left: positions[ui.draggable.data('value')][1]
                    }, 900);
                    $(this).children().fadeOut(1000);
		    ui.draggable.children('span:first-child').fadeOut(1000);
		    ui.draggable.children('span:last-child').fadeIn(1000);
                } else {
                    $('#jplayer_wrong').jPlayer('play');
                }
            };

    $(".dragg")
            .draggable({
                start: function () {
                    zindex++;
                    $(this).css('z-index', zindex);
                },
                revert: true,
                revertDuration: 900
            });

    $(".dropp").droppable({
        accept: ".dragg",
        tolerance: "touch",
        drop: drop
    });

});