$(function ()
{
    var zindex = 10,
            dropped = 0,
            drop = function (event, ui) {
                if (ui.draggable.data('value') === $(this).data('value')) {
                    var color = ui.draggable.css('color');
                    dropped++;
                    $('#jplayer_well').jPlayer('play');
                    $(this).css('color', color);
                    if(dropped === 3){
                        $('.apple').fadeIn(800);
                    }
                } 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
    });

});