;(function($)
{
	$.fn.textfill = function(options)
	{
		var fontSize = options.InitFontPixels;

		var maxHeight = $(this).height();
		var maxWidth = $(this).width();

		var defSize = parseInt((parseInt($(this).width()) / parseInt($(this).height())) * fontSize) - 5;
		
		var el = $("span", this);

		el.each(function()
		{
			$(this).css('font-size', defSize + "px");
			$(this).css('line-height', (defSize + 10) + "px");
		});

		/*var ourText = $('span:visible:first', this);
		var maxHeight = $(this).height();
		var maxWidth = $(this).width();
		var textHeight;
		var textWidth;

		do
		{
			ourText.css('font-size', fontSize);
			textHeight = ourText.height();
			textWidth = ourText.width();
			fontSize = fontSize - 1;
		}
		while (textHeight > maxHeight || textWidth > maxWidth && fontSize > 3);*/

		return this;
	}
})(jQuery);
