From http://dev.enekoalonso.com/2010/07/20/little-tricks-string-padding-in-javascript/