Moved javascript to chat.js