function setZoom(img, img_direction, width, height, margin, zIndex, delay) 
{
  setTimeout(function() 
  {
    	if (img.style.Cursor==img_direction) 
	{
    	      img.style.width=width;
	      img.style.height=height;
	      img.style.margin=margin;
	      img.style.zIndex=zIndex;
	      img.parentNode.parentNode.style.zIndex=zIndex;
         }
  }, delay);
}
 
function larger(img, width, height) 
{	img.style.Cursor=1;
	now=parseInt(img.style.zIndex);
  	for (i=now+1; i<=10; i++) 
	{    	w=(width*(10+i))/20+'px';
		h=(height*(10+i))/20+'px';
		m=(-i)+'px 0 0 '+(-width*i/40)+'px';
		img_direction=1;
    		setZoom(img, img_direction, w, h, m, i, 25*(i-now));
	}
}
 
function smaller(img, width, height) 
{
   img.style.Cursor=2;
   now=parseInt(img.style.zIndex);
   for (i=now-1; i>=0; i--) 
   {	w=(width*(10+i))/20+'px';
	h=(height*(10+i))/20+'px';
	m=(-i)+'px 0 0 '+(-width*i/40)+'px';
	img_direction=2;
    	setZoom(img, img_direction, w, h, m, i, 20*(now-i));
   }
}