jQuery.fn.fitTextToBox = function() {
	//This is an assumption but works around the issues in IE
	//var currentFontSize = this.css('font-size');
	var currentFontSize = parseFloat($('body').css('font-size'));

	var maxFontSize = 30;
	//The text
	var text = this.text();
	//Number of characters
	var textCharLng = text.length;

	//Work out the container dimensions
	var boxHeight = this.height();
	var boxWidth = this.width();
	
	//Work out the px width/height of the chars
	var charHeightPx = currentFontSize + 1; 		// Extra '1' Guarentees a fit
	var charWidthPx = (currentFontSize / 2) + 1; 	// Extra '1' Guarentees a fit
	
	//Work out the area of the box
	var boxArea = boxWidth * boxHeight;

	//Work out the max area
	var maxCharArea = boxArea / textCharLng;
	var charArea = charHeightPx  * charWidthPx;

	//Work out the new font dimensions based on the font's dimensions
	var widthProportion = charHeightPx / charWidthPx;
	var widthFactor = (maxCharArea / charArea)
	var newFontSize = parseFloat(currentFontSize + widthFactor) * 1.3;
		
	if(newFontSize > maxFontSize)
		newFontSize = maxFontSize;
	
	this.css('font-size', newFontSize);
}
