Use something like this: "document.cookie.match(/^(.;)?\sMyCookie\s*=\s*[^;]+(.*)?$/)"
Only get data when we need to update it.
Preferrably, the isloggedindata would be stored in a local cookie or something, as we need to show it often but only update it occasionally.