Messages: update autocomplete script to better handle long cookie values.

See #4606 for previous similiar fixes.

Fixes #5959, props psycleuk

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9248 cdf35c40-ae34-48e0-9cc9-0c9da1808c22