Small helper for creating and reading cookies in JavaScript