function getElementsByClassName(classname) {
    var rl = new Array();
    var re = new RegExp('(^| )'+classname+'( |$)');
    var ael = document.getElementsByTagName('*');
    var op = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
    if (document.all && !op) ael = document.all;
    for(i=0, j=0 ; i<ael.length ; i++) {
        if(re.test(ael[i].className)) {
        	rl[j]=ael[i];
            j++;
        }
    }
    return rl;
}

function stessa_altezza(className) {
	cols = getElementsByClassName(className);

	var max = 0;
	
	for(var i=0; i<cols.length; i++) {
		if(cols[i].clientHeight > max) max = cols[i].clientHeight;
	}
	
	for(i=0; i<cols.length; i++) {
		cols[i].style.height = max + "px";
	}

	for(i=0; i<cols.length; i++) {
		if(cols[i].clientHeight > max) {
			offset = cols[i].clientHeight - max;
			cols[i].style.height = (parseInt(cols[i].style.height)) - offset + "px";
		}
	}
}

window.onload = function() {
	clickme = document.getElementById('clickme');
	clickme.onclick = function() {
		stessa_altezza('stessa-altezza');
		return false;
	}
}
