I have the following code which is intended to set 3 parallel divs to the same height. IE, Mozilla, Netscape produce the desired results, but Safari ignores the code somehow. Does anyone have suggestions, or see mistakes within Javascript? Thanks.


Code:
function matchColumns(){
	
	var divs,contDivs,maxHeight,divHeight,d;
	divs = document.getElementsByTagName('div');
	contDivs = [];
	maximumHeight = 0;
	
	for(var i=0;i<divs.length;i++)
	{
		if((divs[i].id == "grouping") || (divs[i].id == "textbar") || (divs[i].id == "ads") || (divs[i].id == "content"))
		{
			d = divs[i];
			contDivs[contDivs.length] = d;
			
			if(d.offsetHeight)
			{
				divHeight = d.offsetHeight;
			}
			else if(d.style.pixelHeight)
			{
				divHeight = d.style.pixelHeight;
			}
			maximumHeight = Math.max(maximumHeight,divHeight);
		}
	}
	contDivs[0].style.height = (maximumHeight + 20) + "px";
	contDivs[1].style.height = (maximumHeight-10) + "px";
	contDivs[2].style.height = maximumHeight + "px";
	contDivs[3].style.height = (maximumHeight-20) + "px";
}

window.onload = function()
{
	if(document.getElementsByTagName)
	{
		matchColumns();
	}
}