Created a cookie but it is not seen unless the page is refreshed.

Created a cookie but it is not seen unless the page is refreshed.

I have a small project, 5 pages, 1 front page, 4 sub-pages. I'm using jquery mobile. On the frontpage, I have a cookie being created to control a pop-up that shows for the fist time user. The problem is if a user navigates to one of the sub pages and back to the front page, the cookie is not seen and the prompt is shown again.

Here is the code and the popup. http://jsfiddle.net/afP8D/. The cookie works if the user refreshes but the native way that jQuery navigates pages doesn't seem to re-run code.

I did try to attache checkCookie(); to the back button in my header and console shows it as firing but it doesn't seem to affect the popup.