rez=function(){
	var topLinks = 120;
	var amplePanell = 205;
	var salt_entre_panells = 5;
	var ample = document.body.clientWidth;
	var cols = Math.floor(ample / amplePanell);
	var principal = document.getElementById("links");
	var divs = principal.getElementsByTagName("div");

	for(var c=0;c<divs.length;c++){
		var clip = divs[c];
		clip.style.cssFloat = "none";
		clip.style.styleFloat = "none";
		clip.style.position = "absolute";
		var posx = c%cols;
		var clipAra = divs[c];
		clipAra.alt = gimmeAlt(clipAra);
		try{
			clipAnterior = divs[c-cols];
			if(clipAnterior<=0){
				clipAnterior = false;
			}
		}catch(e){
			clipAnterior = false;
		}
		if(clipAnterior){
			topAra = clipAnterior.alt + salt_entre_panells + parseInt(clipAnterior.style.top);
		}else{
			topAra = topLinks;
		}

		clipAra.style.left = posx * amplePanell + "px";
		clipAra.style.top = topAra +"px";
	}
}
gimmeAlt = function(clip){
	altLink = 18;
	altTitol = 22;
	var total = clip.getElementsByTagName("li").length;
	var alt  = altTitol + (altLink * total);
	return alt;
}
window.onload=function(){
	window.onresize=rez;
	rez();
}
