$(function ()
{

    var zindex = 10,
    dropped = 0;

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

    var drop = function (event, ui) {
	if ($(this).data('value') === ui.draggable.data('value')) {
	    dropped++;
	    var clone = ui.helper.clone();
	    var top = 52;
	    var left = 91;
	    ui.helper.remove();
	    clone.appendTo($(this));
	    clone.attr('style', 'top:' + top + 'px;left:' + left + 'px;');
	    if (dropped === 8){
		$('#jplayer_well').jPlayer('play');
	    }
	} 
//	else {
//	    $('#jplayer_wrong').jPlayer('play');
//	}
    };

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