/*
 * product:	Tikit Classification API
 * copyright:	Tikit Limited, 2002-2003
 * abstract:	Provides easy to call functions to access the Tikit Classification API
 *
 *	version	author	date		id		comment
 *
 *	2.5.0	mxj		13/07/2004	1738	Allow quick closure of popups
 *	2.5.0	mxj		18/06/2004	1372	Simplify  integration for application servers
 *	2.5.0	mxj		13/05/2004	1503	Provide seamless xml support
 *  2.5.0	mxj		16/04/2004	1640	Pass the xslParam, property Definitions

 *  2.0.7	sr		2003-01-08	1596	handle absolute paths for ctServerGet()

 *  2.0.4	mxj		16/08/2003	1403	Add configurable searching options (web only)
 *	2.0.4	mxj		10/11/2003	1402	Descendant and Synonym Depth settings
 *	2.0.4	mxj		10/11/2003	1381	Callback functionality
 *
 *	2.0.2	sr		2003-apr-17	1349	Provide core support for closing the classification tool
 *	2.0.2	sr		2003-feb-13	1346	Added ctClose() function	
 */

	var m_wCT = null;	// Used to keep hold of the popup window so it can be forced to the top

	function ctClose()
	{
		try
		{
			m_wCT.close();
		}
		catch (e)
		{
			// alert( e.description );
		}
	}

	//MXJ 2.0.4 Added 'idControl', 'descendantDepth' and resultList
	function lookupCT( idStream, hierarchy, selected, skin, mode, field, idControl, descendantDepth, resultList, embedded, included, path, xslParams, propertyDef, xslPath, appPath )
	{
		//MXJ 2.0.4 Ensure descendantDepth is blank if not passed in
		if (descendantDepth == null){descendantDepth =''}
		if (included == null ) included = '';
		if (path == null) path = '';

		// Wraps the call to the Classification Tool HTML Control in a new window
		//	2003-01-08	1596		sr			2.0.7	handle absolute paths for ctServerGet()

		//MXJ Build URL
		var ctURL = path + 'cm/cm.asp?idstream='+idStream+'&hierarchy='+hierarchy+'&field='+field+'&skin='+skin+'&mode='+mode+'&included='+included+'&selected='+selected+'&idcontrol='+idControl+'&descendantDepth='+descendantDepth+'&resultList='+resultList+'&embedded='+embedded+'&propertydef='+propertyDef+'&xslparam='+xslParams+'&xslpath='+xslPath+'&servPath='+path+'&appPath='+appPath

		// mxj	1372	Pass the fully qualified path to cmCore.asp
		m_wCT = window.open( appPath + 'cmCore.asp?url=' + escape(ctURL), 'ct', 'height=470,width=355,resizable=yes,scrollbars=no,status=yes,toolbar=no,menubar=no,location=no' )
		window.setTimeout("lookupCTTimeout()", 10);
	}

	function lookupCT2( idStream, hierarchy, selected, skin, mode, field, idControl, descendantDepth, resultList, embedded, included, path, xslParams, propertyDef, xslPath, appPath )
	{
		//MXJ 2.0.4 Ensure descendantDepth is blank if not passed in
		if (descendantDepth == null){descendantDepth =''}
		if (included == null ) included = '';
		if (path == null) path = '';

		// Wraps the call to the Classification Tool HTML Control in a new window
		//	2003-01-08	1596		sr			2.0.7	handle absolute paths for ctServerGet()

		//MXJ Build URL
		var ctURL = path + 'cm/cm.asp?idstream='+idStream+'&hierarchy='+hierarchy+'&field='+field+'&skin='+skin+'&mode='+mode+'&included='+included+'&selected='+selected+'&idcontrol='+idControl+'&descendantDepth='+descendantDepth+'&resultList='+resultList+'&embedded='+embedded+'&propertydef='+propertyDef+'&xslparam='+xslParams+'&xslpath='+xslPath+'&servPath='+path+'&appPath='+appPath

		// mxj	1372	Pass the fully qualified path to cmCore.asp
		m_wCT = window.open( appPath + 'cmCore.asp?url=' + escape(ctURL), 'ct' )
		window.setTimeout("lookupCTTimeout()", 10);
	}
	
	function lookupCTTimeout()
	{
		// Makes the Classification Tool HTML Control the top window
		m_wCT.focus();
	}

	function ByRefString(strValue) 
	{
		this.stringValue = strValue;
	}

	ByRefString.prototype.toString = function()
	{
		return this.stringValue;
	}
	
	