// JavaScript Document
jQuery.resizefont = function(container){
	alert(container);
}
jQuery.fn.resizefont = function(options){
	var defaults = {
		maxsize: 100,
		minsize: 5,
		orientation: 'both'
	};
	var o = jQuery.extend(defaults, options);
	
	return this.each(function() {
		var e = $(this).html();
		var fs = o.maxsize;
		
		$(this).html("<span/>");	
		$(this).children('span').html(e);
		$(this).children('span').css('fontSize',fs);
		
		switch(o.orientation){
			case 'height':
				do {
					$(this).children('span').css('fontSize',fs);
					fs--;
				} while ($(this).children('span').height() > $(this).height() && fs >= o.minsize);
			break;
			case 'width':
				do {
					$(this).children('span').css('fontSize',fs);
					fs--;
				} while ($(this).children('span').width() > $(this).width()  && fs >= o.minsize);
			brea;;
			case 'both':
				do {
					$(this).children('span').css('fontSize',fs);
					fs--;
				} while (($(this).children('span').width() > $(this).width() ||  $(this).children('span').height() > $(this).height())  && fs >= o.minsize);
			break;
		}
	});
}
jQuery.fn.bgcolor = function(color) {
	return this.each(function() {
		$(this).css("background-color", color);
	});
};
