(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;

                if (theImage.attr('alt') != '') {
	                theImage
	                    .wrap("<div class='image'>")
	                    .parent()
	                    .append("<h5 id='fltitle'>&nbsp;</h5>")
	                    .find("h5")
	                    .html(theImage.attr('alt'))
						.wrapInner("<span></span>");
					
					theImage
						.parent()
						.append("<h6>&nbsp;</h6>").
						find('h6')
						.html(theImage.attr('title'))
						.wrapInner("<span></span>");
                }  
                if (removeTitle) {
                
                    theImage
                        .removeAttr("title");
                
                }

            })

        }
    
    })


})(jQuery);

