/////////////////////////////////////////////////
//
// This function allows the page it is included
// on to open and close a popup window in the 
// center of the users display. The following 
// variables are used:
//
// popupWindowPresent : Boolean
// -----------------------------
// Defines if another popup window is present.
//
/////////////////////////////////////////////////

var popupWindowPresent = 0;

function popupWindow(urlToOpen, scroll){
	
	if(scroll == '') {
		scroll = 'no';
	}
	
	popupWindowWidth = 375;
	popupWindowHeight = 380;
	
	/////////////////////////////////////////////
	//
	// Check to see if the user already has a
	// popup window open.
	//
	/////////////////////////////////////////////
	
	if(popupWindowPresent)
  	{
		/////////////////////////////////////////
		//
		// One of the popup windows for the site
		// is already open, so we need to close
		// it.
		//
		/////////////////////////////////////////
		
    	if(!popupWindowPresent.closed) popupWindowPresent.close();
	}	
	
	/////////////////////////////////////////////
	//
	// Define the width and height of the users
	// display.  We need to do this so we can
	// center the popup on the screen.
	//
	/////////////////////////////////////////////
	
	userDisplayWidth = screen.availWidth;
   	userDisplayHeight = screen.availHeight;
	
	/////////////////////////////////////////////
	//
	// Using the display width and height info
	// we retreived and the windows width and
	// height defined in the function call,
	// we need to define the left and top windows
	// display position on the screen.
	//
	/////////////////////////////////////////////
	
	popupWindowLeft = ((userDisplayWidth / 2) - (popupWindowWidth / 2));
	popupWindowTop = ((userDisplayHeight / 2) - (popupWindowHeight / 2));	
	  
	/////////////////////////////////////////////
	//
	// Open the window in the center of the users
	// display, using the variables defined above.
	// We need to turn off all of the unnecessary
	// window display options as well.
	//
	/////////////////////////////////////////////
	  
  	popupWindowPresent = open(urlToOpen, 'popupWindowPresent', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars='+scroll+', resizable=no, copyhistory=yes, width='+popupWindowWidth+', height='+popupWindowHeight+', left='+popupWindowLeft+', top='+popupWindowTop+',screenX='+ popupWindowLeft+', screenY='+popupWindowTop+'');
	
}