Have you tried jQuery SPServices api. There is a direct method given in the library. I used it.
http://spservices.codeplex.com/wikipage?title=$().SPServices.SPGetCurrentUser
http://spservices.codeplex.com/wikipage?title=$().SPServices.SPGetCurrentUser
Hope this helps you!
Also, I think you should load the web first and then you can get the current user.