﻿//var qSet = [{id:'F34H-KMDl-12J2-CCD45-AS', total: 2, positive: 1},... <-- this part is generated by visual function
//var yesText, noText <--- are generated by XSLT function, they ere localizable

$(function() {
for (var i = 0; i < qSet.length; i++) {
        var divObj = $('#' + qSet[i].id.toLowerCase());
        var rate = Math.round(((qSet[i].positive) / (qSet[i].total)) * 100);
        divObj.find('.yes').html(yesText + ' (' + rate + '%)');
        divObj.find('.no').html(noText + ' (' + (100 - rate) + '%)');
        divObj.find('.yes_percents').css('width',
                Math.round(divObj.find('.total_percents').width() / 100 * rate) + 'px');
    }

});
