title: Check if a cookie exists NOT using the jQuery cookie plugin
body: <p>I have a requirement, in jQuery, to show an alert if a cookie does not exist.</p>
  
  <p>I cannot use the jQuery cookie plugin.</p>
  
  <p>I've found a couple of scripts that I may be able to use, however, I cant seem to get them working in my jsfiddles. Can anyone assist me? Or are there other suggestions how to meet this requirement?</p>
  
  <p><a href="http://jsfiddle.net/JustJill54/a3tgP/2/" rel="nofollow">http://jsfiddle.net/JustJill54/a3tgP/2/</a> </p>
  
  <pre><code>function getCookie(name) {
      var dc = document.cookie;
      var prefix = name + "=";
      var begin = dc.indexOf("; " + prefix);
      if (begin == -1) {
          begin = dc.indexOf(prefix);
          if (begin != 0) return null;
      }
      else
      {
          begin += 2;
          var end = document.cookie.indexOf(";", begin);
          if (end == -1) {
          end = dc.length;
          }
      }
      return unescape(dc.substring(begin + prefix.length, end));
  }
  
  $(document).ready(function(){ 
      var myCookie = getCookie("MyCookie");
  
      if (myCookie == null) {
          // do cookie doesn't exist stuff;
          alert("Cookie not found.");
      }
      else {
          // do cookie exists stuff
          alert("MyCookie");
      }
  }
  </code></pre>
  
  <p><a href="http://jsfiddle.net/JustJill54/hYvX3/1/" rel="nofollow">http://jsfiddle.net/JustJill54/hYvX3/1/</a></p>
  
  <pre><code>$(document).ready(function(){ 
  var acookie = ReadCookie("cookiename");
  if(acookie.length == 0)
   { 
      alert("Cookie not found."); 
   }
  }    
  </code></pre>
  
  <p>Is there something I am doing wrong that the fiddles above are not creating alerts like I'm expecting?</p>