overImg = new Array();

function preLoad()
{
	if (!document.images) return false;
	for (cnt = 0; cnt < arguments.length; cnt++)
	{
		img = arguments[cnt];
		overImg[img] = new Image();
		overImg[img].src = 'images/nav_' + img + '_lit.jpg';
	}
}

function imgOn(img)
{
	if (document.images && document.images[img])
	{ document.images[img].src = 'images/nav_' + img + '_lit.jpg'; }
}

function imgOff(img)
{
	if (document.images && document.images[img])
	{ document.images[img].src = 'images/nav_' + img + '.jpg'; }
}

function popupImage(url, imgWidth, imgHeight, title)
{
	if (!window.open || !imgWidth || !imgHeight) return true;

	urlString = 'popup_image.php?image=' + escape(url);
	optionsString = 'scrollbars=yes,resizable=yes';

	windowWidth = Math.max(imgWidth + 64, 160);
	windowHeight = imgHeight + 96;

	//adjust width to fit available screen real-estate, if available
	if (screen.availWidth && screen.availHeight)
	{
		windowWidth = Math.min(screen.availWidth - 40, windowWidth);
		windowHeight = Math.min(screen.availHeight - 40, windowHeight);
	}
	urlString += '&width=' + imgWidth + '&height=' + imgHeight;
	optionsString += ',width=' + windowWidth + ',height=' + windowHeight;

	if (title) urlString += '&title=' + escape(title);

	popupWindow = window.open(urlString, '', optionsString);
	if (popupWindow.focus) popupWindow.focus();
	return false;
}
