﻿function resizePicture(img) {
	var coef;
	var wt = img.parentNode.style.width;
	var targetWidth = wt.substring(0, wt.length - 2);
	var imgWidth = img.width;
	if(imgWidth > targetWidth) {
		coef = imgWidth / targetWidth;
		img.width = targetWidth;
		img.height = img.height / coef;
	}
}
