Help with cookies please.

Help with cookies please.

Following a few guides and mashing together some lines of code I have the following js for a div hide/show function. I'd like to use the jquery cookie script that comes bundled with jqueryui so the below script will save users preferences and call them on page load.

I've played around with the cookie call and set... but the only thing I can get to happen is the "plus/minus" image to change.

The problem I was having was the first time to the page all divs were visible, when you clicked the "minus" icon, the div would shrink and set cookie to close. When refreshing the page, the "minus" would now be "plus" sign, but the div would still be showing.

I've removed the cookie code I had done, in the event it was unfixable I'm hoping someone here can help me add this simple function to my site. Thanks.

script:
$(document).ready(function() {
   if($('div.trigger').length > 0){
      $('div.trigger').click(function() {
         if($(this).hasClass('open')) {
            $(this).removeClass('open');
            $(this).addClass('close');
            var d = $(this).attr("divRef");
            $("div.showhidediv[divRef=" + d + "]").slideDown("slow");
            return false;
         } else {
            $(this).removeClass('close');
            $(this).addClass('open');
            var d = $(this).attr("divRef");
            $("div.showhidediv[divRef=" + d + "]").slideUp("slow");
            return false;
         }
      })
   }
})

css:
.trigger, .trigger a {display: block; width: 20px; height: 22px; text-indent: 999999em; overflow: hidden;}
.trigger { background:url(../images/minmax2.png) no-repeat top right;}
.close { background:url(../images/minmax2.png) no-repeat right -24px;}

html:
<table class="blueborder289 blueborder232" border="0" cellspacing="0" cellpadding="0">
   <tr>
      <th class="left">Index Widget</th>
      <th class="right"><div divRef="one" class="trigger close"><a href="#">Click Me</a></div></th>
   </tr>
</table>
<div class="showhidediv" divRef="one">
Content to hide/show
</div>