One cookie - multiple pages

I use the following cookie:

var $j = jQuery.noConflict();

$j(document).ready(function(){

   if (document.cookie.indexOf('visited=true') == -1) 
   {
      var thirtyDays = 1000*60*60*24*30;
      var expires = new Date((new Date()).valueOf() + thirtyDays);
      document.cookie = "visited=true;expires=" + expires.toUTCString();
      $j.colorbox({ inline:true, href:"#gallery-nav-instruct"});
   }

});

Everything works fine with one exception. The above cookie is intended to display instructions on the user's first visit to the gallery, but the gallery has several pages. What happens is that the user sees the instructions for each page in the gallery when they first visit that particular page. These instructions should only be downloaded once when they visit the gallery no matter which page they start on. How can I change this so that it appears only once on my gallery pages?

Notes:

The gallery is wrapped inside the Dreamweaver template and the cookie is inside this template. I cannot move the cookie outside the template for several reasons.

CMS, , javascript.

+5
2

;path=/, cookie cookie . . JavaScript Cookies.

+20
document.cookie = valuename + "=" + value + "; " + expires + ";domain=;path=/";

"domain=;path=/"; , cookie . , .

-1

All Articles