/*------------------------------------------------------------
	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','tr','span');

//Specify spectrum of different font sizes:
var szs = new Array( 'x-small','87%','90%','100%','105%','110%','115%' );

var ua = navigator.userAgent;

var startSz = 1;

//Retrieve current size from cookie

var cookie_full = document.cookie; 

if (cookie_full.indexOf('textsize') != -1) 
{
	textsize = getCookie('textsize');

	if (ua.indexOf('MSIE') != -1)
	{
		document.write("<img src='/zz_site_graphics/clear_pixel.gif' width='0' height='0'><br />");
	}
	else
	{
		document.write("<img src='/zz_site_graphics/clear_pixel.gif' width='0' height='0'>");
	}
	
	ts_cookie('body', textsize);
}


// Resizing function called by user click

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 > 6 ) sz = 6;
	startSz = sz;
	
	// If increment = 0, delete the cookie.  Page will be reloaded at standard size
	if (inc == 0 )
	{
		var the_cookie = "textsize=" +  sz ; 
		var the_date = new Date("January 01, 1970"); 
		var the_cookie_date = the_date.toGMTString(); 
		the_cookie = the_cookie + ";expires=" + the_cookie_date + ";path=/"; 
		document.cookie = the_cookie; 
	}
	else //set the cookie 
	{
		var the_cookie = "textsize=" +  sz ; 
		var the_date = new Date("December 31, 2050"); 
		var the_cookie_date = the_date.toGMTString(); 
		the_cookie = the_cookie + ";expires=" + the_cookie_date + ";path=/"; 
		document.cookie = the_cookie; 
	}
	
    window.location.reload();
}

// Resizing function called by cookies

function ts_cookie( trgt,inc ) {
	if (!document.getElementById) return
	var d = document,cEl = null,i,j,cTags;

	sz = inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;

	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 ];
	}

}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}
