function resizePic(img, WWW, HHH)
{
	img.style.display='';
	img.style.height="auto";
	img.style.width="auto";
	img.style.visibility="hidden";
	
	var HH = eval(HHH);
	var WW = eval(WWW);
	
	var imgH = img.clientHeight;
	var imgW = img.clientWidth;

	var scaleH = HH / img.clientHeight;
	var scaleW = WW / img.clientWidth;

	if(img.height > HH || img.width > WW)
	{
		if (scaleH < scaleW) {
			img.style.height = HH+"px";
			img.style.width = Math.round(imgW * scaleH) + "px";
		} else {
			img.style.width = WW+"px";
			img.style.height = Math.round(imgH * scaleW) + "px";
		}
	}
	img.style.visibility="visible";
}
function resizePics()
{
	$(".week_offer_left img").each(function( intIndex ){
		resizePic( this , 352, 261 );
		//alert( "index: " + intIndex + " w "+ $(this).width());
	});
	$(".news_item_picbox img").each(function( intIndex ){
		resizePic( this , 160, 119 );
	});
	$(".summary_item_picbox img").each(function( intIndex ){
		resizePic( this , 178, 133 );
	});
	$(".detail_picbox_big img").each(function( intIndex ){
		resizePic( this , 344, 258 );
	});
	$(".detail_picbox_small img").each(function( intIndex ){
		resizePic( this , 80, 60 );
	});
}
/*
$(document).ready(function() {
    $('.story-small img').each(function() {
        var maxWidth = 100; // Max width for the image
        var maxHeight = 100;    // Max height for the image
        var ratio = 0;  // Used for aspect ratio
        var width = $(this).width();    // Current image width
        var height = $(this).height();  // Current image height
 
        // Check if the current width is larger than the max
        if(width > maxWidth){
            ratio = maxWidth / width;   // get ratio for scaling image
            $(this).css("width", maxWidth); // Set new width
            $(this).css("height", height * ratio);  // Scale height based on ratio
            height = height * ratio;    // Reset height to match scaled image
            width = width * ratio;    // Reset width to match scaled image
        }
 
        // Check if current height is larger than max
        if(height > maxHeight){
            ratio = maxHeight / height; // get ratio for scaling image
            $(this).css("height", maxHeight);   // Set new height
            $(this).css("width", width * ratio);    // Scale width based on ratio
            width = width * ratio;    // Reset width to match scaled image
        }
    });
});*/