title: Fancybox popup once time for session
body: <p>I have a popup with fancybox that appear at load page.</p>
  
  <p>I need to show the popup once a time, if the user change page and back on the page with popup doesn't reveal a second time.</p>
  
  <p>I've read that could be use a cookie plug in (<a href="https://github.com/carhartl/jquery-cookie" rel="nofollow">https://github.com/carhartl/jquery-cookie</a>) but i dont understant how integrate in this code...</p>
  
  <p>I have a simple site in html/css.</p>
  
  <p>This is the code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"&gt;     &lt;/script&gt;
  &lt;script type="text/javascript" src="jquery.fancybox-1.3.1.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="jquery.fancybox-1.3.1.css" media="screen" /&gt;
  &lt;script src="jquery.cookie.js"&gt;&lt;/script&gt;
  
  
  &lt;script type="text/javascript"&gt;
  function openFancybox() {
  setTimeout(function () {
      $('#yt').trigger('click');
  }, 500);
  };
  $(document).ready(function () {
  var visited = $.cookie('visited');
  if (visited == 'yes') {
      return false; // second page load, cookie active
  } else {
      openFancybox(); // first page load, launch fancybox
  }
  $.cookie('visited', 'yes', {
      expires: 7 // the number of days cookie  will be effective
  });
  $("#yt").click(function() {
              $.fancybox({
                      'padding'        : 0,
                      'autoScale'      : false,
                      'transitionIn'   : 'none',
                      'transitionOut'  : 'none',
                      'title'          : this.title,
                      'width'          : 680,
                      'height'         : 495,
                      'href'           : this.href.replace(new RegExp("watch\\?v=", "i"),  'v/'),
                      'type'           : 'swf',
                      'swf'            : {
                          'wmode'              : 'transparent',
                          'allowfullscreen'    : 'true'
                      }
                  });
      return false;
  });
  });
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body onload='$("#yt").trigger("click");'&gt;
  
    &lt;a id="yt" href="https://www.youtube.com/watch?v=ROTYmNckBCw&amp;amp;fs=1&amp;amp;autoplay=1"&gt;&lt;img  src="http://fancyapps.com/fancybox/demo/1_s.jpg" alt=""/&gt;&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>