Add this function for your JS, then run it once the theme is transformed:
function set_theme(title)title+'' //so, run set_theme('whatevername') when it's set through the user
To see the cookie and hang the theme on-page load (using jQuery or similar $(document).ready() could be much better than onload, though, but here is a straight js/dom example)
Use a session to keep an eye on anyone's preferences around the serverside. Once the user returns on and it has a style selected (which you'll determine in the session variables) then your server will deliver HTML which has backgroundImage set rather than a good color. Once the user toggles preferences you are able to send an ajax request that updates the session variables.