I did not write this code but I have been using it for a while. I have gotten quite a few emails about it and thought I would post it here to share with the masses. It's been working perfectly on my site for some time. This method can be used to skin your comment and trackback popups as well as any other pages that you link to your site. I also use it to skin my blogroll page.
Paste this code in between the head of your pop up page:
<script type="text/javascript" language="javascript">
function GetCookie(name) {
var startIndex = document.cookie.indexOf(name);
if (startIndex != -1) {
var endIndex = document.cookie.indexOf(";", startIndex);
if (endIndex == -1) endIndex = document.cookie.length;
return unescape(document.cookie.substring(startIndex+name.length+1, endIndex));
} else {
return null;
}} var style = GetCookie('skin');
if (style==null) {style=1;}
document.writeln("<link rel=\"stylesheet\" href=\"http://www.domainname.com/skins/css/styles-sheet" + style + ".css\" type=\"text/css\" />");
</script>
You will need to put all your css files in the same folder, and number them according to the corresponding skin #. Based on the script, you'll need to name your css files "styles-sheet#.css" for it to work. You can of course name them whatever you want if you change it in the script.
Also, by changing the # in this line:
if (style==null) {style=1;}
Will set the default skin number you want new visitors without a cookie set to see. It should correspond with whatever your default skin # is set to so it all matches.
I use this in conjunction with the skinning tutorial provided by Amy.
I originally posted it here on my site which is where you can find the original credits as well as a link to the MT Forum Thread that started the hoopla.