Object oriented Cookie class in JavaScript