ajax-y magic

Theoretically this should allow the chat to be more chat-like and not require a page refresh.
I'd prefer to leave the config file as just editable variables. If you want to move it out of index, let's put it in functions, where it makes logical sense.