function zoomIn(from, shift) {

	zoomimg.src = from.getAttribute("href");

	// Determine the zoom settings from where we came from, the element in the <a>.
	// If there's no element in the <a>, or we can't get the width, make stuff up

	if (from.childNodes[0].width) {
		startW = from.childNodes[0].width;
		startH = from.childNodes[0].height;
		startPos = findElementPos(from.childNodes[0]);
	} else {
		startW = 50;
		startH = 12;
		startPos = findElementPos(from);
	}

	hostX = startPos[0];
	hostY = startPos[1];

	// Make up for a scrolled containing div.
	// TODO: This HAS to move into findElementPos.
	
	if (document.getElementById('scroller')) {
		hostX = hostX - document.getElementById('scroller').scrollLeft;
	}

	// Determine the target zoom settings from the preloaded image object

	endW = imgPreload.width;
	endH = imgPreload.height;

	// Start! But only if we're not zooming already!

	if (zoomActive[theID] != true) {

		// Clear everything out just in case something is already open

		if (document.getElementById("ShadowBox")) {
			document.getElementById("ShadowBox").style.visibility = "hidden";
		} else if (! browserIsIE) {
		
			// Wipe timer if shadow is fading in still
			if (fadeActive["ZoomImage"]) {
				clearInterval(fadeTimer["ZoomImage"]);
				fadeActive["ZoomImage"] = false;
				fadeTimer["ZoomImage"] = false;			
			}
			
			document.getElementById("ZoomImage").style.webkitBoxShadow = shadowSettings + '0.0)';			
		}
		
		document.getElementById("ZoomClose").style.visibility = "hidden";     

		// Setup the CAPTION, if existing. Hide it first, set the text.

		if (includeCaption) {
			document.getElementById(zoomCaptionDiv).style.visibility = "hidden";
			if (from.getAttribute('title') && includeCaption) {
				// Yes, there's a caption, set it up
				document.getElementById(zoomCaption).innerHTML = from.getAttribute('title');
			} else {
				document.getElementById(zoomCaption).innerHTML = "";
			}
		}

		// Store original position in an array for future zoomOut.

		zoomOrigW[theID] = startW;
		zoomOrigH[theID] = startH;
		zoomOrigX[theID] = hostX;
		zoomOrigY[theID] = hostY;

		// Now set the starting dimensions

		zoomimg.style.width = startW + 'px';
		zoomimg.style.height = startH + 'px';
		zoomdiv.style.left = hostX + 'px';
		zoomdiv.style.top = hostY + 'px';

		// Show the zooming image container, make it invisible

		if (includeFade == 1) {
			setOpacity(0, zoomID);
		}
		zoomdiv.style.visibility = "visible";

		// If it's too big to fit in the window, shrink the width and height to fit (with ratio).

		sizeRatio = endW / endH;
		if (endW > myWidth - minBorder) {
			endW = myWidth - minBorder;
			endH = endW / sizeRatio;
		}
		if (endH > myHeight - minBorder) {
			endH = myHeight - minBorder;
			endW = endH * sizeRatio;
		}

		zoomChangeX = ((myWidth / 2) - (endW / 2) - hostX);
		zoomChangeY = (((myHeight / 2) - (endH / 2) - hostY) + myScroll);
		zoomChangeW = (endW - startW);
		zoomChangeH = (endH - startH);
		
		// Shift key?
	
		if (shift) {
			tempSteps = zoomSteps * 7;
		} else {
			tempSteps = zoomSteps;
		}

		// Setup Zoom

		zoomCurrent = 0;

		// Setup Fade with Zoom, If Requested

		if (includeFade == 1) {
			fadeCurrent = 0;
			fadeAmount = (0 - 100) / tempSteps;
		} else {
			fadeAmount = 0;
		}

		// Do It!
		
		zoomTimer[theID] = setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+hostX+", "+zoomChangeX+", "+hostY+", "+zoomChangeY+", "+tempSteps+", "+includeFade+", "+fadeAmount+", 'zoomDoneIn(zoomID)')", zoomTime);		
		zoomActive[theID] = true; 
	}
}
// "from" is an object reference to the href that spawned the zoom.
"from" is an object reference to the href that spawned the zoom.
" from " is an object reference to the href that spawned the zoom .
function zoomIn(from, shift) {
	zoomimg.src = from.getAttribute("href");
	if (from.childNodes[0].width) {
		startW = from.childNodes[0].width;
		startH = from.childNodes[0].height;
		startPos = findElementPos(from.childNodes[0]);
	} else {
		startW = 50;
		startH = 12;
		startPos = findElementPos(from);
	}
	hostX = startPos[0];
	hostY = startPos[1];
	if (document.getElementById('scroller')) {
		hostX = hostX - document.getElementById('scroller').scrollLeft;
	}
	endW = imgPreload.width;
	endH = imgPreload.height;
	if (zoomActive[theID] != true) {
		if (document.getElementById("ShadowBox")) {
			document.getElementById("ShadowBox").style.visibility = "hidden";
		} else if (! browserIsIE) {
			if (fadeActive["ZoomImage"]) {
				clearInterval(fadeTimer["ZoomImage"]);
				fadeActive["ZoomImage"] = false;
				fadeTimer["ZoomImage"] = false;			
			}
			document.getElementById("ZoomImage").style.webkitBoxShadow = shadowSettings + '0.0)';			
		}
		document.getElementById("ZoomClose").style.visibility = "hidden";     
		if (includeCaption) {
			document.getElementById(zoomCaptionDiv).style.visibility = "hidden";
			if (from.getAttribute('title') && includeCaption) {
				document.getElementById(zoomCaption).innerHTML = from.getAttribute('title');
			} else {
				document.getElementById(zoomCaption).innerHTML = "";
			}
		}
		zoomOrigW[theID] = startW;
		zoomOrigH[theID] = startH;
		zoomOrigX[theID] = hostX;
		zoomOrigY[theID] = hostY;
		zoomimg.style.width = startW + 'px';
		zoomimg.style.height = startH + 'px';
		zoomdiv.style.left = hostX + 'px';
		zoomdiv.style.top = hostY + 'px';
		if (includeFade == 1) {
			setOpacity(0, zoomID);
		}
		zoomdiv.style.visibility = "visible";
		sizeRatio = endW / endH;
		if (endW > myWidth - minBorder) {
			endW = myWidth - minBorder;
			endH = endW / sizeRatio;
		}
		if (endH > myHeight - minBorder) {
			endH = myHeight - minBorder;
			endW = endH * sizeRatio;
		}
		zoomChangeX = ((myWidth / 2) - (endW / 2) - hostX);
		zoomChangeY = (((myHeight / 2) - (endH / 2) - hostY) + myScroll);
		zoomChangeW = (endW - startW);
		zoomChangeH = (endH - startH);
		if (shift) {
			tempSteps = zoomSteps * 7;
		} else {
			tempSteps = zoomSteps;
		}
		zoomCurrent = 0;
		if (includeFade == 1) {
			fadeCurrent = 0;
			fadeAmount = (0 - 100) / tempSteps;
		} else {
			fadeAmount = 0;
		}
		zoomTimer[theID] = setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+hostX+", "+zoomChangeX+", "+hostY+", "+zoomChangeY+", "+tempSteps+", "+includeFade+", "+fadeAmount+", 'zoomDoneIn(zoomID)')", zoomTime);		
		zoomActive[theID] = true; 
	}
}
function zoomIn ( from , shift ) { zoomimg . src = from . getAttribute ( "href" ) ; if ( from . childNodes [ 0 ] . width ) { startW = from . childNodes [ 0 ] . width ; startH = from . childNodes [ 0 ] . height ; startPos = findElementPos ( from . childNodes [ 0 ] ) ; } else { startW = 50 ; startH = 12 ; startPos = findElementPos ( from ) ; } hostX = startPos [ 0 ] ; hostY = startPos [ 1 ] ; if ( document . getElementById ( 'scroller' ) ) { hostX = hostX - document . getElementById ( 'scroller' ) . scrollLeft ; } endW = imgPreload . width ; endH = imgPreload . height ; if ( zoomActive [ theID ] != true ) { if ( document . getElementById ( "ShadowBox" ) ) { document . getElementById ( "ShadowBox" ) . style . visibility = "hidden" ; } else if ( ! browserIsIE ) { if ( fadeActive [ "ZoomImage" ] ) { clearInterval ( fadeTimer [ "ZoomImage" ] ) ; fadeActive [ "ZoomImage" ] = false ; fadeTimer [ "ZoomImage" ] = false ; } document . getElementById ( "ZoomImage" ) . style . webkitBoxShadow = shadowSettings + '0.0)' ; } document . getElementById ( "ZoomClose" ) . style . visibility = "hidden" ; if ( includeCaption ) { document . getElementById ( zoomCaptionDiv ) . style . visibility = "hidden" ; if ( from . getAttribute ( 'title' ) && includeCaption ) { document . getElementById ( zoomCaption ) . innerHTML = from . getAttribute ( 'title' ) ; } else { document . getElementById ( zoomCaption ) . innerHTML = "" ; } } zoomOrigW [ theID ] = startW ; zoomOrigH [ theID ] = startH ; zoomOrigX [ theID ] = hostX ; zoomOrigY [ theID ] = hostY ; zoomimg . style . width = startW + 'px' ; zoomimg . style . height = startH + 'px' ; zoomdiv . style . left = hostX + 'px' ; zoomdiv . style . top = hostY + 'px' ; if ( includeFade == 1 ) { setOpacity ( 0 , zoomID ) ; } zoomdiv . style . visibility = "visible" ; sizeRatio = endW / endH ; if ( endW > myWidth - minBorder ) { endW = myWidth - minBorder ; endH = endW / sizeRatio ; } if ( endH > myHeight - minBorder ) { endH = myHeight - minBorder ; endW = endH * sizeRatio ; } zoomChangeX = ( ( myWidth / 2 ) - ( endW / 2 ) - hostX ) ; zoomChangeY = ( ( ( myHeight / 2 ) - ( endH / 2 ) - hostY ) + myScroll ) ; zoomChangeW = ( endW - startW ) ; zoomChangeH = ( endH - startH ) ; if ( shift ) { tempSteps = zoomSteps * 7 ; } else { tempSteps = zoomSteps ; } zoomCurrent = 0 ; if ( includeFade == 1 ) { fadeCurrent = 0 ; fadeAmount = ( 0 - 100 ) / tempSteps ; } else { fadeAmount = 0 ; } zoomTimer [ theID ] = setInterval ( "zoomElement('" + zoomID + "', '" + theID + "', " + zoomCurrent + ", " + startW + ", " + zoomChangeW + ", " + startH + ", " + zoomChangeH + ", " + hostX + ", " + zoomChangeX + ", " + hostY + ", " + zoomChangeY + ", " + tempSteps + ", " + includeFade + ", " + fadeAmount + ", 'zoomDoneIn(zoomID)')" , zoomTime ) ; zoomActive [ theID ] = true ; } }
"from" is an object reference to the href that spawned the zoom.
" from " is an object reference to the href that spawned the zoom .
// Determine the zoom settings from where we came from, the element in the <a>. // If there's no element in the <a>, or we can't get the width, make stuff up // Make up for a scrolled containing div. // TODO: This HAS to move into findElementPos. // Determine the target zoom settings from the preloaded image object // Start! But only if we're not zooming already! // Clear everything out just in case something is already open // Wipe timer if shadow is fading in still // Setup the CAPTION, if existing. Hide it first, set the text. // Yes, there's a caption, set it up // Store original position in an array for future zoomOut. // Now set the starting dimensions // Show the zooming image container, make it invisible // If it's too big to fit in the window, shrink the width and height to fit (with ratio). // Shift key? // Setup Zoom // Setup Fade with Zoom, If Requested // Do It!