//This javascript source code was borrowed
//from D. Anderson to simulate modal behavior
//in web forms.

var myOpenWindow = new function()
{
	//============================================================================
	//	Members
	//============================================================================
	var _window			= null;
	var _passItem		= null;
	
	function _callback(){}
	
	//============================================================================
	//	Constructor
	//============================================================================
	
	
	//============================================================================
	//	Public Methods
	//============================================================================
	
	
	//============================================================================
	//
	//
	//============================================================================
	this.ReturnValue = function myReturnValue( value )
	{
		//_passItem = null;
		
		if( _callback )
		{
			this._callback( value );
		}
	}
	
	//============================================================================
	//
	//
	//============================================================================
	this.Open = function myOpen( Url, Features, Callback, PassItem, Name )
	{
		this._callback	= Callback;
		_passItem		= PassItem;
		
		if( ! Name )
		{
			Name = "OpenWindow";
		}
		_window = window.open( Url, Name, Features );
	}
	
	//============================================================================
	//
	//
	//============================================================================
	this.CheckWindow = function myCheckWindow()
	{
		try
		{
			_window.focus();
		}
		catch(e)
		{
			//alert( e.message );
		}
	}
	
	//============================================================================
	//
	//
	//============================================================================
	this.PassItem = function myPassItem()
	{
		return _passItem;
	}
	
	//============================================================================
	//
	//
	//============================================================================
	this.IsOpen = function myIsOpen()
	{
		if( _window )
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}
