I've built a CMS using a templateing system

What i want to do is add a module that users can see a list of all the directorys in the template folder and for them to beable to select the theme feom that lidt now i have done something like this before:P but i did it based on CSS documents this time i want to beable to do it so that when the user selects the desired theme it auto uses that them based on a file in the dir called template.php and for it to be saved as a cookie for the next time they visit can anyone help i hope this makes some scence im crap as explaining my self lol!!!

Looking forward to hearing from you thanks bill