//---thanks to alistapart //-----------------------------------------------------------------------------rerender function rerender (x) { w = 100 - 0.0001* (x); document.getElementById ('header').style.width = w + '%'; // alert("ReRender: " + document.getElementById ("bodyCSS").href); } //-----------------------------------------------------------------------------cookie functions function createCookie(name,value) { document.cookie = name+"="+value+"; 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; } //-----------------------------------------------------------------------------setActiveStyleSheet function setActiveStyleSheet (cssFileName) { href = cssFileName + '.css'; //alert (href); document.getElementById ("bodyCSS").href = href; createCookie("style", cssFileName); return null; } //-----------------------------------------------------------------------------getActiveStyleSheet function getActiveStyleSheet() { href = document.getElementById ("bodyCSS").href; x = href.lastIndexOf('/') + 1; y = href.lastIndexOf('.') cssFileName = href.substring(x, y); //alert ('cssFileName = ' + cssFileName); return cssFileName; } //-----------------------------------------------------------------------------getPreferredStyleSheet 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; } //-----------------------------------------------------------------------------changeFontSize //If in publish mode, output page names //If in preview or smart edit mode, output RDTemp file names function changeFontSize (fontSize) { switch (fontSize) { case 1 : setActiveStyleSheet('capricorn.fontsize.small'); break; case 2 : setActiveStyleSheet('capricorn.fontsize.default'); break; case 3 : setActiveStyleSheet('capricorn.fontsize.large'); break; } rerender (fontSize); } //-----------------------------------------------------------------------------displayFontSizeButtons // buttons are displayed only when javascript is enabled. function displayFontSizeButtons() { li=document.getElementById('fontChanger'); li.innerHTML = '' + 'small text
  • ' + '' + 'medium text
  • ' + '' + 'large text
  • '; } //-----------------------------------------------------------------------------onLoad function fontSize_OnLoad(e) { var cookie = readCookie("style"); var title = cookie ? cookie : getActiveStyleSheet (); if (cookie != null) { setActiveStyleSheet(title); } rerender (4); } function fontSize_OnUnLoad(e) { var title = getActiveStyleSheet(); createCookie("style", title); } // These load and unload events are called from the page footer