/**
 * Heading
 * A jQuery plugin for replacing headings with images.
 *
 * Version 1.0
 * March 19th, 2009
 *
 * Inspired by:
 * Dynamic Heading Generation (http://www.stewartspeak.com/headings/)
 *
 **/
(function($){

  $.fn.Heading = function(options) {

    var defaults = {
      url: 'heading',
      type: 'H1'
    };

    var options = $.extend(defaults, options);

    return this.each(function() {

      $(this).css('visitbility','hidden');

      var heading = $(this);

      var text = heading.html();

      var words = text.split(' ');

      var img = "";

      for( var word = 0; word < words.length; word++ ) {
        text = escape( words[word] );
        img = img + "<img border='0' class='replacement' src='" + options.url + "/" + options.type + "/?msg="  + text + " &' alt='' title='' />";
      }

      heading.html( img );

      $(this).css('visibility','visible');

    });

  }

})(jQuery);
