/**
 * Copyright © Zeta Bridge. since 2008
 */
function normalizeBox(obj, size){
	var img = new Image();
    img.src = obj.src;

	if(img.height == 0 &&  img.width == 0){
		//alert(img.height + ", " +  img.width);
	}
	
	// ratio
	var ratio = 1.0;
	if(img.width > img.height) {
		ratio = size / img.width;
	}else{
		ratio = size / img.height;
	}

	// normalize
	var height			= Math.floor(img.height * ratio);
	obj.style.height	= height + "px";
	
	obj.style.width		= Math.floor(img.width * ratio) + "px";

	// margin
	var marginTopBottom = Math.floor((size - height) / 2); // img.height/obj.offsetHeight is NG
	
	obj.style.margin	= marginTopBottom + 'px auto';
}

var imgFixedWidth = function ( imgObj, fixW ){
	var imgW = $j(imgObj).get(0).width;
	var imgH = $j(imgObj).get(0).height;
	
	var fixH = Math.ceil( fixW*imgH/imgW );
	
	$j(imgObj).css({
		  'width'      : fixW+'px'
		, 'height'     : fixH+'px'
	});
};

