(function($){
	$.fn.miniature = function(options) {
		var defaults = {
			tag: 'span',
			tagClass: 'first-letter'
		};
		
		var opts = $.extend(defaults, options);
		
		return this.each(function() {
			var html = $("<div />");
			$.each($(this).get(0).childNodes, function(i, o) {		
				if(o.nodeType == 3) { //text node
					var text = $.trim($(o).text());
					if(text.length > 0) {
						var first = "<"+ opts.tag +" class='"+ opts.tagClass +" "+ opts.tagClass +"-"+text.charAt(0).toLowerCase()+"'>"+text.charAt(0)+"</"+ opts.tag +">";
						html.append(first + text.substr(1));
					}
				}
				else
					html.append($(o).clone());
			});
			$(this).html(html.html());
		});
	};
})(jQuery);
