$(document).ready(function(){

	$("body").ajaxComplete(function(){ fontwriter(); });
	fontwriter();

});

function fontwriter(){
	$(".fontwriter").each(function(){
		
		var fw = this;
				
		if(!$(fw).hasClass("fontwritten")){
			$(fw).addClass("fontwritten");
			$(fw).html("<img src=\"/font/fontwriter.php?text="+ urlencode($(fw).html()) +"&color="+ urlencode($(fw).attr("color")) +"&size="+ $(fw).attr("size") +"&font="+ $(fw).attr("font") +"&shadow="+ $(fw).attr("shadow") +"\" border=\"0\" />").show();
		}
	});
}

function urlencode(str) {
	return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40');
}
