//обратный счетчик товара 


function getRandomInRange(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
getRandomInRange(3000, 20000);

var count_1 = 2;
var count_2 = 2;
var timer_delay = 1000;

$(function () {
    $('.decimal').html(count_1);
    $('.units').html(count_2);
    
    var timer = setTimeout(function tick() {

        if (count_2 == 0) {
            count_1--;
            count_2 = 9; 
        } else {
            count_2--;
        }

        $('.decimal').html(count_1);
        $('.units').html(count_2);

        timer_delay = getRandomInRange(3000, 10000);
        // console.log(timer_delay);

        if ((count_1 == 0)&&(count_2 == 4)) {
            return;
        } else {
            timer = setTimeout(tick, timer_delay);
        }

    }, 0);
});