title: adding overlay based on cookie
body: <p>I'm adding the following code to add an overlay</p>
  
  <pre><code>$(function () {
  
      {
          $('#overlay').fadeIn('fast', function () {
              $('#overlaybox').animate({ 'top': '90px' }, 500);
              //$('#box').css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
              $('#overlaybox').css("left", (($(window).width() - $('#overlaybox').outerWidth()) / 2) + $(window).scrollLeft() + "px");
  
              $('#nabshow').fadeOut('fast');
  
            })
      }
  
  
  
  });
  </code></pre>
  
  <p>I found the following code to open a popup based on availability of cookie:</p>
  
  <pre><code>function setCookie(c_name,value,exdays)
  {
  var exdate=new Date();
  exdate.setDate(exdate.getDate() + exdays);
  var c_value=escape(value) + ((exdays===null) ? "" : "; expires="+exdate.toUTCString());
  document.cookie=c_name + "=" + c_value;
  }
  
  function getCookie(c_name)
  {
  var i,x,y,ARRcookies=document.cookie.split(";");
  for (i=0;i&lt;ARRcookies.length;i++)
  {
    x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
    y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
    x=x.replace(/^\s+|\s+$/g,"");
    if (x===c_name)
      {
      return unescape(y);
      }
    }
  }
  
  function showPopupOnce() {
     var hasSeenPopup = myGetCookie("has_seen_popup");
    if (hasSeenPopup === null || hasSeenPopup === ""){
       // the user has never seen the popup, so show him!
      window.open("http://mywebsite.com/popup.html", "myPopupWindow");
     }
  
     // either way, set the cookie so the user will never see the window again
     mySetCookie("has_seen_popup", "true", 365); // 365 days = 1 year
  }
  
  &lt;body onLoad="showPopupOnce();"&gt;
  </code></pre>
  
  <p>What is the changes I need to do in my overlay code to ensure it gets shown only once.
  I will add the get cookie and setcookie functions, then what do I do:</p>
  
  <p>Thanks
  Arnab</p>