Cookie with a dialog, not working?

Cookie with a dialog, not working?

Hi guys i'm totally new here, but am specifically looking for JQuery gurus as i learn more about it, Love it!

My aim is to get the dialog box to show then after clicking the 'x' or 'Ok' for the cooke ti be set for 2 days expiration using the cookie.jquery.js plugin so the dialog doesnt open next time until the cookie expires!

This is what i have been working with an tried but to no success!

   <script type="text/javascript">
   
   

   $(function() {
      $("#dialog")
      .dialog({
         bgiframe: true,
         modal: true,
         resizable: false,
         autoOpen: true,
         width:200,
         close: function() {
            $.cookie('doneDi', 'closed', { expires: 2 })
            },
         buttons: {
            Ok: function() {
               $(this).dialog('close')
               $.cookie('doneDi', 'closed', { expires: 2 });
            }
         }
            
         });
      
      var doneDi = $.cookie('doneDi');
   
    if (doneDi == 'closed') {
       $("#dialog").dialog( 'disable') ;
      
    };
   });
   
   </script>


PLEASE HELP!



~stefpretty~