// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// :::::			     Turbo Popup Window Script       	  :::
// :::::			   Created by Justin Stephenson   		  :::
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

var turboPopupWin = null;
lastName = null;

function turboPopup(URL,flexType,windowType,width,height,screenHorizPosition,screenVertPosition,stackOrder,temporaryName) {
	if	(screenHorizPosition == 'center')	{ leftPosition = (screen.width) ? (screen.width - width)/2:100; }
		else { leftPosition = screenHorizPosition; }
	if	(screenVertPosition == 'center')	{ topPosition = (screen.height) ? (screen.height - height)/2:100; }
		else { topPosition = screenVertPosition; }
	if (windowType == 'full') { styleAttributes = "toolbar=yes,location=yes,directories=yes,menubar=yes,status=yes"; } else if (windowType == 'basic') { styleAttributes = "toolbar=yes,location=no,directories=no,menubar=no,status=no"; } else if (windowType == 'bare') { styleAttributes = "toolbar=no,location=no,directories=no,menubar=no,status=no"; } else { styleAttributes = "toolbar=yes,location=yes,directories=yes,menubar=yes,status=yes"; }
	if (flexType == 'frozen') { flexAttributes = "scrollbars=no,resizable=no"; } else if (flexType == 'rigid') { flexAttributes = "scrollbars=yes,resizable=no"; } else if (flexType == 'loose') { flexAttributes = "scrollbars=yes,resizable=yes"; } else { flexAttributes = "scrollbars=yes,resizable=yes"; }
	if (width == 'total') { width = screen.width; }
	if (height == 'total') { height = screen.height; }
	// *** consider a browser sniff to serve screenX and screenY to Navigator 4 ***
	windowAttributes = 'width=' + width + ',height=' + height + ',top=' + topPosition + ',left=' + leftPosition + ',' + styleAttributes + ',' + flexAttributes;
	// if the temporary and last names match, the popup is repopulating an existing window; the existing window must be closed to allow its replacement to use new and different style, flexibility, and position attributes
	if (temporaryName == lastName) { if (turboPopupWin != null && !turboPopupWin.closed) { oldWin = turboPopupWin; oldWin.name = "oldWin"; oldWin.close(); } }
	lastName = temporaryName;
	turboPopupWin = window.open(URL,temporaryName,windowAttributes);
	if (stackOrder == 'top') { turboPopupWin.focus(); turboPopupWin.location = URL; }
		else if (stackOrder == 'bottom') { turboPopupWin.blur(); turboPopupWin.location = URL; turboPopupWin.blur(); self.focus(); }
}

// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// :::::				  Closewindow Script		          :::
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

function closeWin()
	{
		this.close();
		PrintWindow = null;
	}

// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// :::::				  Preload - Rollover		          :::
// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


imagesPreloaded = false;

function rollOver(imageName) {
	overImage = '/images/nav/lit/' + imageName + '.gif';
	changeImages(imageName, overImage);
	return true;
}

function rollOff(imageName) {
	offImage = '/images/nav/def/' + imageName + '.gif';
	changeImages(imageName, offImage);
	return true;
}

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

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

<!-- Begin 2 State Preload Script -->
litPath = "/images/nav/lit/";
defPath = "/images/nav/def/";

imagesToPreload = new Array();
imagesToPreload['nav'] = new Array("performers.gif", "grounds.gif", "hyperboles.gif", "odds.gif", "questions.gif", "lynx.gif", "request.gif", "popup_close_window.gif");

defImages = new Array();
litImages = new Array();

function preload(prefix) {
	if (document.images) {

		litImages.length = 0;
		defImages.length = 0;

		numToPreload = imagesToPreload[prefix].length;
		
		for (i=0; i<numToPreload; i++) {

			imgName = imagesToPreload[prefix][i];

			litURL = litPath + imgName;
			litImages[i] = new Image();
			litImages[i].src = litURL;

			defURL = defPath + imgName;
			defImages[i] = new Image();
			defImages[i].src = defURL;

		}
	}
	imagesPreloaded = true;
}