var img = document.getElementById("img");
var interval;
function powieksz()
{
  var width = img.width;
  var height = img.height;
  if(width >= 400 || height >= 300)
  {
    return;
  }
  else
  {
    img.width = width + 1;
    img.height = height + 1;
  }
  interval = setTimeout("powieksz()", 25);//im mniejsza liczba tym szybciej obraz będzie się powiększał
}
function stop()
{
  clearTimeout(interval);
}
img.onmouseover = powieksz;
img.onmouseout = stop;