var MineTimer = (function() {

    var seconds = 0;
    var timerId = null;
    var elementToAdjourn = null;

    return {

        init: function(id) {
            elementToAdjourn = id;
        },

        count: function() {
            elementToAdjourn.text(++seconds);
        },

        resetTimer: function() {
            seconds = 0;
            count();

        },

        stopTimer: function() {
            if (timerId) {
                window.clearInterval(timerId);
                timerId = null;
            }
        },

        startTimer: function() {
           if (!timerId) {
                timerId = window.setInterval(MineTimer.count, 1000);
           }
        },

        passedTime: function() {
            return seconds;
        }

    };
})();