I'm using the following code to to produce a content area that opens and closes on click, with a plus/minus image that also toggles depending on state of content area. What I would like to do is add a jquery cookie that saves the state of the content area - how would I achieve this please? S

$("a.toggle").click(function() {
var img = $(this).find("img"); //get a handle of the image tag inside title link
var src = $(img).attr("src"); //get the source of the image
//toggle the source of the image to show either plus/minus
if (src.endsWith("search_open.jpg"))
src = src.replace('search_open.jpg', 'search_close.jpg');
else
src = src.replace('search_close.jpg', 'search_open.jpg');
$(img).attr("src", src);
//get the title of the anchor tag which corresponds to the id of the content div
var content = $(this).attr("title");
$(content).toggle();
//this saves a string with true or false depending on the visibility
//of your element. i use the title of the element as name for the cookie so that you can save more than one
$.cookie(content, $(content).is(':visible') );
});
});