Accordion with cookie persistence

Accordion with cookie persistence

Hi,
would this be useful as part of the accordion?
jQuery(function($) {
    var userpanel = $("#accordion");
    var index = $.cookie("accordion");
    var active;
    if (index !== undefined) {
        active = userpanel.find("h3:eq(" + index + ")");
    }
    userpanel.accordion({
        header: "h3",
        event: "hoverintent",
        active: active,
        change: function(event, ui) {
            var index = $(this).find("h3").index ( ui.newHeader[0] );
            $.cookie("accordion", index);
        }
    });
});
Eg. something like this:
$("...").accordion({
cookie: true // or other options passed through to $.cookie
});
Jörn