(function($) {
	var def = {  
		animation: 1,  
		aniopacity: 1,
		fadetovalue: 1,
		zoom: 120,
		fadespeed: "fast"
	};  
	var option = $.extend(def, option);
	var imgtitle;
	var htmlcontent;
	jQuery.fn.titleimg = function(option) {
		jQuery(this).each(function() {
			var imgtitle = jQuery('img', this).attr('title');
			var htmlcontent = jQuery(this).html();
			jQuery(this).mouseenter(function() {
				jQuery(this).prepend('<span class="caption"><span class="caption_text">'+imgtitle+'</span></span>');
				jQuery('.caption', this).fadeTo(option.fadespeed, option.fadetovalue);
				if(option.animation == 1 && option.zoom > 100) {
					jQuery('img', this).animate({width: option.zoom+"%", opacity: option.aniopacity});
				}
			});
			jQuery(this).mouseleave(function() {
				var thishtmlhide = this;
				if(option.animation == 1 && option.zoom > 100) {
					jQuery('img', this).animate({width:"100%", opacity: "1"});
				}
				jQuery('.caption', thishtmlhide).fadeOut(option.fadespeed);
				jQuery('.caption', this).remove();
			});
		});
    }
})(jQuery);
