// Make all blocks (divs) on one page the same height as the tallest one (when faux columns can't be used)

function getHeights(){
	//check for standards compliance
	if(!document.getElementById) return;
	if(!document.getElementsByTagName) return;
	var midHolder = document.getElementById("midholder");
	var blocks = midHolder.getElementsByTagName("div");
	// loop through all divs
	for(var i = 0; i < blocks.length; i++){
		if(blocks[i].className == 'block'){ // we only want <div class="block">
			if(!height ||  height < blocks[i].offsetHeight){ // set the height for first div then reset it if the next div is taller and so on.
				var height = blocks[i].offsetHeight; //set the highest height
			}
		}
	}
	setBlockHeights(height); // run the setHeights function for the content blocks
	//setHeaderHeight(height); // make the page's heading the same height as well. (NOTE: This line is only relevant for this design)
}

// make all divs the same height in pixels. must be run on window resize, text increase/decrease. (a ballache basically.)
function setBlockHeights(height){
	var midHolder = document.getElementById("midholder");
	var blocks = midHolder.getElementsByTagName("div");	
	for(var i = 0; i < blocks.length; i++){
		// set heights for IE6/Win
		if(blocks[i].className == 'block' && !blocks[i].getAttribute("class")){
				blocks[i].style.height = height+'px'; // set height
		} 
		// set min-height for sane browsers
		else if(blocks[i].getAttribute("class") == 'block'){
				blocks[i].style.minHeight = height+'px'; // set min-height
		}
	}
}


addEvent(window,"load",getHeights);