/*
Derived from a script by Alejandro Gervasio.
Modified to work in FireFox by Stefan Mischook for Killersites.com

How it works: just apply the CSS class of 'column' to your pages' main columns.

## modified by WebAware: also works for classes featuredleft, featuredright
*/
function f_matchColumns() {

	var divs = document.getElementsByTagName('div');
	var contDivs = [];
	var maxHeight = 0;
	var divHeight = 0;
	var i;

	// iterate over all <div> elements in the document
	for (i in divs)
	{
		var d = divs[i];

		// make collection with <div> elements with class attribute 'container'
		if (/(column|featuredleft|featuredright)/.test(d.className))
		{
			contDivs[contDivs.length] = d;

			if (d.offsetHeight)
				maxHeight = Math.max(maxHeight, d.offsetHeight);

			else if (d.style.pixelHeight)
				maxHeight = Math.max(maxHeight, d.style.pixelHeight);
		}
	}

	// assign maximum height value to all of container <div> elements
	for (i in contDivs)
		contDivs[i].style.height = maxHeight + "px";
}

// Runs the script when page loads
if (this.addEventListener) this.addEventListener("load", f_matchColumns, false);
else if (this.attachEvent) this.attachEvent("onload", f_matchColumns);

