

function CatProdFixes()
{
	SetProductNameDivSize('div#mwrc_category_listing');
	SetProductNameDivSize('div#mwrc_product_listing');
	
}


function SetProductNameDivSize(container)
{
	
	var max_img_width = 0;
	var max_img_height = 0;
	
	var li_img = $$(container + ' li.mwrc_listing a img');
	var li_div = $$(container + ' li.mwrc_listing div.mwrc_listing_product_name');
	var li_div_img = $$(container + ' li.mwrc_listing div.mwrc_listing_product_image');
	
	li_img.each(function(item)
	{
		if(max_img_width < item.width) max_img_width = item.width;
		if(max_img_height < item.height) max_img_height = item.height;
	});
	
	if(max_img_width < 100) max_img_width=100;
	
	li_div.each(function(item)
	{
		item.style.width = max_img_width+'px';
	});
	
	li_div_img.each(function(item)
	{
		item.style.width = max_img_width+'px';
		item.style.height = max_img_height+'px';
	});
	
	ResizeCategoryProduct(container);
}

function ResizeCategoryProduct(container)
{
	var max_height = 0;
	var max_width = 0;
	
	var lis = $$(container + ' li.mwrc_listing');
	
	lis.each(function(item)
	{
		cur_height = parseInt(item.getStyle('height'));
		cur_width = parseInt(item.getStyle('width'));
		
		if(max_height < cur_height) max_height = cur_height;
		if(max_width < cur_width) max_width = cur_width;
		
	});

	if(max_height > 0 || max_width > 0)
	{		
		lis.each(function(item)
		{
			if(max_height > 0) item.style.height = (max_height+10) + 'px';
			if(max_width > 0) item.style.width = max_width + 'px';	
		});
	}
}
