sorry for the late reply.
i guess we are talking about the default template.
that html is not in the source, it's dynamicall generated.
If you want to style it, i'm already doing it in the style section
#pages span { padding-left:0.5em; padding-right:0.5em; cursor:pointer; }
you see, it's all DIV "pages" and every page is a SPAN.
you probably don't need javascript to arrange them, but just css.