Accordion | Get Current Index

Accordion | Get Current Index


Seems like I've missed the obvious but I can't seem to find a way to
get the currently selected index for the Accordion Widget. Taken from
the documentation, how can I alert the selected index in following
function:
$('.ui-accordion').bind('accordionchange', function(event, ui) {
ui.newHeader // jQuery object, activated header
ui.oldHeader // jQuery object, previous header
ui.newContent // jQuery object, activated content
ui.oldContent // jQuery object, previous content
});
Basically, I'm trying to preserve the state (persistence) of the
panes. I would like to find the index of currently selected pane and
write it to a cookie for later retrieval... If anyone has other
pointers on implementing this then that's greatly appreciated as well.
Thanks