/* These functions enable you (as a developer) to create a way for the user to increase and decrease the overall fontsize of the website. The CSS must contain "em" on the BODY tag font-size declaration. This worked ok for me: ====================== font-family: arial, helvetica, sans-serif; font-size: .75em; line-height: 1.20em; font-weight: normal; white-space: normal; For returning visitors of your website: ======================================= You can use the function "checkVisitorFontSizePreference()" in body onload. */ var fontsize_default= 0.75; // em var fontsize_min = 0.75; // em var fontsize_max = 2.00; // em var fontsize_steps = 0.03; // em var cookie_name = 'current_fontsize'; function increaseFontSize() { var p = document.getElementsByTagName('body'); for(i=0;i < p.length;i++) { if(p[i].style.fontSize) { var s = parseFloat(p[i].style.fontSize.replace("em","")); } else { var s = fontsize_default; } if(s < fontsize_max) { s += fontsize_steps; } p[i].style.fontSize = s+"em"; var cfs = parseFloat(p[i].style.fontSize.replace("em","")); } createCookie('current_fontsize',cfs,365); return true; } function decreaseFontSize() { var p = document.getElementsByTagName('body'); for(i=0;i < p.length;i++) { if(p[i].style.fontSize) { var s = parseFloat(p[i].style.fontSize.replace("em","")); } else { var s = fontsize_default; } if(s > fontsize_min) { s -= fontsize_steps; } p[i].style.fontSize = s+"em"; var cfs = parseFloat(p[i].style.fontSize.replace("em","")); } createCookie('current_fontsize',cfs,365); return true; } function resetFontSize() { setFontSize(fontsize_default); createCookie('current_fontsize',fontsize_default,365); return true; } function setFontSize(desired_size) { var p = document.getElementsByTagName('body'); for(i=0;i