Effects of the image potential on electronic and impurity states in a quantum box