/**
 * sizer.js
 *
 * Copyright (c) 2000-2008 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * Font sizer JavaScript functions. 
 *
 * $Id: sizer.js,v 1.1 2008/07/01 00:06:47 michael Exp $
 */

font_mult = 0.0;

function resizeText(multiplier) {
	   font_mult = parseFloat(font_mult) + parseFloat(multiplier) ;
       if (document.getElementById) { // DOM3 = IE5, NS6
          //document.getElementById('fontfactor').innerText = font_mult;
          if (document.getElementById('maincontent').style.fontSize == "") {
             document.getElementById('maincontent').style.fontSize = "1.0em";
          }
          document.getElementById('maincontent').style.fontSize = parseFloat(document.getElementById('maincontent').style.fontSize) + (multiplier * 0.2) + "em";	      document.getElementById('myFontFactor').innerHTML = "(factor=" + Math.round(font_mult*100)/100 + ")";
       } else {
			if (document.layers) { // Netscape 4
			 //document.fontfactor.innerText = font_mult;
             if (document.maincontent.style.fontSize == "") {
               document.maincontent.style.fontSize = "1.0em";
              }
              document.maincontent.style.fontSize = parseFloat(document.maincontent.style.fontSize) + (multiplier * 0.2) + "em";	
			}
			else { // IE 4
        	 //document.all.fontfactor.innerText = font_mult;
             if (document.all.maincontent.style.fontSize == "") {
               document.all.maincontent.style.fontSize = "1.0em";
              }
              document.all.maincontent.style.fontSize = parseFloat(document.all.maincontent.style.fontSize) + (multiplier * 0.2) + "em";	
			}
		}

}


window.onload = function(e) {
	var cookie = readCookie("font-size");
	var size = cookie ? cookie : 1.2;
	//alert("Load size=" + size);
	resizeText(size);
}

window.onunload = function(e) {
	//alert("Unload size=" + font_mult);
	createCookie("font-size", font_mult, 365);
}
