function resizeThumb(obj, maxWidth, maxHeight, addMargin)
{
	//var maxHeight = 80; 
	//var maxWidth = 80;
	
	var heightRatio = jQuery(obj).height()/jQuery(obj).width();
	var widthRatio = jQuery(obj).width()/jQuery(obj).height();
	
	if(jQuery(obj).height() > maxHeight)
	{
		//jQuery(obj).css("height",maxHeight);
		jQuery(obj).height(maxHeight);
		jQuery(obj).width(maxHeight  * widthRatio);
	}
	
	if(jQuery(obj).width() > maxWidth)
	{
		jQuery(obj).width(maxWidth);
		jQuery(obj).height(maxWidth  * heightRatio);
	}
	
	if(addMargin)
	{
		var margin = ((maxHeight - jQuery(obj).height())/2 + 5);
		
		jQuery(obj).css("marginTop", margin);
		jQuery(obj).css("marginBottom", margin);
	}
}