function showImage(objectName,imageIndex,imageNameText) {
	if (!document.images)
		return

	imageWidth  = preloadedImages[imageIndex].width;
	imageHeight = preloadedImages[imageIndex].height;

	if (imageWidth > imageHeight) {
		if (imageWidth > 350) {
			imageHeight = (350 * imageHeight) / imageWidth;
			imageWidth  = 350;
		}
	} else {
		if (imageHeight > 300) {
			imageWidth  = (300 * imageWidth) / imageHeight;
			imageHeight = 300;
		}
	}

	document.images[objectName].src    = imgArray[imageIndex];
	document.images[objectName].width  = imageWidth;
	document.images[objectName].height = imageHeight;
	document.getElementById(objectName+'_name').innerHTML = imageNameText;
}

function imageWindow(imgIndex, xTitle) {

	xWidth        = preloadedImages[imgIndex].width;
	xHeight       = preloadedImages[imgIndex].height;
	
	// add some padding around the image
	xWidth  += 30;
	xHeight += 50;

	//center the new window
	leftPosition = (screen.width) ? (screen.width-xWidth)/2 : 0;
	topPosition  = (screen.height) ? (screen.height-xHeight)/2 : 0;

	windowSettings = 'width='+xWidth+',height='+xHeight+',menubar=no,location=no,scrollbars=no,status=no,titlebar=no,toolbar=no,resizable=no,directories=no,top='+topPosition+',left='+leftPosition;
	window.open('http://www.rvusa.com/dealer_management/includes/showroom_gallery_popup.asp?file='+imgArray[imgIndex]+'&title='+xTitle+'','showroom_gallery',windowSettings);
}