/**
 * @author nbeighley
 */
/*! http://code.google.com/p/jqdynamicfontsize */
/*
  Automatically adjust the font size within a fluid width/height div

  Options:
   * prefHeight - The max height of div container, must be in px. use the max-height percentage from your CSS, then use firebug to determine actual px at the max height.  ie: 200, defaults to 500
   * aDrop: additional font decrease from new size.  Defaults to 1, make zero for none.  ie: .5 or 0 or 2.  Normally, this would be the default of 1.

  http://code.google.com/p/jqdynamicfontsize

  2011-07-23 Initial version * Nathaniel Beighley <nbeighley@vortexnetworking.com>
  
*/
jQuery.fn.fluidFontSize = function(ffsOptions)
{
    var opts = $.extend(jQuery.fn.fluidFontSize.defaults, ffsOptions);
    return this.each(function()
    {
       	var curHeight = $(this).height();
		var adjHeight = (curHeight / opts.maxHeight);
		var curFS = $(this).css("font-size");
		var curFS = curFS.replace("px","");
		var newFontSize = Math.floor(curFS * adjHeight) - opts.aDrop;
		$(this).css("font-size", newFontSize);
    });
};

jQuery.fn.fluidFontSize.defaults = {
	maxHeight: 500,
	aDrop: 1
};
