This is an asynchronous call:
$.post("username_check.php", {....
So the return statements in the callback happen long after usernameValid returns (and since it didn't return anything when it was run, it's undefined).
Where you have return false; you should call another function, for example: userNameInvalidFunction(), and something else for true...or just continue submitting, etc.
The alternative is to make your AJAX call synchronous...but I strongly recommend against this, since it'll completely lock up the user's browser while it executes.