Javascript class to deal with session cookies