function mywork_justice_narrowcolumn_images()
{
	var images = $(".narrowcolumn img, .entry img");

	if (images==null) return;
	
	var setup_width = 680;
	
	for (var i=0; i < images.length; i++) 
	{
		var p_width = images.eq(i).css("width");
		p_width = p_width.replace("px","");
		
		var p_height = images.eq(i).css("height");
		p_height = p_height.replace("px","");
		
		//　20090330. 即日起分為兩種, 
		// 寬比高長者, 650px 
		// 高比寬長者, 325px
		
		if (p_width>p_height)
		{
			if (!(p_width>setup_width)) continue;

			// 將寬度調成 650px
			var ratio = setup_width/p_width;
			images.eq(i).css("width", setup_width+"px");

			var new_height = p_height*ratio;
			images.eq(i).css("max-height", new_height+"px");
			images.eq(i).css("height", new_height+"px");
		} else {
			if (!(p_width>setup_width/2)) continue;
			
			var ratio = setup_width/2/p_width;
			images.eq(i).css("width", setup_width+"px");

			var new_height = p_height*ratio;
			images.eq(i).css("max-height", new_height+"px");
			images.eq(i).css("height", new_height+"px");
		}
	}
	
	/* for ie6.0 */
	var images = $(".narrowcolumn img, .entry img");
	for (var i=0; i < images.length; i++) 
	{
		var p_width = images.eq(i).width();
		var p_height = images.eq(i).height();
		
		if (p_width>p_height)
		{
			if (!(p_width>setup_width)) continue;
			// 將寬度調成 650px
			var ratio = setup_width/p_width;
			images.eq(i).width(setup_width);

			var new_height = p_height*ratio;
			images.eq(i).height(new_height);
		} else {
			if (!(p_width>setup_width/2)) continue;
			// 將寬度調成 650px
			var ratio = setup_width/2/p_width;
			images.eq(i).width((setup_width/2));

			var new_height = p_height*ratio;
			images.eq(i).height(new_height);
		}
	}
};

function mywork_assign_lightbox()
{
	$('a.my_lightbox').lightBox();
	// $('a').lightBox();
};

$(document).ready(function(){
   // Your code here
   // alert('test');
   mywork_justice_narrowcolumn_images();
   mywork_assign_lightbox();

});
