
Array.prototype.equalizeHeights = function() {
	if (this.length > 1) {
		var max_height = 0;
		this.each(function(ele) {
			var this_height = ele.getHeight();
			if (this_height > max_height) {
				max_height = this_height;
			}
		});
		this.each(function(ele) {
			var padding = parseInt(ele.getStyle("padding-top")) + parseInt(ele.getStyle("padding-bottom"));
			var border = parseInt(ele.getStyle("border-width-top")) + parseInt(ele.getStyle("border-width-bottom"));
			if (isNaN(padding)) padding = 0;
			if (isNaN(border)) border = 0;
			var new_height = max_height - padding - border;
			ele.setStyle({
				height: new_height + "px"
			});
		});
	}
}

Event.observe(window, "load", function() {
	
	$$("#middle-3cols, #middle-3cols #midbar, #middle-3cols #sidebar").equalizeHeights();
	$$("#homepage-bottom #photo-gallery, #homepage-bottom #newsletter-signup").equalizeHeights();

	Event.observe($("q"), "click", function(e) {
		if ($F("q") == "Search...") {
			$("q").value = "";
		}
	});

});