Have faced all the problems mentioned before.But becuase of the performance benefits of using JavaScript for validation ,I used the following solution :
1) cleanly separate the JavaScript code into .js files eg. login.js
2) Use hidden frames, or floating frames to load them (js files)all once for the entire session of the user.
Think it over and see if you like it ..
Also, to speed trips to the server for validation ( incase you need to validate using a database , for example) , try posting data to a
servlet from a hidden frame.