
/*
 *  File:	mc_openWindow.js
 *  Author:     Kim Yeav
 *  Contact:	kyeav@mei.memec.com	
 *  Date:	10/08/01
 *  Purpose:
 *  Function:	openWindow()
 *	Parameters:	none
 *	Returns:	
 *	Description:This function pop open the URL onto a new window.
 *              The height and width can be set in the HREF of the related JSP page.
 */

// Send users to the next page
function openWindow ()
{
	return true;
}


// Open a new window
function openWindow (URL , window_name , width , height)
{
	// URL = URL to open in new window
	// window_name = name of new window - default is QPOP
    	// width = width of new window, default is 400
    	// height = height of new window, default is 300
    	if (window_name == null) window_name = 'QPOP';
    	if (width == null) width = '300';
    	if (height == null) height = '200';
          
    	// Open the window
    	//var newWindow = window.open(URL , window_name , 'width='+width+',height='+height+',screenX=150,screenY=85,top=5,left=150');
	var newWindow = window.open(URL,window_name,'width='+width+',height='+height+',menubar=yes,toolbar=no,scrollbars=yes,resizable=no,left=150,top=20');
    	newWindow.focus();        // Bring window to front
}


// New Code- Emily
// Open a new window
function openWindow (URL , window_name , width , height , isResizable)
{
	// URL = URL to open in new window
	// window_name = name of new window - default is QPOP
    	// width = width of new window, default is 400
    	// height = height of new window, default is 300
    	if (window_name == null) window_name = 'QPOP';
    	if (width == null) width = '300';
    	if (height == null) height = '200';
          
    	// Open the window
    	//var newWindow = window.open(URL , window_name , 'width='+width+',height='+height+',screenX=150,screenY=85,top=5,left=150');
	var newWindow = window.open(URL,window_name,'width='+width+',height='+height+',menubar=yes,toolbar=no,scrollbars=yes,resizable='+isResizable+',left=150,top=20');
    	newWindow.focus();        // Bring window to front
}
//End New Code


// New Code- David Magalnick
// Open a new window
function openWindow (URL , window_name , width , height , isResizable, left, top)
{
	// URL = URL to open in new window
	// window_name = name of new window - default is QPOP
    	// width = width of new window, default is 400
    	// height = height of new window, default is 300
    	if (window_name == null) window_name = 'QPOP';
    	if (width == null) width = '300';
    	if (height == null) height = '200';
    	if (left == null) left = '150';
    	if (top == null) top = '20';
          
    	// Open the window
    	//var newWindow = window.open(URL , window_name , 'width='+width+',height='+height+',screenX=150,screenY=85,top=5,left=150');
	var newWindow = window.open(URL,window_name,'width='+width+',height='+height+',menubar=yes,toolbar=no,scrollbars=yes,resizable='+isResizable+',left='+left+',top='+top);
    	newWindow.focus();        // Bring window to front
}
//End New Code


// new code- Emily
function supressError()
{
    return true;
}

// new code
function loadMainWindow(URL)
{
    window.onerror = supressError;
	
	// new code
	if( ( window.opener.closed ) || ( window.opener == null ) )
	{
		// call function
		openNewWindow( URL );
		
	}
	else
	{
    	opener.location.href = URL;

		//bring the main window to the front and minimize the pop-up window
		opener.focus();
	}
}
//End New Code

// new code- Emily
// Open a new window
function openNewWindow( URL )
{
	// URL = URL to open in new window
	// window_name = name of new window - default is QPOP
    	// width = width of new window, default is 400
    	// height = height of new window, default is 300
    var window_name = 'NewWindow';
    	
	var newWindow = window.open(URL,window_name,'location=yes,menubar=yes,toolbar=yes,status=yes,scrollbars=yes,resizable=yes');
    	newWindow.focus();        // Bring window to front
}
// end new code - Emily


function updateParent(newURL)
{
	var serverPath = '';
//	var serverPath = 'http://prod.gws.memec.com';
		// set serverPath = absolute path to the server 
		// only if the location of the link destination is on a different 
		// server than this file
		// otherwise if everything is on the same server
		// leave serverPath = ''
		//
		// NOTE: do NOT put in the trailing slash
		// ie. http://www.yahoo.com
		// not http://www.yahoo.com/

	opener.document.location = serverPath + newURL;
}

//-----------------------------------------------------
// Open a new window from corporate level. 
// Used as of June/2003 by tabs in News, Locations, history
//-----------------------------------------------------
function openCorpWindow (URL , window_name)
{
	// Open the window
  var newWindow = window.open(URL,window_name);
  newWindow.focus();        // Bring window to front
}
