function initTag() {
    var tag = getElementsByClassName(document, 'ul', 'searched')[0];
    var allLI = tag.getElementsByTagName('li');
    var xclass = 0;
    var lastClass = 0;
    var rows = 0;
    offsetOne = allLI[0].offsetLeft;
    
    for (i = 0; i < allLI.length-1; i++) {
        xclass = 1+(parseInt(Math.random()*1000)%4);
        while (xclass == lastClass) {
            xclass = 1+(parseInt(Math.random()*1000)%4);
        }
        lastClass = xclass;
        allLI[i].firstChild.className = 'size'+xclass;
        if (allLI[i].offsetLeft == offsetOne) {
          rows++;  
        }
        if (rows == 3 && i != allLI.length-1) {;
            allLI[i].style.visibility = 'hidden';
        } else {
            allLI[i].style.visibility = 'visible';
        }
    }
    if (rows == 4) {
    	initTag();
    }
}

if (window.attachEvent) {
    window.attachEvent("onload", initTag, false);
}

if (window.addEventListener) {
    window.addEventListener("load", initTag, false);
}