(function($) {
	$.fn.capslide = function(options) {
		var opts = $.extend({}, $.fn.capslide.defaults, options);
		return this.each(function() {
			$this = $(this);
			var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
			
			if(!o.showcaption)	$this.find('.ic_caption').css('display','none');
			else $this.find('.ic_text').css('display','none');
				
			var _img = $this.find('img:first');
			var w = _img.css('width');
			var h = _img.css('height');
			$('.ic_caption',$this).css({'color':o.caption_color,'background-color':o.caption_bgcolor,'bottom':'0px','width':w});
			$('.overlay',$this).css('background-color',o.overlay_bgcolor);
			$this.css({'width':w , 'height':h, 'border':o.border});
			$this.hover(
				function () {
					if((navigator.appVersion).indexOf('MSIE') > 0) // changed from ('MSIE 7.0')
					$('.overlay',$(this)).show("slow");
					else
					$('.overlay',$(this)).fadeIn(500);
					if(!o.showcaption)
						$(this).find('.ic_caption').stop(true, true).slideDown(1000);
					else
						$('.ic_text',$(this)).stop(true, true).slideDown(1000);	
				},
				function () {
					if((navigator.appVersion).indexOf('MSIE') > 0) // changed from ('MSIE 7.0')
					$('.overlay',$(this)).stop(true, true).hide("slow");
					else
					$('.overlay',$(this)).stop(true, true).fadeOut(500);
					if(!o.showcaption)
						$(this).find('.ic_caption').slideUp(1000);
					else
						$('.ic_text',$(this)).slideUp(1000);
				}
			);
		});
	};
	$.fn.capslide.defaults = {
		caption_color	: 'white',
		caption_bgcolor	: 'black',
		overlay_bgcolor : 'blue',
		border			: '1px solid #fff',
		showcaption	    : true
	};
})(jQuery);
