$(function ()
{
    var zindex = 10,
            dropped = 0,
            drop = function (event, ui) {
                if (ui.draggable.data('value') === $(this).data('value')) {
                    var top = $(this).position().top;
                    var left = $(this).position().left;
                    var color = $(this).css('color');
                    dropped++;
                    ui.draggable
                            .draggable({revert: false})
                            .draggable("option", "disabled", true);
                    $('#jplayer_well').jPlayer('play');
                    ui.draggable.animate({
                        top: top + 5,
                        left: left + 23
                    }, 900).css({'color': color, 'text-shadow': 'none'});
                    $(this).css('border', 'none');
                } else {
                    $('#jplayer_wrong').jPlayer('play');
                }
            };

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

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

});