changed order of JS getCookieFunction