function equalizeByRow(divClass) { // This function sets the heights of all the m4 classed divs with the same top position to be equal.
	try{
		divsToSize = $('content').getElementsByClassName(divClass);
		maxHeight = [0];
		for(i = divsToSize.length - 1; i >= 0 ; i--){// Specifically for use when window is resized
			$(divsToSize[i]).setStyle({'height' : 'auto'});
		}
		for(i = divsToSize.length - 1; i >= 0 ; i--){// Find the maximum hieght in each row
			divXY = Position.cumulativeOffset(divsToSize[i]);
			if(!maxHeight[divXY[1]]){
				maxHeight[divXY[1]] = 0;
			}
			maxHeight[divXY[1]] = Math.max(maxHeight[divXY[1]], divsToSize[i].offsetHeight);
		}
		for(i = divsToSize.length - 1; i >= 0 ; i--){// Set all heights in same row to the row maximum
			if(i > -1){
				if(i > -1){// required to catch strange IE7 bug
					divXY = Position.cumulativeOffset(divsToSize[i]);
					$(divsToSize[i]).setStyle({'height' : maxHeight[divXY[1]] + "px"});
				}
			}
		}
	} catch(e) {
		// IE6 likes to throw errors here, but the function still works.
	}
}
function equalize(divClass) { // This function sets the heights of all the specified classed divs to be equal.
	divsToSize = document.getElementsByClassName(divClass, 'content'); 
	//divsToSize = $('content').getElementsByClassName(divClass);
	maxHeight = 0;
	for(i = 0; i < divsToSize.length; i++){// Get max height
		$(divsToSize[i]).setStyle({'height' : 'auto'});// Specifically for use when window is resized
		maxHeight = Math.max(maxHeight, $(divsToSize[i]).getHeight());
	}
	for(i = 0; i < divsToSize.length; i++){// Set all heights to maximum
		$(divsToSize[i]).setStyle({'height' : maxHeight + "px"});
	}
}

function setHeight(){
	equalizeByRow('m4');
	equalize('s4');
}

window.onload = function() {
	setHeight();
}

window.onresize = function() {
	setHeight();
}