Fixed javascript to work with more than one cookie.