Separated out the error box javascript