function Makulle(oImg,iWidth,iHeight)
{

x_ratio = iWidth / oImg.width;
y_ratio = iHeight / oImg.height;

if ((oImg.width <= iWidth) && (oImg.height <= iHeight) ) {
  oImg.width = oImg.width;
  oImg.height = oImg.height;
}
else if ((x_ratio * oImg.height) < iHeight) {
  oImg.height = Math.ceil(x_ratio * oImg.height);
  oImg.width = iWidth;
}
else {
  oImg.width = Math.ceil(y_ratio * oImg.width);
  oImg.height = iWidth;
}
}