added javascript function for setting appropriate phrases.