/*------------------------------------------------------------
	Document Text Sizer- Copyright 2003 - Taewook Kang.  All rights reserved.
	Coded by: Taewook Kang (txkang.REMOVETHIS@hotmail.com)
	Web Site: http://txkang.com
	Script featured on Dynamic Drive (http://www.dynamicdrive.com)

	Please retain this copyright notice in the script.
	License is granted to user to reuse this code on
	their own website if, and only if,
	this entire copyright notice is included.
--------------------------------------------------------------*/

//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','p');

//Specify spectrum of different font sizes:
var szs = new Array( '12px','13px','14px','15px','16px' );
var startSz = 0;

function ts( trgt,inc ) {
	if (!document.getElementById) return

	var d = document,cEl = null,sz = startSz,i,j,cTags;
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 4 ) sz = 4;
	// Number should be one less than number of size options
	startSz = sz;
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}

	// Set the 'Current Text Size' cookie
	// Sets the "index" (0,1,2,3,4), not the font size (11px, 12px,....)
	document.cookie="TS_size="+sz;
}

// Function to retrieve the value of the navigation cookie.
function getTS_Cookie(name)
{
	var dc = document.cookie;
	var index = dc.indexOf(name + "=");
	if (index == -1) return null;
	index = dc.indexOf("=", index) + 1;
	var endstr = dc.indexOf(";", index);
	if (endstr == -1) endstr = dc.length;
	return unescape(dc.substring(index, endstr));
}

// Set font size on all pages to selected size.
function tsMemory() {

	var trgt = "fontsizer";
	var sz = getTS_Cookie("TS_size") * 1;

	ts(trgt,sz);
}

