Switching style sheets

I want to have 2 different styles to my site, a light and a dark. I would have a default that was loaded automatically and then a link so the user could swap if he/she wanted to. I know this can be done with php (like on allthesegames, see the colour squares on the right) but i also think it can be done with javascript. Any ideas how?

Also it would be useful for the users preference to be stored in a cookie. I searched google but the only relevant site was somewhat confusing. I followed what it said but after i four or five hours of playing at it i gave up and came here. All help is appreciated.