Fixed the javascirpt as per instructions from Tony.