// Revised 3/1/05 to add new function to default scroll bars on


// Open the popup window to the specified URL
function openPopup(theURL, theWidth, theHeight, theName, e) {
	var positionStr ="";

	if( theName == null )
		theName = "popupWin";
		
	if( e != null ) {
		var left = e.screenX;
		var top = e.screenY - (theHeight/2);
		positionStr =  ",left=" + left + ",top=" + top + ",screenX=" + left + ",screenY=" + top;
	}
	
	var winProperties = "resize=no,toolbar=no,directories=no,menubar=no,status=no,noresize,scrollbars=auto,width=" + theWidth + ",height=" + theHeight + positionStr;
	var mainWin = self;
	if( window.popupWin == null )	   // If the window has never been opened
		popupWin=window.open(theURL,theName, winProperties);
	else {
		if( window.popupWin.closed )	// If the window was open but has been closed
			popupWin=window.open(theURL,theName, winProperties);
		else {								   // The window is already open
			popupWin.close();
			popupWin=window.open(theURL,theName, winProperties);
		}
	}
	popupWin.opener = mainWin;
	popupWin.focus();
}


// Open the popup window to the specified URL
function openTopLeft(theURL, theWidth, theHeight, theName, e) {
	var positionStr ="";

	if( theName == null )
		theName = "popupWin";
		
	if( e != null ) {
		var left = e.screenX - theWidth;
		var top = e.screenY - theHeight;
		positionStr =  ",left=" + left + ",top=" + top + ",screenX=" + left + ",screenY=" + top;
	}
	
	var winProperties = "resize=no,toolbar=no,directories=no,menubar=no,status=no,noresize,scrollbars=auto,width=" + theWidth + ",height=" + theHeight + positionStr;
	var mainWin = self;
	if( window.popupWin == null )	   // If the window has never been opened
		popupWin=window.open(theURL,theName, winProperties);
	else {
		if( window.popupWin.closed )	// If the window was open but has been closed
			popupWin=window.open(theURL,theName, winProperties);
		else {								   // The window is already open
			popupWin.close();
			popupWin=window.open(theURL,theName, winProperties);
		}
	}
	popupWin.opener = mainWin;
	popupWin.focus();
}

// Open the popup window to the specified URL
function openTopLeftScroll(theURL, theWidth, theHeight, theName, e) {
	var positionStr ="";

	if( theName == null )
		theName = "popupWin";
		
	if( e != null ) {
		var left = e.screenX - theWidth;
		var top = e.screenY - theHeight;
		positionStr =  ",left=" + left + ",top=" + top + ",screenX=" + left + ",screenY=" + top;
	}
	
	var winProperties = "resize=no,toolbar=no,directories=no,menubar=no,status=no,noresize,scrollbars=yes,width=" + theWidth + ",height=" + theHeight + positionStr;
	var mainWin = self;
	if( window.popupWin == null )	   // If the window has never been opened
		popupWin=window.open(theURL,theName, winProperties);
	else {
		if( window.popupWin.closed )	// If the window was open but has been closed
			popupWin=window.open(theURL,theName, winProperties);
		else {								   // The window is already open
			popupWin.close();
			popupWin=window.open(theURL,theName, winProperties);
		}
	}
	popupWin.opener = mainWin;
	popupWin.focus();
}
