Adding javascript for messages