I read the w3 specs which just say that there are 3 parts to a document. The sequence is assumed and there is no explicit statement forbidding, for example, a little js snippit up front.
I understand that it is possible to configure TAM to add the js at the end of the dicument but it beats me why they put it up top if it can cause such obvious problems!