(function($) {

    $.titleBlock = {
    
        defaults: {
            
            removeTitle: true,
            thefontSize: "20px"
            
        }
            
    }
    
    $.fn.extend({
        titleBlock:function(config) {
        
            var config = $.extend({}, $.titleBlock.defaults, config);
         
            return this.each(function() {
            
                var theImage    = $(this),
                    removeTitle = config.removeTitle,
                    theFontSizeValue = config.thefontSize;
                
                theImage
                    .wrap("<div class='image'>")
                    .parent()
                    .append("<h2>&nbsp;</h2>")
                    .find("h2")
                    .html(theImage.attr('title'))
                    .find("span")
					.wrapInner("<div style='caption-title'></div>");
 //                   .find("div")
  //                  .wrapInner("<div class='caption'></div>");
                    
                if (removeTitle) {
                
                    theImage
                        .removeAttr("title");
                
                }

            
            })
        
        
        }
    
    })


})(jQuery);
