JavaScript BBCode parser