﻿function showEnlargedImage(smallImageObj, veryLargeImageLink) {
	var div = getObject("enlargedImageDiv");
	var smallImg = getObject(smallImageObj);
	var enlargedImg = getObject("enlargedImage");
		
	enlargedImage.src = smallImg.src;
	div.style.left = smallImg.offsetLeft - enlargedImage.width + smallImg.width ; 
	div.style.top = smallImg.offsetTop; 

	enlargedImageLink.href = veryLargeImageLink;
		
	showLayer(div);
	setZIndex(div, 100);
}

function setZIndex(obj, zOrder) {
    var theObj = getObject(obj);
    if (theObj) {
        theObj.style.zIndex = zOrder;
    }
}

function getObject(obj) {
	if (typeof obj == "string") {
		if (document.getElementById) {
			return document.getElementById(obj);
		} else if (document.all) {
			return document.all[obj];
		} else if (document.layers) {
			return document.layers[obj];
		}
	} else {
		return obj;
	}
}

function showLayer(layerName) {
	getObject(layerName).style.display = "block";
}

function hideLayer(layerName) {
	getObject(layerName).style.display = "none";
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}	
