$(function () {
    var task = 0,
            txt = [
                ['25 + 4 &middot; 3',37],
                ['5 &middot; (6 + 2)',40],
                ['45 : (12 &minus; 3)',5],
                ['(76 &minus; 36) : 4',10],
                ['(10 + 45) &minus; (36 &minus; 12)',31],
                ['40 + (74 &minus; 27)',87]
            ];
            
    function shuffleArray(array) {
        for (var i = array.length - 1; i > 0; i--) {
            var j = Math.floor(Math.random() * (i + 1));
            var temp = array[i];
            array[i] = array[j];
            array[j] = temp;
        }
        return array;
    }
        for (var i = 1; i <= $('.panorama')[0].childElementCount; i++) {
        $('.panorama .mask:nth-child(' + i + ')').text(txt[i - 1][1]).data('value', txt[i - 1][1]);
        console.log($('.panorama .mask:nth-child(' + i + ')').data('value'));
    }
    mix = shuffleArray(txt);
            console.log(mix);
    $(".mask").click(function () {

        if ($(this).data('value') === mix[task][1]) {
            $('#jplayer_well').jPlayer('play');
            $(this).animate({opacity:0},500);
            task++;
            if(task < 6){
            $('.btn span').html(mix[task][0]);
        } else {
            $('.btn span').html('Warszawa');
        }
        } else {
            $('#jplayer_wrong').jPlayer('play');
        }
    });

    
    $('.btn span').html(mix[task][0]);
});