/*
 * jQuery WG Center Image And Bottomize text plug-in 1.0
 * Copyright (c) 2008 Roberto Lee
 */
jQuery.fn.ImgCntrTxtBot = function(parameters) {// 'this' is a jQuery object at this point - with all the jQuery functions
	defaults = {
		path_transparant_image: '/gfx/spacer.gif',
		path_no_image_image: '/gfx/spacer.gif',
		size_deduction_spacer_image: 20
	};
  	return this.each(function() {// return so we don't break the chain now we are inside of a jQuery function, the DOM element is the context so 'this' has changed to become a DOM element.
		jQuery.extend(defaults, parameters);
    	html_elem = this;

		if((jQuery(html_elem)).is('*'))
		{
	      		var img = jQuery(this).find('img:first');
				var imgpos = img.height() > jQuery(this).height() ? 0 - (img.height() - jQuery(this).height())/2 : (jQuery(this).height() - img.height())/2;
				jQuery(this).css('background-repeat','no-repeat').css('background-image','url(' + img.attr('src') + ')').css('background-position','50% '+imgpos+'px');
				img.attr('src',defaults.path_transparant_image).attr('width',jQuery(this).width()).attr('height',jQuery(this).height()-defaults.size_deduction_spacer_image);
		}
  	});
};


/*
	USAGE SAMPLE
    $(document).ready(function() {
		$("div.subcat_img").ImgCntrTxtBot();

		$("div.subcat_img").ImgCntrTxtBot({
			path_transparant_image: '/gfx/spacer.gif',
			size_deduction_spacer_image: 20

		});
    });
*/



