/********************************************************************************** * Author: David Millar (www.rTraction.com) * * Date: December. 18, 2006 * * Purpose: Provide functionality to switch text size on the fly * * Requires: cookies.js * * * ********************************************************************************** * Revision 1.1: print functionality * ********************************************************************************** * Revision 1.0: create a script that checks for a cookie and adjusts font size * * if the cookie is detected * **********************************************************************************/ if(self.opener && window.name == "printPreview") { // We were opened by a previous page (print preview) var win_style = window.document.createElement('link'); win_style.href = "/styles/print.css"; win_style.rel = "stylesheet"; win_style.type = "text/css"; win_style.media = "screen"; window.document.getElementsByTagName('head')[0].appendChild(win_style); window.focus(); } function winBuild() { // open a new window newWin = window.open(window.document.location.toString(),'printPreview',''); } // Check for a cookie, if found, increase text size var textSizeCookie = getCookie("text-size"); if( textSizeCookie ) { // append style sheet to increase text size var fontsize_style = window.document.createElement('link'); fontsize_style.href = "/styles/largeFont.css"; fontsize_style.rel = "stylesheet"; fontsize_style.type = "text/css"; fontsize_style.media = "all"; window.document.getElementsByTagName('head')[0].appendChild(fontsize_style); } function switchFontSize() { var textSizeCookie = getCookie("text-size"); if( textSizeCookie ) { // delete cookie deleteCookie("text-size", "/"); } else { // create cookie var myDate = new Date(); myDate.setFullYear( myDate.getFullYear + 1 ); setCookie("text-size", "text size increase", myDate.getUTCDate(), "/" ); } // Reload page if( window.document.location.toString().indexOf("#") == -1 ) { document.location = window.document.location.toString(); } else { document.location = window.document.location.toString().substring(0,window.document.location.toString().length-1); } }