//atag1 - atag7
//var maxCount = 0;
var maxCount = new Hash();
var tagsize = function(){
	var a = $$('.tags');
	
	a.each(function(el){
		var t = parseInt($(el).readAttribute('count'));
		var group = $(el).readAttribute('groupid');
		if (typeof(maxCount[group])=='undefined')
			maxCount[group]=0;
		if(t > maxCount[group])
			maxCount[group] = t;
	});
	//alert(maxCount['index_left_tags']);
	
	$H(maxCount).each(function (el) { maxCount[el[0]] = Math.ceil(el[1] / 7) });
	//maxCount[group] = Math.ceil(maxCount[group] / 7);
	a.each(function(el){
		var c = parseInt($(el).readAttribute('count'));
		var group = $(el).readAttribute('groupid');
//		alert('atag' + (Math.ceil(c / maxCount) + 1));
		
		if ((Math.ceil(c / maxCount[group]))>=8)
		{
			$(el).addClassName('atag8');						
		}
		else
		{
			$(el).addClassName('atag' + (Math.ceil(c / maxCount[group]) + 1));			
		}

	});
}

if(window.addEventListener){ // Mozilla, Netscape, Firefox
   window.addEventListener('load', tagsize, false);
} else { // IE
   window.attachEvent('onload', tagsize);
}
