Phase analysis of image states and surface states associated with nearly-free-electron band gaps.