var tables = document.getElementsByTagName('table');
var max = 0;
for (var i=0; i<tables.length; i++) {
  if ((tables[i].getAttribute('className') == "ab") || (tables[i].getAttribute('class') == "ab")) {
    if (tables[i].offsetWidth > max) {
      max = tables[i].offsetWidth;
    }
  }
}

for (var i=0; i<tables.length; i++) {
  if ((tables[i].getAttribute('className') == "ab") || (tables[i].getAttribute('class') == "ab")) {
    tables[i].style.width = max + "px";
    tables[i].style.margin = "0.75em auto";
    var divs = tables[i].getElementsByTagName('div');
    for(var j=0, l = divs.length; j<l; j++) {
      if(divs[j].currentStyle && (divs[j].currentStyle.display == 'block')) {
        divs[j].style.width = divs[j].offsetWidth + 'px';
        divs[j].style.styleFloat = 'none';
      }
    }
  }
}