questions = {
    
    getAnswer: function(q) {
        var r = false;
        q.getElements('input[type=radio]').forEach(function(el) {
            if(el.checked) {
                r = el.getValue().toInt();
            }
        }.bind(this));

        return r;
    },

    calculateScore: function() {
        score = 0;
    
        qs = $$('#questions .options');
        qs.forEach(function(question) {
            score += this.getAnswer(question);
        }.bind(this));
    },

    allAnswered: function() {
        var r = true;
    
        qs = $$('#questions .options');
        qs.forEach(function(question) {
            if(this.getAnswer(question) === false) {
                r = false;
            }
        }.bind(this));
    
        return r;
    },
    
    __DEBUG_checkall: function() {
        $$('#questions .options').forEach(function(e){ 
            e.getElementsByTagName('input')[$random(0,2)].checked = true;
        })
    },
    
    __DEBUG_checknone: function() {
        $$('#questions .options input[type=radio]').forEach(function(e){ 
            e.checked = false;
        })
    }
}

window.addEvent('domready', function(){
    new SmoothScroll();    
});

