

<!--

<!--
<!--
(function($) {
 $.fn.customFont = function(eo) {
  var options = $.extend({}, $.fn.customFont.defaults, eo);
  return this.each(function(){
   if(!$(this).data("fontReplaced")) {
    var imgURI = new String(options.URIbase);
    var style = new Object();
    for(var prop in options.CSSprops) {
     if(options.CSSprops[prop] == "color") {
      try {
       style[prop] = $.fn.customFont.colorRegularisation($(this).css(prop));
      } catch(e) {
       style[prop] = $.fn.customFont.colorRegularisation(options.fallbackColor);
      };
     } else if(options.CSSprops[prop] == "number") {
      style[prop] = parseInt($(this).css(prop));
     } else if(options.CSSprops[prop] == "auto") {
      var fl = $(this).css("float");
      var dp = $(this).css("display");
      $(this).css("float","none");
      $(this).css("display","block");
      //style[prop] = parseInt($(this).css(prop));
      style[prop] = parseInt($(this).width());
      $(this).css("float",fl);
      $(this).css("display",dp);
     };
     imgURI += style[prop] + options.separator;
    };
    var maxImgHeight = $(this).css("lineHeight");
    imgURI += encodeURIComponent($(this).text()).replace(/~/g,'%7E').replace(/%20/g,'+').replace(/%2F/g,'%7E').replace(/%3F/g,'%5E') + "." + options.fileExtension;
    var imageReplacement = $("<img />").css({display:"block"}).attr("src", imgURI)
    $(this).
     addClass(options.CSSclass).
     wrapInner("<span></span>").
     append(imageReplacement).
     find("span").hide();
    imageReplacement.error(function(){
     $(this).css({display:"none"}).parent().find("span").show();
    });
    $(this).data("fontReplaced", true);
/*    
$(this).find("img").load(function() {
     $(this).parent().pngFix();
   });
*/
   };
  });
 };
 $.fn.customFont.colorRegularisation = function(src) {
  if(src == "transparent")
   return src;
  var rgb = src.match(/^rgb\((.*)\)$/);
  var shortHash = src.match(/^\#([0-9a-f]{3})$/i);
  var longHash = src.match(/^\#([0-9a-f]{6})$/i);
  var color = new String();
  var re, parsed;
  if(rgb) {
   re = /(\d)+/g;
   parsed = rgb[1].match(re);
   for(i=0;i<parsed.length;i++) {
    parsed[i] = parseInt(parsed[i]);
    if(parsed[i] > 255)
     throw new Error("color standard mismatch");
    color += parsed[i] < 16 ? "0" + parsed[i].toString(16) : parsed[i].toString(16);
   };
  } else if(shortHash) {
   re = /(.)/g;
   color = shortHash[1].replace(re, "$1$1");
  } else if(longHash) {
   color = longHash[1];
  } else {
   throw new Error("color standard mismatch");
  };
  return color;
 };
 $.fn.customFont.defaults = {
  URIbase:"/textReplacement/",
  fileExtension:"png",
  CSSprops: {
   width: "auto",
   fontSize: "number",
   color: "color",
   backgroundColor: "color"
  },
  separator: "/",
  //fallbackColor: "#ffffff",
  fallbackColor: "transparent",
  CSSclass: "customFont",
  instantHide: null
 };
})(jQuery);
//-->
//-->
//-->


