title: jQuery check if Cookie exists, if not create it
body: <p>I cannot get this code to work I must be missing something pretty simple.  I am trying to check to see if a Cookie exists, if it does {do nothing} if it doesn't {create it}.  I am testing the cookie by including an alert on a page.  Basically I do not want the cookie to keep re-creating with a referral url, I am trying to grab only the FIRST referred URL.</p>
  
  <pre><code>$(document).ready(function(){   
    if ($.cookie('bas_referral') == null ){
     var ref = document.referrer.toLowerCase();  
     // set cookie  
     var cookURL =  $.cookie('bas_referral', ref, { expires: 1 }); 
    } 
   });  
  </code></pre>
  
  <p>Displaying the current cookie contents:</p>
  
  <pre><code>    // get cookie  
      alert($.cookie('bas_referral'));  
  
      // delete cookie  
       $.cookie('bas_referral', null);
  </code></pre>