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

function setTall() {
	if (document.getElementById) {
		// the divs array contains references to each column's div element.  
		// Replace 'center' 'right' and 'left' with your own.  
		// Or remove the last one entirely if you've got 2 columns.  Or add another if you've got 4!
		var divs = new Array(document.getElementById('middlecontainer'), document.getElementById('rightcontainer'), document.getElementById('leftcontainer'));
		var lastdivs = new Array(document.getElementById('concertcontainer'), document.getElementById('inthestudio'), document.getElementById('banneritem'));

		// Let's determine the maximum height out of all columns specified
		var maxHeight = 0;
		for (var i = 0; i < divs.length; i++) {
			if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;
		}
		
		var diff1 = divs[0].offsetHeight - divs[1].offsetHeight;
		var final1 = diff1 + lastdivs[1].offsetHeight - 2;
		
		var diff2 = divs[0].offsetHeight - divs[2].offsetHeight;
		var final2 = diff2 + lastdivs[2].offsetHeight + 2;
		
		lastdivs[1].style.height = final1 + 'px';
		lastdivs[2].style.height = final2 + 'px';
		
		// Let's set all columns to that maximum height
		for (var i = 0; i < lastdivs.length; i++) {
			
			//alert('lastdivs - ' + lastdivs[i].offsetHeight);
			
			//lastdivs[i].style.height = maxHeight + 'px';
			//alert(lastdivs[i].style.height);
			// Now, if the browser's in standards-compliant mode, the height property
			// sets the height excluding padding, so we figure the padding out by subtracting the
			// old maxHeight from the new offsetHeight, and compensate!  So it works in Safari AND in IE 5.x
			if (lastdivs[i].offsetHeight > maxHeight) {
				//lastdivs[i].style.height = (maxHeight - (lastdivs[i].offsetHeight - maxHeight)) + 'px';
			}
		}
	}
}

window.onload = function() {
	setTall();
}

window.onresize = function() {
	setTall();
}