http://nontroppo.org/wiki/script/header.js
http://nontroppo.org/wiki/script/buttons.js
Look at the javascript code above, it's much cleaner than the existing mediawiki code, doesn't rely on browser sniffing (it isn't necessary so don't do it : it breaks in some browsers and it's very bad practice) and is faster to set up the toolbar.