// ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

// :::::			     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(); }

}
