(function($){
	$.fn.jImageInfo = function(options) {
	   
		var defaults = {
			bgColor: '#000',
			opacity: .8,
			title: 'title',
			description: 'alt'
		};
		
		var options = $.extend(defaults, options);
	   
		return this.each(function() {
			obj = $(this);
			//create div, title, and description
			obj.wrap('<span class="image-info-wrap"></span>');
			
			var imageInfoTitle = obj.attr(options.title);
			if( imageInfoTitle.length > 0 ) {
				obj.before('<span class="image-info-title">' + imageInfoTitle + '</span>');
			}
			var imageInfoDesc = obj.attr(options.description);
			if( imageInfoDesc.length > 0 ) {
				obj.after('<span class="image-info-desc">' + imageInfoDesc + '</span>');
			}
			
			obj.parent().hover( function() {
				$(this).children('span').slideDown();
			}, function () {
				$(this).children('span').slideUp();
			});
		});//each
	};
	$.fn.jImageBulge = function(options) {
	   
		var defaults = {
			top: 5,
			opacity: .8,
			title: 'title',
			description: 'alt'
		};
		
		var options = $.extend(defaults, options);
	   
		return this.each(function() {
			obj = $(this);
//			//create div, title, and description
//			obj.wrap('<span class="image-info-wrap"></span>');
//			
//			var imageInfoTitle = obj.attr(options.title);
//			if( imageInfoTitle.length > 0 ) {
//				obj.before('<span class="image-info-title">' + imageInfoTitle + '</span>');
//			}
//			var imageInfoDesc = obj.attr(options.description);
//			if( imageInfoDesc.length > 0 ) {
//				obj.after('<span class="image-info-desc">' + imageInfoDesc + '</span>');
//			}
			function animateImg(obj) {
				$(obj).animate({ height: imgHeight/2 })
			}
			var divHeight = obj.height;
			obj.hover( function() {
				var imgN = $(this).find('img');
				var imgHeight = imgN.height();
				imgN.animate({ top: 0 });
				var div = $(this).children('div');
				if ( div.height() < 260 ) {
					div.animate({ height: 260, marginTop: 25 });
				}
			}, function () {
				var div = $(this).children('div');
				if ( div.height() == 260 ) {
					div.animate({ height: 240, marginTop: 35 }).children('img').animate({ top: -5 });
				}
			});
			obj.click( function() {
				var imgHeight = $(this).find('img').height();
				if ( $(this).children('div').height() < imgHeight ) {
					$(this).children('div').animate({ height: imgHeight });
				} else {
					$(this).children('div').animate({ height: 240 });
				}
			});
		});//each
	};
})(jQuery);
