[ticket/11946] Fix textarea auto-resize code

Fixes few issues with code that automatically resizes textarea elements. Also fixes few instances of incorrect coding style.

http://tracker.phpbb.com/browse/PHPBB3-11946