﻿function setMatchingDivHeightsByClassName(className)
{
    var divs = document.getElementsByTagName('div');
    var matchDivs = [];

    var divHeight;
    var maxHeight = 0; 

    for (var i = 0; i < divs.length; i++)
    {
        if (divs[i].className.toLowerCase() == className.toLowerCase())
        {
            var currentDiv = divs[i];
            matchDivs[matchDivs.length] = currentDiv;

            // determine height for <div> element
            if (currentDiv.offsetHeight)
            {
                divHeight = currentDiv.offsetHeight;
            }
            else if (d.style.pixelHeight)
            {
                divHeight = currentDiv.style.pixelHeight;
            }

            maxHeight = Math.max(maxHeight, divHeight) ;
        }
    }

    // assign maximum height value to all of container <div> elements
    for (var i = 0; i < matchDivs.length; i++)
    {
        matchDivs[i].style.height = maxHeight + "px";
    }
}


