Fixed resizing when the link is hidden.

Also make use of the 'var' keyword, fu globals.
Added a Chat class which implements basic chatting.