function $()
{
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}

function addEvent( obj, type, fn )
{
	if ( obj.attachEvent )
	{
		obj['e'+type+fn] = fn;
		obj[type+fn] =
			function()
			{
				obj['e'+type+fn]( window.event );
			}
		obj.attachEvent( 'on'+type, obj[type+fn] );
	}
	else
	{
		obj.addEventListener( type, fn, false );
	}
}
function fontsizerset( size )
{
	var fss = document.createElement('script');
	fss.type = 'text/javascript';
	fss.src = 'http://' + location.hostname + '/config/fontsizerset.php?fontsize=' + size;
	fss.onload = document.body.removeAttribute( 'fss' );
	document.body.appendChild ( fss );
	document.body.removeAttribute( fss );
}

var fontSizer = {
	min: 10,
	max: 22,
	el: Object,
	size: 12,
	init: function( size )
	{
		this.collect();
		while( this.size < size )
		{
			this.increase();
		}
		while( this.size > size )
		{
			this.decrease();
		}
		return this.size;
	},
	collect: function()
	{
		this.el = new Array;
		this.el = this.el.concat( this.collectionToArray( $( 'body'			).getElementsByTagName("p"		) ) );
		this.el = this.el.concat( this.collectionToArray( $( 'body'			).getElementsByTagName("li"		) ) );
		this.el = this.el.concat( this.collectionToArray( $( 'body'			).getElementsByTagName("td"		) ) );
		this.el = this.el.concat( this.collectionToArray( $( 'body'			).getElementsByTagName("strong"	) ) );
		try
		{
			this.el = this.el.concat( this.collectionToArray( $( 'tabcontent'	).getElementsByTagName("p"	) ) );
			this.el = this.el.concat( this.collectionToArray( $( 'tabcontent'	).getElementsByTagName("li"	) ) );
			this.el = this.el.concat( this.collectionToArray( $( 'tabcontent'	).getElementsByTagName("td"	) ) );
			this.el = this.el.concat( this.collectionToArray( $( 'tabcontent'	).getElementsByTagName("strong"	) ) );
		}
		catch(e)
		{}
	},
	collectionToArray:
		function( col )
		{
			a = new Array();
			for (i = 0; i < col.length; i++)
			{
				a[a.length] = col[i];
			}
			return a;
		},
	increase:
		function()
		{
			this.collect();
			if( this.size!=this.max)
			{
				this.size++;
				fontsizerset( this.size );
				$('fontsize').innerHTML = this.size;
			}
			for(i=0;i<this.el.length;i++) {
				this.el[i].style.fontSize = this.size+"px"
			}
		},
	decrease:
		function()
		{
			this.collect();
			if(this.size!=this.min)
			{
				this.size--;
				fontsizerset( this.size );
				$('fontsize').innerHTML = this.size;
			}
			for(i=0;i<this.el.length;i++)
			{
				this.el[i].style.fontSize = this.size+"px"
			}	
		},
	rebuild:
		function()
		{
			this.collect();
			for(i=0;i<this.el.length;i++) {
				this.el[i].style.fontSize = this.size+"px"
			}
		}
};
//addEvent(window,'load',function() { fontSizer.init( 22 ); });