code: function getCookie(pr_name) {
          var name = pr_name + "=";
          var ca = document.cookie.split(';');
  
          for(var i = 0; i < ca.length; i++) {
              var c = ca[i];
              c = c.trim();
              if (c.indexOf(pr_name+"=") === 0) {
                  return c.substring(name.length, c.length);
              }
          }
          return "";
      }
docs: get the cookie and check value