var tagsName = new Array( 'div', 'table', 'td', 'span', 'select', 'option', 'a', 'p', 'ul', 'h1', 'b', 'i', 'u', 'font' );
var sizeUp = new Array( 11, 14, 18 );
var minSize = 12;

function resizeFont( id, sizeNum )
{ 
	var sizeCookie = getCookieFont();
	if( sizeNum < 0 )
	{
		var size = sizeUp[sizeCookie];
		var sizeToCookie = sizeCookie;
	}
	else
	{
		//var size = ( sizeUp[sizeNum] - sizeUp[sizeCookie] );
		var size = sizeUp[sizeNum];
		var sizeToCookie = sizeNum;
	}
	if( size != 1 )
	{
		if( oChosen = document.getElementById( id ) )
		{
			//alert( '--'+oChosen.style.fontSize+'--' );
			/*fNum = new Number( new String( oChosen.style.fontSize ).replace( /px/g, "" ) );
			if( fNum < 1 )
			{
				fNum = minSize;
			}
			else
			{
				minSize = fNum;
			}*/
			fSize = size;
			oChosen.style.fontSize = '' + fSize + 'px';
			for( i = 0; i < tagsName.length; i++ )
			{
				oTags = oChosen.getElementsByTagName( tagsName[i] );
				for( j = 0; j < oTags.length; j++ )
				{ 
					/*fNum = new Number( new String( oTags[j].style.fontSize ).replace( /px/g, "" ) );
					if( fNum < 1 )
					{
						fNum = minSize;
					}
					fSize = ( fNum + size );*/
					if( oTags[j].id == "headerDiv" )
					{
						oTags[j].style.fontSize = '' + ( fSize + 1 ) + 'px';
					}
					else
					{
						oTags[j].style.fontSize = '' + fSize + 'px';
					}
				}
			}
		}
	}
	setCookieFont( sizeToCookie );
}

function setCookieFont( size )
{
    document.cookie = 'fontSize=' + size + '; path=/';
}

function getCookieFont()
{
    var pos = document.cookie.indexOf( "fontSize" );
	if( pos != -1 )
	{
        return ( document.cookie.substr( ( pos + 9 ), 1 ) * 1 );
    }
    return 0;
}

