(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({ 'bottom': '0px', 'width': w });
            $this.css({ 'width': w, 'height': h, 'border': o.border });
            $this.hover(
				function() {
				    if (!o.showcaption)
				        $(this).find('.ic_caption').slideDown(500);
				    else
				        $('.ic_text', $(this)).slideDown(500);
				},
				function() {
				    if (!o.showcaption)
				        $(this).find('.ic_caption').slideUp(200);
				    else
				        $('.ic_text', $(this)).slideUp(200);
				}
			);
        });
    };
    $.fn.capslide.defaults = {
        caption_color: 'white',
        caption_bgcolor: 'black',
        overlay_bgcolor: 'blue',
        border: '1px solid #fff',
        showcaption: false
    };
})(jQuery);
