/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var N = 5;

function shuffle(n) {
    var l = [];
    var i;
    for (i = 0; i < n - 1; i++) {
        l.push(i);
    }
    l.sort(function(){return Math.random() < 0.5;});
    return l;
}

window.onload = function(){
    var cl = document.getElementById('commentList');
    cl.setAttribute('style', 'display:none');
    var items = cl.getElementsByTagName('li');
    var l = shuffle(items.length);
    var ul = document.createElement("ul");
    ul.setAttribute("class", cl.getAttribute("class"));
    for(var i = 0; i < N; i++) {
        if(items[l[i]] != null) {
            ul.appendChild(items[l[i]]);
        }
    }
    cl.parentNode.replaceChild(ul, cl);
};