jQuery.fn.thumbs = function(tx,ty,border)
{
	return this.wrap('<div class="'+border+'" style="width:'+tx+'px;height:'+ty+'px;"><div class="thumb-inner"></div></div>');
}

jQuery.fn.thumbsEx = function(tx,ty)
{
	return this.each(
		function()
		{
			if ((parseInt(jQuery(this).width()) / parseInt(jQuery(this).height())) < (tx/ty)) {
				jQuery(this).width(tx);
			} else {
				jQuery(this).height(ty);
				//jQuery(this).css('margin-left', '-50%' );
			}
		}
	)
}

jQuery.fn.thumbsFit = function(tx,ty)
{
	return this.each(
		function()
		{
			var w = parseInt(jQuery(this).width());
			var h = parseInt(jQuery(this).height());
			if ( (w/h) > (tx/ty) ) {
				jQuery(this).width(tx);
				jQuery(this).height(h*tx/w);
				jQuery(this).css('padding-top', (ty/2 - (h*tx/w) / 2 ) + 'px' );
			} else {
				jQuery(this).height(ty);
				jQuery(this).width(w*ty/h);
				jQuery(this).css('padding-left', ( tx/2 - (w*ty/h) / 2 ) + 'px' );
			}
		}
	)
}

jQuery.fn.thumbsImg = function()
{
	return this.each(
		function()
		{
			jQuery(this).css('position','absolute');
			jQuery(this).css('left', '-' + ( parseInt( jQuery(this).width() ) / 2 ) + 'px' );
			jQuery(this).css('top', '-' + ( parseInt( jQuery(this).height() ) / 2 ) + 'px' );
			jQuery(this).css('margin-left', '50%' );
			jQuery(this).css('margin-top', '50%' );
		}
	)
}