<!--
var offsetX;
var offsetY;
var tooltip;
var emulator;

function showTooltip(theLink, e, id, width, height) {
  tooltip = document.getElementById("tooltip");
  offsetX = -1 * Math.ceil(width / 2);
  offsetY = -10 - height;
  if (!e)
    e = window.event;
  var posx = getPosX(e);
  var posy = getPosY(e);
  theLink.onmousemove = moveTooltip;
  theLink.onmouseout = hideTooltip;
  var scrollY = (window.pageYOffset) ? window.pageYOffset : (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
  tooltip.style.top = eval(posy + offsetY - scrollY > 0 ? posy + offsetY : posy + 25) + 'px';
  tooltip.style.left = eval(posx + offsetX) + 'px';
  tooltip.innerHTML = "<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><div style=\"text-align:center; width:" + width + "px; position:absolute; z-index:-1\">Loading...</div><div style=\"width:" + width + "px; height:" + height + "px; overflow: hidden\"><img src=\"/image.php?type=screen&amp;id=" + id + "\" style=\"border:0px\" alt=\"\"></div></td></tr></table>";
  tooltip.style.visibility = 'visible';
}

function hideTooltip(e) {
  tooltip.style.visibility = 'hidden';
}

function showInstructiontip(theLink, e) {
  tooltip = document.getElementById("instructiontip");
  emulator = document.getElementById("emulator");
  if (!e)
    e = window.event;
  theLink.onmouseout = hideInstructiontip;
  tooltip.style.top = '80px';
  tooltip.style.left = eval(getPosX(e) - 150) + 'px';
  emulator.style.visibility = 'hidden';
  tooltip.style.visibility = 'visible';
}

function hideInstructiontip(e) {
  tooltip.style.visibility = 'hidden';
  emulator.style.visibility = 'visible';
  emulator.requestFocus();
}

function moveTooltip(e) {
  if (!e)
    e = window.event;
  var posx = getPosX(e);
  var posy = getPosY(e);
  var scrollY = (window.pageYOffset) ? window.pageYOffset : (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
  tooltip.style.top = eval(posy + offsetY - scrollY > 0 ? posy + offsetY : posy + 25) + 'px';
  tooltip.style.left = eval(posx + offsetX) + 'px';
}

// Utility functions

function getPosX(e) {
  if (e.pageX)
    return e.pageX;
  else if (e.clientX)
    return e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
  else
    return 0;
}

function getPosY(e) {
  if (e.pageY)
    return e.pageY;
  else if (e.clientY)
    return e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
  else
    return 0;
}

// Game Genie
function GameGenie(id) {
	url = "gamegenie.php?id=" + id;
	settings = "";
	gamegeniewin = window.open(url, 'gamegeniewin', settings);
	gamegeniewin.focus();
}

function ManualByID(id, destDPI) {
	if (destDPI == undefined)
		destDPI = 95
	url = "/manual/manual.php?id=" + id + "&destDPI=" + destDPI;
	settings = "width=300, height=300, left=0, top=0, resizable=0, scrollbars=0";
	manualwin = window.open(url, 'manualwin', settings);
	manualwin.focus();
}

// Game Scans
function productWindow2(system, id, page, size) {
	var width = 0;
	var height = 0;

	switch (system) {
		case 'NES':
			width = 472;
			height = 526;
			break;
		case 'SNES':
			width = 532;
			height = 344;
			break;
		case 'Genesis':
			switch (size) {
				case 'large':
					width = 432;
					height = 432;
					break;
				default:
					width = 432;
					height = 270;
			}
			break;
		case 'PS1':
			width = 700;
			height = 700;
			break;
	}
	popupwin = window.open('', 'product', 'width=' + width + ', height=' + height + ', left=100, top=50, dependent=1');
	popupwin.document.open();
	popupwin.document.write("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>\n<head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'><meta http-equiv='Content-Language' content='en-us'><title>Product Image</title></head>\n<body style=\"background-color:black; color:white; margin:0px\"><div style=\"text-align:center; width:" + width + "px; height:" + height + "px; position:absolute; z-index:-1\">Loading...</div><div style=\"width:" + width + "px; height:" + height + "px; background-image:url('/image.php?type=cart&amp;id="+id+"&amp;page="+page+"')\"><img style='border:0px' src='/images/clear.gif' width='" + width + "' height='" + height + "' alt=''></div></body>");
	popupwin.document.close();
	popupwin.focus();
}

function productPopup(system, id, page, size) {
	var width = 0;
	var height = 0;

	switch (system) {
		case 'NES':
			width = 472;
			height = 526;
			break;
		case 'SNES':
			width = 532;
			height = 344;
			break;
		case 'Genesis':
			switch (size) {
				case 'large':
					width = 432;
					height = 432;
					break;
				default:
					width = 432;
					height = 270;
			}
			break;
		case 'PS1':
			width = 700;
			height = 700;
			break;
	}

	document.getElementById('productImageTable').style.backgroundImage = "url('/image.php?type=cart&id=" + id + "&page=" + page + "')";
	document.images['productImage'].style.width = '' + width + 'px';
	document.images['productImage'].style.height = '' + height + 'px';
	document.getElementById('popImageTable').style.display = '';
}

function productPopup2(system, id, page, size) {
	var width = 0;
	var height = 0;

	switch (system) {
		case 'NES':
			width = 472;
			height = 526;
			break;
		case 'SNES':
			width = 532;
			height = 344;
			break;
		case 'Genesis':
			switch (size) {
				case 'large':
					width = 432;
					height = 432;
					break;
				default:
					width = 432;
					height = 270;
			}
			break;
		case 'PS1':
			width = 700;
			height = 700;
			break;
	}

	document.getElementById('productImageTable').style.backgroundImage = "url('/image.php?type=cart&id=" + id + "&page=" + page + "')";
	document.images['productImage'].style.width = '' + width + 'px';
	document.images['productImage'].style.height = '' + height + 'px';
	document.getElementById('popImageTable').style.display = '';
}

// -->
