function hideImage(imageDiv) {
	imageDiv.parentNode.removeChild(imageDiv);
	
	currentDiv = null;
}

/**
 * The image div that is current
 */
var currentDiv = null;

function showImage(srcImage, path, orientation) {

	if(currentDiv !== null) {
		hideImage(currentDiv);
	}
	
	currentDiv = document.createElement('div');
	currentDiv.style.position = 'absolute';
	currentDiv.style.width = 1;
	currentDiv.style.height = 1;
	currentDiv.id = 'currentDiv';
	currentDiv.onmouseout = function() {
		hideImage(this);
	};
	document.body.appendChild(currentDiv);

	var divImage = new Image();
	divImage.className = 'product';
	divImage.style.margin = 0;
			
	currentDiv.appendChild(divImage);		

	// Calculate the position of the image
	var node = srcImage;
	var left = node.offsetLeft;
	var top = node.offsetTop;
	while (node.parentNode) {
		node = node.parentNode;
		if (node.offsetLeft) {
			left += node.offsetLeft;
			top += node.offsetTop;
		}
	}

	if(navigator.userAgent.indexOf("Firefox") != -1){
		// Increment the top by 94px which is the height of the header and is not included in the calculation
		top -= 320;
	}
	
	if(orientation == 'horizontal') {
		// For horizontal orientation
		left -= 125;
		top -= 75;
	} else if(orientation == 'vertical') {
		// For vertical orientation
		left -= 50;
		top -= 150;
	} else {
		// For orientation expanding on both planes
		left -= 125;
		top -= 150;
	}

	currentDiv.style.left = left;
	currentDiv.style.top = top;
	
	divImage.src = path;
}
