I have this code working --http://www.pastie.org/692856 -- You can copy and paste it into an empty html page and presto it will work.

It sets a cookie (using the jquery cookie plugin) -- and when a user returns to the page, it will set the index of the tabs to what ever tab was previously selected.

I now want to improve this code by converting it into a plugin.

Ideally, I'd like to be able to chain the function when I initialized the tabs, like this:

$("ul.tabs").tabs("div.panes > div").rememberTabSelected()

Or something similar.

Can anyone offer some tips on getting started with the conversion?

Thanks,

Rich