
/* Add an event for when the page loads completely, to set the size of the text
	 based on the user's choice (if the user has chosen a text size). */
window.addEvent('domready', function()
	{
		// Only set the size of the text if the relevant cookie value has been set.
		var font_size = Cookie.read('text-size');
		if (font_size != null)
		{
			document.body.style.fontSize = font_size;

			// Update any Flexcroll DIVs.
			scrollDiv = document.getElementById('flex__1');
			if (scrollDiv !== null)
			{
				if (scrollDiv.scrollUpdate)
				{
					scrollDiv.scrollUpdate();
				}
			}
		
		}
	});


/* This programatically sets the size of the body text in ems, and is called from
   the footer links.
	 0 = normal/regular/average/standard size
	 less than 0 = smaller text
	 greater than 0 = larger text.
	 */
function resizeText(size_increment) {
	
	// Check for a valid text size increment, otherwise assume a value of zero.
	if (isNaN(size_increment))
	{
		size_increment = 0;
	}
	
	// Set the size of the body text to an em value.
	var font_size = (1 + size_increment * 0.2) + "em";
  document.body.style.fontSize = font_size;
	
	// Set a cookie to remember the size of text to use.
	Cookie.write('text-size', font_size);
	
	// Update any Flexcroll DIVs.
	scrollDiv = document.getElementById('flex__1');
	if (scrollDiv !== null)
	{
		if (scrollDiv.scrollUpdate)
		{
			scrollDiv.scrollUpdate();
		}
	}
}
