/* *****************************************************************************
  
  windows.js

  (C) 2003, Colombiasoft Technologies Ltda. All rights reserved.

  Copy of any portion of this software is prohibited.

***************************************************************************** */

var csChildWin = null ;

function openChildWindow( url, width, height, resize, scrollbars )
{
	var top, left ;

	if ( screenObjectExists() )
	{
		top		= ( window.screen.availHeight - height ) / 2 ;
		left	= ( window.screen.availWidth  - width  ) / 2 ;
	} else {
		top = left = 50 ;
	}

	if ( csChildWin && !csChildWin.closed )
		csChildWin.close() ;

	csChildWin = window.open( url, "csChildWin",
		"toolbar=0,location=0,status=0,menubar=0,"+
		"scrollbars=" + (scrollbars ? 1 : 0 ) + "," +
		"resizable="  + (resize     ? 1 : 0 ) + "," +
		"width="+ width + ",height=" + height + "," +
		"top="  + top   + ",left="   + left ) ;

	csChildWin.focus() ;
}

function screenObjectExists()
{
	// Some browsers recognize it this way some others don't
	for ( var object in window )
		if ( object == "screen" )
			return true ;

	for ( var object in window.screen )
		if ( object == "availHeight" )
			return true ;

	return false ;
}

/* EOF */
