// Style Sheet Switcher from A List Apart // ISSN: 1534-0295. 2 November 2001 Ð Issue No. 126 http://www.alistapart.com/articles/alternate/// Article written by Paul Swoden http://www.idontsmoke.co.uk/function setActiveStyleSheet(title) {  createCookie("theme", title, 365);  var i, a, main;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {      a.disabled = true;      if(a.getAttribute("title") == title) a.disabled = false;    }  }}function getActiveStyleSheet() {  var i, a;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");  }  return null;}function getPreferredStyleSheet() {  var i, a;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {    if(a.getAttribute("rel").indexOf("style") != -1       && a.getAttribute("rel").indexOf("alt") == -1       && a.getAttribute("title")       ) return a.getAttribute("title");  }  return null;}function createCookie(name,value,days) {  if (days) {    var date = new Date();    date.setTime(date.getTime()+(days*24*60*60*1000));    var expires = "; expires="+date.toGMTString();  }  else expires = "";  document.cookie = name+"="+value+expires+"; path=/";}function readCookie(name) {  var nameEQ = name + "=";  var ca = document.cookie.split(';');  for(var i=0;i < ca.length;i++) {    var c = ca[i];    while (c.charAt(0)==' ') c = c.substring(1,c.length);    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);  }  return null;}var onloadDoOther=false; //function for other scripts using the onload event handlerwindow.onload = function(e) {//check if the onload event is required  if(onloadDoOther){     doOther();  }  var cookie = readCookie("theme");  var title = cookie ? cookie : getPreferredStyleSheet();  setActiveStyleSheet(title);}window.onunload = function(e) {  var title = getActiveStyleSheet();  createCookie("theme", title, 365);}var cookie = readCookie("theme");var title = cookie ? cookie : getPreferredStyleSheet();setActiveStyleSheet(title);//font size switcher inspired by mikeindustries.comfunction renderFontsize () {	document.write('<form>');	document.write('<div id="font-menu"><select id="fontsize" name="fontsize" onChange="changeFontSize(this.options[selectedIndex].value);">');	for ( var x=10; x <= 24; x++) {		if (Number(x) == Number(fontsize)) {			document.write('<option value="'+x+'" selected="selected">font: '+x+'px<\/option>');		} else {			document.write('<option value="'+x+'">font: '+x+'px<\/option>');		}	}	document.write('<\/select><\/div><\/form>');}var fontsize = readCookie('fontsize');if (!fontsize) {	var fontsize = 12;}function changeFontSize (fontsize) {  createCookie('fontsize', fontsize, 365);  self.location.href = self.location.href;}document.write('<style type="text/css">');document.write('#content, #footer {font-size:'+fontsize+'px; line-height: 1.5em}');document.write('<\/style>');function renderSbsIntro () {	var introSWF;	introSWF  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="740" height="210">';	introSWF += '<param name="movie" value="/swfs/sbsIntro.swf" />';	introSWF += '<embed src="/swfs/sbsIntro.swf" width="740" height="310" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" />';	introSWF += '<'+'/object>';	document.getElementById('intro').innerHTML = introSWF;}