
var origWd;            // this is the original width of the img (per the Style Sheet)
var origHt;              // this is the original height of the img (per the Style Sheet)
var last_img;          // the last img which was clicked on
var img_state = 0;  // either 1 (zoomed) or 0 (not zoomed)

// This is the function which zooms the image that is clicked on
function ingrandisci(max,whichImg) {
	thisImg = whichImg;
	if (thisImg == last_img) {
		// do nothing (because you are clicking on an already zoomed image)
	} else {
		thisOne = document.getElementById(thisImg);
		origWd = thisOne.width;    // gets the original width of the image first
		origHt = thisOne.height;    // gets the original height of the image also
		thisOne.width = thisOne.width*(max/thisOne.height) ;    // change the width by the zoomAmt
		thisOne.height = max;    // change the height by the zoomAmt
		last_img = thisImg;    // this var insures that further clicking does not continue to zoom the image
		img_state = 1;    // this var tells the script this image is in a zoomed state
	}
}

// This is the function which restores the image to original size if you MouseOut.
function rinpicciolisci(whichimg) {
	if (img_state == 0) {
		// do nothing (if you MouseOut of an img which is NOT in a zoomed state)
	} else {
		thisimg = whichimg;
		thisone = document.getElementById(thisimg);  // gets the img object
		thisone.width = origWd;    // restores the original width
		thisone.height = origHt;    // restores the original height
		last_img = "";    // resets the last_img variable to null
		img_state = 0;   // resets the img_state variable to an unzoomed state
	}
}
