Yep yep, making a note of this.  Derek also I think has refactored this bit since in economics and I may be able to pull it out like you say into a common file.  Will talk with Derek about this later.  Also... at some point, we have to look into all the auto-generated inline styles that are being produced with tables.  It's causing an !important nightmare.... but that's legacy and been around a long time and will probably go away.  May be a docbook thing