title: Popup cookie once per browser session
body: <p>I have a very simple popup, I would like to set a cookie, so when the visitor visits the page / category for the first time he will be able to see the popup and if he navigates out of the page and comes back, the popup won't appear until he ends the session (closes the browser). Thanks!</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var link;
  var element;
  t = setTimeout(openPopUp, 3000);
  
  function openPopUp() {
  element = document.getElementById("background");
  element.style.display = "block";
  element = document.getElementById("popup");
  element.style.display = "block";
  }
  
  function closePopUp() {
  element = document.getElementById("popup");
  element.style.display = "none";
  element = document.getElementById("background");
  element.style.display = "none";
  }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Edit:</strong> From comments:</p>
  
  <pre><code>var createCookie = Openpopup(name, value, days) {
      var expires;
      if (days) {
          var date = new Date();
          date.setTime(date.getTime() + (60 * 1000));
          expires = ";
          expires = " + date.toGMTString();
      } else {
          expires = "";
      }
      document.cookie = name + "=" + value + expires + ";
      path=/";
  } 
  </code></pre>