﻿///<reference path="/_js/jQuery/1.4.1/jquery-1.4.1-vsdoc.js"/>
(function ($) {

    $.fn.extend({
        maxText: function (options) {

            var defaults = {
                rightOffset: 0
            };

            var options = $.extend(defaults, options);

            var w = $(this).width();
            while (w > ($(this).parent().width() - options.rightOffset)) {
                var currentFontSize = $(this).css('font-size');
                var currentFontSizeNum = parseFloat(currentFontSize, 10);
                var newFontSize = currentFontSizeNum * 0.95;
                $(this).css('font-size', newFontSize);
                w = $(this).width();
            }
        }
    });

})(jQuery);
