﻿function NameSearchControl( options )
{
	returnData = function( id, text )
	{
		if ( options.callBackJS.length > 0 )
		{
			var args =
			{
				"id": id,
				"text": text
			};

			var fn = new Function( "par", "return window.opener." + options.callBackJS + "(par)" );
			fn( args );
		}
		window.close();
	}
}

NameSearchControl.create = function( id, options )
{
	if ( !this._instances )
	{
		this._instances =
		{
		};
	}

	this._instances[ id ] = new NameSearchControl( options );
};

NameSearchControl.getInstance = function( id )
{
	return this._instances[ id ];
};