function colheight(containerId, tags) { if (tags == null) { tags = ['div']; } colheight.processIds = function() { for (var i = 0; i < colheight.ids.length; i++) { var id = colheight.ids[i]; var el = document.getElementById(id.containerId); if (!el) continue; var max = -1; for(var j = 0; j < el.childNodes.length; j++) { var chld = el.childNodes[j]; if (!chld.tagName) continue; if (id.tags[chld.tagName.toLowerCase()] !== true) continue; if (chld.offsetHeight > max) { max = chld.offsetHeight; } } for(var j = 0; j < el.childNodes.length; j++) { var chld = el.childNodes[j]; if (!chld.tagName) continue; if (id.tags[chld.tagName.toLowerCase()] !== true) continue; if (chld.offsetHeight < max) { chld.style.height = max + 'px'; if (chld.offsetHeight > max) { var diff = chld.offsetHeight - max; chld.style.height = (max-diff) + 'px'; } } } } } if (document.addEventListener) { colheight.addEvent = function(el,event,handler){ el.addEventListener(event, handler, false); } } else if (document.attachEvent) { colheight.addEvent = function(el,event,handler){ el.attachEvent('on' + event, handler); } } if (!colheight.onloadAttached) { colheight.addEvent(window, 'load', function() { setInterval(function() { colheight.processIds(); }, 10); }); colheight.onloadAttached = true; } colheight.ids = colheight.ids || []; var atags = {}; for (var a = 0; a < tags.length; a++) { atags[tags[a].toLowerCase()] = true; } colheight.ids.push({'containerId':containerId, 'tags':atags}); }