/* 
	by Paul@YellowPencil.com and Scott@YellowPencil.com
	feel free to delete all comments except for the above credit
*/

// Initialize Scripts - is this a browser that understands DOM?

function scriptInit() {
if (!document.getElementById) {
	return;
	}
}

// Set up Event Listener - the script that allows us to use the addEvent call below

function addEvent(elm, evType, fn, useCapture) {
	if (elm.addEventListener) {
	elm.addEventListener(evType, fn, useCapture);
	return true;
	} else if (elm.attachEvent) {
	var r = elm.attachEvent('on' + evType, fn);
	return r;
	} else {
	elm['on' + evType] = fn;
	}
}

function setTallBottom() {
	if (document.getElementById) {
		var divs = new Array(document.getElementById('xleftcol3content'), document.getElementById('xmiddlecol3content'), document.getElementById('xrightcol3content'));
		
		var maxHeight = 0;
		for (var i = 0; i < divs.length; i++) {
			if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;
		}
		
/*
var Message = 	" divs[0].offsetHeight: " + divs[0].offsetHeight + "\n" +
				" divs[1].offsetHeight: " + divs[1].offsetHeight +  "\n" +
				" divs[2].offsetHeight: " + divs[2].offsetHeight +  "\n" +
				" maxHeight: " + maxHeight;
alert (Message);
*/
		for (var i = 0; i < divs.length; i++) {
			divs[i].style.height = maxHeight + 'px';
			if (divs[i].offsetHeight > maxHeight) {
				divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
			}
		}
	}
}
function equalHeightAll() {
	setTallBottom();
}

/*
	Fire Events - you can add other scripts here and call them using the following method.  
	This one balances the columns when the page loads, and again when the window is resized. But not when user changes text size.
*/

addEvent(window, 'load', equalHeightAll, false);
addEvent(window, 'resize', equalHeightAll, false);
