/* jQuery Image Title Converter Plugin
  Copyright (c) 2007 Brightfive Ltd
*/


jQuery.fn.titleReplace = function(settings){
  settings = jQuery.extend({
    font: "bliss.ttf",
    size: 20,
    foreground: "0,0,0",
    background: "255,255,255",
    transparent: true,
    wrap: true
  }, settings || {});  

  return this.each(function(){
    var title = this;
    if(settings['wrap'])
    {
      var text = $(this).html().split(" ");
    }
    else
    {
      var text = [$(this).html()];
    }
    $(this).html('');
    $(text).each(function(i){
      var text = escape(this).replace('%3F', '!');
      
      $(title).append('<img alt="' + this + '" src="' + baseDir + 'uploads/title/' + settings['font'] + '/' + settings['size'] + '/' + settings['foreground'] + '/' + settings['background'] + '/' + (settings['transparent'] ? '1' : '0') + '/' + text + '.png" />');
      
    });
    $(this).css('visibility', 'visible');
  });
};