// FILENAME: popupwin.js 
// 
// DATE: 98/01/20 
// 
// PROGRAMMER: Jervis Thompson (www.jervo.com) 
// 
// DESCRIPTION: Pop open a new window. 
// This Java code allows you to open a separate browser window and load the 
// specfied filename passed as a parameter. 
// 
// 
// 
// 
// ******* Global Variables ******* 
// 
// 
// 

var oNewDefWin   = ""; 
var oFlashDefWin = ""; 
var oGameDefWin  = ""; 

// New defination window object. 
// ******* Functions ******* 
// 
// 
// 

// CloseMe.... Close window self
//
function CloseMe(){			

    alert ('In CloseMe handler ');  

	window.close(); } 
	
// end CloseMe

// GoBackOnePage.... Just like clicking on the back button
//
function GoBackOnePage(){			

	window.history.back(); } 
	
// end GoBackOnePage


// PopOpenFlashWindow.... Will open a flash window using html file name passed to it. 
// 

// PopOpenFlashWindow.... Will open a flash window using html.
//
function PopOpenFlashWindow(pHtmlName, pWidth, pHeight) { 

    //alert ('In PopOpenFlashWindow handler ' + pHeight);  
	
	if (oFlashDefWin.open) {
		
		// Window already open.... bring to the front		
		oFlashDefWin.focus();
				
	} else {	
	
    	//alert ('in popup' + pHtmlName + ' ' + pWidth + ' ' + pHeight);  
    	  	
    	var winParaStr = 'toolbar=no,directories=no,resizable=yes,scrollbars=yes';
    	
    	winParaStr = winParaStr + ',width=' + pWidth + ',height=' + pHeight;

        // Create window. 
	    oFlashDefWin = window.open(pHtmlName,'EPFlashWindow', winParaStr);
	 
	    // Bring window to the front. 
	    oFlashDefWin.focus();  
	    
	    <!-- PopOpenFlashGameWindow('http://www.indiebytes.com/flashgames/Top3MaleFirstNames.html', 440, 340); -->
	    	    
     } // end if
     
} // end PopOpenFlashWindow 


// PopOpenFlashGameWindow.... Will open a flash window using html.
//
function PopOpenFlashGameWindow(pHtmlName, pWidth, pHeight) { 

	if (oGameDefWin.open) {
		
		// Window already open.... bring to the front		
		oGameDefWin.focus();
				
	} else {	
	
    	//alert ('in popup' + pHtmlName + ' ' + pWidth + ' ' + pHeight);  
    	  	
    	var winParaStr = 'toolbar=no,directories=no,resizable=yes,scrollbars=yes';
    	
    	winParaStr = winParaStr + ',width=' + pWidth + ',height=' + pHeight;

	    // Create window. 
	    oGameDefWin = window.open(pHtmlName,'EPFlashGameWindow', winParaStr);
	 
	    // Bring window to the front. 
	    oGameDefWin.focus();  
	    	    	    
     } // end if
     
} // end PopOpenFlashGameWindow 


// PopOpenAWindow.... Will open a defination window using html file name passed to it. 
// 

// PopOpenAWindow.... Will open a defination window using html.
//
function PopOpenAWindow(pHtmlName, pWidth, pHeight) { 

	//alert ('in popup' + pHtmlName + ' ' + pWidth + ' ' + pHeight);

	var winParaStr = 'toolbar=no,directories=no,resizable=yes,scrollbars=yes';
	
	winParaStr = winParaStr + ',width=' + pWidth + ',height=' + pHeight;
	
	// Create or recreate defination window. 
	oNewDefWin = window.open(pHtmlName,'NewDefWinName', winParaStr);
	 
	// Bring defination window to the front. 
	oNewDefWin.focus(); } 
	
// end PopOpenAWindow 


// ClosePopUpWindow.... Will close a defination window using html.
//
function ClosePopUpWindow() {

	//alert ('oNewDefWin' + oNewDefWin);

	if (!oNewDefWin || oNewDefWin.closed) { 
		// Window already closed.... do nothing
	} else {
		// Close existing subwindow
		oNewDefWin.close()
	} // end if
	
	if (!oFlashDefWin || oFlashDefWin.closed) { 
		// Window already closed.... do nothing
	} else {
		// Close existing subwindow
		oFlashDefWin.close()
	} // end if
	
	if (!oGameDefWin || oGameDefWin.closed) { 
		// Window already closed.... do nothing
	} else {
		// Close existing subwindow
		oGameDefWin.close()
	} // end if
	
} // end ClosePopUpWindow

