$(function()
{
var answer = [26,25,22,27,24,28];
var boxes = [0,0,0,0,0,0];
var zindex = 20;

for (var i=22;i<=28;i++){
	if (i !== 23) $('.elements').append('<div class="text" data-value="'+i+'">'+i+'</div>');
}

$(".text").draggable({
			start: function(){
				zindex++;
				$(this).css('z-index',zindex);
			}
			});
$(".target").droppable({
tolerance: "pointer",
drop: function(event, ui) {
		if (!ui.draggable.hasClass('dropped'))
		{
			ui.draggable.addClass('dropped');
			boxes[$(this).data('value')] += ui.draggable.data('value');
		}
	},
out: function(event, ui) {
		if (ui.draggable.hasClass('dropped'))
		{
			ui.draggable.removeClass('dropped');
			boxes[$(this).data('value')] -= ui.draggable.data('value');
		}
	}
});
$(".check").click(function() {
	if (answer.toString() === boxes.toString()) $('#jplayer_well').jPlayer('play');
			else $('#jplayer_wrong').jPlayer('play');
	});
});