/*------------------------------------------------------------
	Font Sizer - Copyright 2007 - Indiana Loans Limited.
	Owner Site: http://www.indiana-loans.co.uk/
	All rights reserved.
	Coded by: Stewart Farquhar, Dicontas Limited
	Developer Site: http://www.dicontas.co.uk/
	
	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.
--------------------------------------------------------------*/

//css tags for font resizer tool to modify. You can add or remove tags from this list
var aCSStags = new Array( 'div','td','tr','p');

//list of different font sizes:
var iStartingFontSize = 2;
var afontSizes = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );

function fnChangeFontSize( cTargetTag,iFontSizeChange ) {
	if (!document.getElementById) return
	//test if inputted number is numeric
	if(!(typeof(iFontSizeChange)=='number') && !(iFontSizeChange.toString().indexOf('.')==-1)) return
	var refDoc = document, myElement = null, iFontSize = iStartingFontSize,iLoop,jLoop,cTags,i;
	if ( iFontSizeChange == 0 ) {
		iFontSize = 2;
	} else {	
		iFontSize += iFontSizeChange;
	}
	if ( iFontSize < 0 ) iFontSize = 0;
	if ( iFontSize > 6 ) iFontSize = 6;
	iStartingFontSize = iFontSize;
		
	if ( !( myElement = refDoc.getElementById( cTargetTag ) ) ) myElement = refDoc.getElementsByTagName( cTargetTag )[ 0 ];

	myElement.style.fontSize = afontSizes[ iFontSize ];

	for ( iLoop = 0 ; iLoop < aCSStags.length ; iLoop++ ) {
		cTags = myElement.getElementsByTagName( aCSStags[ iLoop ] );
		for ( jLoop = 0 ; jLoop < cTags.length ; jLoop++ ) cTags[ jLoop ].style.fontSize = afontSizes[ iFontSize ];
	}
}