/*
div-height equalizer from
http://www.devarticles.com/c/a/Web-Design-Standards/Matching-div-heights-with-CSS-and-JavaScript/3/
note that it didn't work in FF because it wasn't setting the heights in pixels, just a number.
*/
function matchHeights(){
	// initialize maximum height value
	var maxHeight=0;

	if(document.getElementById('home_page')){
		//Home Page
		var divs=getElementsByClassName ('details', 'a', document.getElementById('home_page'));
	} else if(document.getElementById('promotion')) {
		//Promotion
		var divs=getElementsByClassName ('', 'li', document.getElementById('promotion'));
	}

	if(divs){
		// iterate over specified elements to greatest height
		for(var i=0;i<divs.length;i++){
			//alert(divs[i]);
			var d=divs[i];

			// determine height for <div> element
			if(d.style.height){
				//alert('style.height');
				var divHeight=d.style.height;
				} // end else if
			else if(d.offsetHeight){
				//alert('offsetHeight');
				var divHeight=d.offsetHeight;
				} // end if
			else if(d.style.pixelHeight){
				//alert('style.pixelHeight');
				var divHeight=d.style.pixelHeight;
				} // end else if
			//alert('divHeight: '+divHeight);

			// calculate maximum height
			maxHeight=Math.max(maxHeight,divHeight);
			//alert('maxHeight: '+maxHeight);
			} // end for (args)

		//alert('final maxHeight for categories: '+maxHeight);

		// assign maximum height value to all specified elements
		for(var i=0;i<divs.length;i++){
			//alert(divs[i]);
			d=divs[i];
			d.style.height=maxHeight+'px';
			d.style.marginLeft='0px';
			d.style.height=maxHeight+'px';
			if (d.offsetHeight > maxHeight) { // fix for the difference between height and offsetHeight in standards-compliant mode (see http://www.paulbellows.com/getsmart/balance_columns/column.js)
					d.style.height = (maxHeight - (d.offsetHeight - maxHeight)) + 'px';
				}
		}

	}
}

addLoadEvent(matchHeights);