//var imgname, total, steps, maxx, maxy, currentx, currenty, dx, dy, counter;

var ival = [];
var counter=0;
function zoomImg(imgname, total, steps, maxx, maxy, updown)	{
// convert the total from seconds to miliseconds
total = total * 1000;
objref = eval("document.getElementById('"+imgname+"')");
currentx = objref.width;
currenty = objref.height;
// work out how much we need to increase the image by each step
// devide image sizes by number of steps to get the amount we need to change each step
stepx = maxx / steps;
stepy = maxy / steps;
// devide the total time (in ms) by the number of steps to get the interval time
inttime = total / steps;
// set the interval to increase the size of the image by the required pixels
if(updown==1) functionRef = "resizeImg('"+imgname+"', "+stepx+", "+stepy+", "+maxx+", "+maxy+", "+counter+")";
else functionRef = "resizeImg2('"+imgname+"', "+stepx+", "+stepy+", "+maxx+", "+maxy+", "+counter+")";
ival[counter] = setInterval(functionRef, inttime);
if(counter==10) counter=0;
else counter++;
}
function resizeImg(imgname, dx, dy, maxx, maxy, c) {
//alert('up'+setfade);
objref = eval("document.getElementById('"+imgname+"')");
currentx = objref.width;
currenty = objref.height;
if ((currentx<maxx-dx) && (currenty<maxy-dy)) {
objref.height = currenty + dy;
objref.width = currentx + dx;
}
else {
clearInterval(ival[c]);
objref.height = maxy;
objref.width = maxx;
   }
}
function resizeImg2(imgname, dx, dy, maxx, maxy, c) {
//alert('down'+setfade);
objref = eval("document.getElementById('"+imgname+"')");
currentx = objref.width;
currenty = objref.height;
if (currentx>((0.5*maxx)+dx) && currenty>((0.5*maxy)+dy)) {
objref.height = currenty - dy;
objref.width = currentx - dx;
}
else {
clearInterval(ival[c]);
objref.height = 0.5*maxy;
objref.width = 0.5*maxx;
   }
}