function writeStyleSwitcher() { // Credit for the initial style switcher code goes to Mark Pilgrim: diveintomark.org // I later hacked it to do 2 select boxes, one for style, one for layout. Any errors are mine. - joe // document.write('
\n'); document.write('
\n'); document.write('\n'); document.write('\n'); document.write('\n'); document.write('
\n'); // document.write('
' + document.cookie + '
\n'); document.write('
\n'); } function getValueFromCookie(keyName) { var returnValue = '1'; keyName += '='; pos = document.cookie.indexOf(keyName); if (-1 != pos) { returnValue = document.cookie.substring(pos + keyName.length, pos + keyName.length + 1); } return returnValue; } function chooseStyle (style, layout) { var newstyle = getValueFromCookie('style'); var newlayout = getValueFromCookie('layout'); if (-1 != layout) { newlayout = layout; } if (-1 != style) { newstyle = style; } var styleKeyValuePair = 'style=' + newstyle; var layoutKeyValuePair = 'layout=' + newlayout; var expdate = new Date(); expdate.setTime(expdate.getTime() + (1000*3600*24*365)); document.cookie = styleKeyValuePair + '; expires=' + expdate.toGMTString() + '; path=/'; document.cookie = layoutKeyValuePair + '; expires=' + expdate.toGMTString() + '; path=/'; self.location = self.location; } function writeStyleSheetLinks() { if (document.cookie.indexOf('style=')==-1) { cssStyle = '"http://www.w3.org/StyleSheets/Core/parser.css?family=1&doc=XML"'; } else { cssStyle = '"http://www.w3.org/StyleSheets/Core/parser.css?family=' + getValueFromCookie('style') + '&doc=XML"'; } if (document.cookie.indexOf('layout=')==-1) { cssLayout = '"/1.css"'; } else { cssLayout = '"/' + getValueFromCookie('layout') + '.css"'; } document.write('\n'); document.write('\n'); } writeStyleSheetLinks();