(function($) {
$.fn.customFont = function(params) {
	//var base = "http://castrike.com/mysite5";
	var base = "http://www.castrike.com/";
	var params =  $.extend({
		width : 0,
		height : 0,
		bg_color:"FFF", 
		transparency:1,
		font:"bluehigh.ttf", 
		size: 80, 
		font_color:"000"
	}, params);
	return this.each(function(){			  
    	text = $(this).text();
		// image to query
		query = base+"/fonts/customfont.php?font="+ encodeURIComponent(jQuery.trim(params.font)) +
				"&size="+params.size+
				"&fontColor="+jQuery.trim(params.font_color).replace("#", "")+
				"&bgColor="+jQuery.trim(params.bg_color).replace("#", "")+
				"&t="+params.transparency+
				"&text="+encodeURIComponent(text);
		
		newHTML = $(this).html().replace(text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;"),"<img src='"+query+"' alt='"+text+"'/>");
		$(this).html(newHTML);
  	});

}
})(jQuery);

