Implementing Collapsable DIVs into Wordpress?

A theme I’m working on is going to have a few “boxes” that I would like to make “collapsible” or “closeable” by clicking on something like a little ‘x’ or whatever. In doing this, I would prefer to make their preference be tracked in the database through the use of both cookies and session variables.

If I try to implement something like this, would I need to create any other fields in any of the tables for these preferences to be inserted into?

If the visitor is not logged-in, then their preference would be tracked or recorded through a cookie (I’m assuming), but if they’re logged-in, this would be switched or merged into the use of session-cookies?

I think I can handle the JavaScript with something like this as that usually consists of finding some script where I make some tweaks for the specifics regarding the variables and whatnot, but when it comes to the cookies and or session stuff, I could use some wisdom. Has anyone done anything like this before with Wordpress?