
<!--

/* wfxErrorHandler Object */

function wfxErrorHandler() {
   this.checkErrors = __checkErrors;
}

function __checkErrors (aobj_dom)
{
	var lobj_error_nodes = aobj_dom.documentElement.childNodes(5).childNodes;
	
	if ( lobj_error_nodes.length > 0) 
	{
		//window.showModalDialog("ErrorDisplay.htm",aobj_dom,'dialogWidth:30; dialogHeight:28; status:0; help:0');
		
		var lobj_first_error_node_attr = aobj_dom.documentElement.childNodes(5).childNodes(0).attributes;
		
		var lobj_exception = new Error( lobj_first_error_node_attr(1).text, lobj_first_error_node_attr(2).text );
		
		HandleException( lobj_exception, true, "Redirected via __checkErrors in wfxErrorHandler.js", aobj_dom.xml );
	}
}


/* Exception Handler Functions */

function HandleException( lobj_exception, ab_show_dialog )
{

	var ls_xml = "";
	var ls_html = "";
	var i = 0;
	var lobj_fx = HandleException;
	var lb_show_dialog = true;	
	
	ls_xml += "<exception><client>"
		
	ls_xml += BuildBrowserInfoXML();
		
	ls_xml += BuildDocumentInfoXML();
	ls_xml += BuildScriptingEngineInfoXML();
	ls_xml += BuildExceptionInfoXML( lobj_exception );
	ls_xml += BuildCallStackInfoXML();	
	
	if ( document.all.item( "IncomingPageXML" )!= null )
	{
		if ( IncomingPageXML.documentElement != null )
		{
			ls_xml += IncomingPageXML.documentElement.selectSingleNode("secure").xml;
		}
		else
		{
			ls_xml += "<secure/>";
		}
	}
	else
	{
		ls_xml += "<secure/>";
	}
		
	li_argument_count = lobj_fx.arguments.length;
	ls_xml += "<custom>";
		
	for ( i = 2; ( i < li_argument_count ); i++ )
	{
		ls_xml += "<m>";
		ls_xml += lobj_fx.arguments[ i ];
		ls_xml += "</m>";
	}
			
	ls_xml += "</custom></client></exception>"
	
	ls_html = SendReceiveXML( ls_xml );
	
	if ( ab_show_dialog != null )
	{
		lb_show_dialog = ab_show_dialog;
	}
	
	if ( lb_show_dialog ) 
	{	
		window.showModalDialog("wfx_uiv_exception_viewer.asp", ls_html, "dialogHeight: 400px; dialogWidth: 800px; edge: Raised; center: Yes; help: No; resizable: No; status: No; scroll: No");
	}
	
	return( ls_html );	
}


function SendReceiveXML( as_xml )
{
	var lobj_http= null;
	var ls_returned_html ="";

	try   
	{
		lobj_http = new ActiveXObject("Microsoft.XMLHTTP");
		lobj_http.Open( "POST", "wfx_ret_exception_handler.asp", false );
		lobj_http.send( as_xml );
   
		//Receive the new string containing our data
		ls_returned_html = lobj_http.responseText;
	}
	
	finally
	{
		lobj_http = null;
	} 
	
   return( ls_returned_html );
}

function BuildExceptionInfoXML( aobj_exception )
{

	var ls_xml = "<exception>";
			
	if ( typeof( aobj_exception ) == "object" )
	{
		ls_xml += "<number>" + (aobj_exception.number & 0xFFFF) + "</number>";
		ls_xml += "<name>" + aobj_exception.name + "</name>";
		ls_xml += "<message>" + aobj_exception.message + "</message>";
		ls_xml += "<description>" + aobj_exception.description + "</description>";
	}	
	else
	{
		ls_xml += "<number>-1</number>";
		ls_xml += "<name></name>";
		ls_xml += "<message>" + aobj_exception + "</message>";
		ls_xml += "<description>" + aobj_exception + "</description>";
	}
	
	ls_xml += "</exception>";		
	
	return( ls_xml );
}


function BuildScriptingEngineInfoXML()
{

	var ls_xml = "<scripting>";
			
	ls_xml += "<engine>" + ScriptEngine() + "</engine>";
	ls_xml += "<version>" + ScriptEngineMajorVersion() + "." + ScriptEngineMinorVersion() + "." + ScriptEngineBuildVersion() + "</version>";
	ls_xml += "</scripting>";
		
	return( ls_xml );
}


function BuildBrowserInfoXML()
{
	var ls_xml = "<browser>";
	
	ls_xml += "<appCodeName>" + navigator.appCodeName + "</appCodeName>";
	ls_xml += "<appMinorVersion>" + navigator.appMinorVersion + "</appMinorVersion>";
	ls_xml += "<appName>"+ navigator.appName + "</appName>";
	ls_xml += "<appVersion>" + navigator.appVersion + "</appVersion>";
	ls_xml += "<browserLanguage>"+ navigator.browserLanguage + "</browserLanguage>";
	ls_xml += "<cookieEnabled>" + navigator.cookieEnabled + "</cookieEnabled>";
	ls_xml += "<cpuClass>" + navigator.cpuClass + "</cpuClass>";
	ls_xml += "<javaEnabled>" + navigator.javaEnabled() + "</javaEnabled>";
	ls_xml += "<onLine>" + navigator.onLine + "</onLine>";
	ls_xml += "<platform>" + navigator.platform + "</platform>";
	ls_xml += "<plugins>" + navigator.plugins + "</plugins>";
	ls_xml += "<systemLanguage>" + navigator.systemLanguage + "</systemLanguage>";
	ls_xml += "<taintEnabled>" + navigator.taintEnabled() + "</taintEnabled>";
	ls_xml += "<userAgent>" + navigator.userAgent + "</userAgent>";
	ls_xml += "<userLanguage>" + navigator.userLanguage + "</userLanguage>";
	ls_xml += "<userProfile>"+ navigator.userProfile + "</userProfile>";
	ls_xml += "</browser>"
		
	return( ls_xml );
}

function BuildDocumentInfoXML()
{
	var ls_xml = "<document>";

	ls_xml += "<protocol>" + document.protocol + "</protocol>";
	ls_xml += "<title>" + document.title + "</title>";
	ls_xml += "<url>" + document.url + "</url>";
	ls_xml += "<URLUnencoded>" + document.URLUnencoded + "</URLUnencoded>";
	ls_xml += "</document>"
		
	return( ls_xml );
}

function BuildCallStackInfoXML()
{
	var lobj_fx = BuildCallStackInfoXML.caller;
	var li_argument_count = 0;
	var i = 0;
	var lobj_argument = null;
	var ls_argument_type="";
	var ls_fx_name = "";
	var ls_xml = "<call_stack>";
	
	ls_fx_name = FxName( lobj_fx.toString() );
	
	if (ls_fx_name == "HandleException" )
	{
		lobj_fx = lobj_fx.caller;
		
		ls_fx_name = FxName( lobj_fx.toString() );
		
		if (ls_fx_name == "__checkErrors" )
		{
			lobj_fx = lobj_fx.caller;
		}
	}
	
	
	while ( lobj_fx != null )
	{
		ls_fx_name = FxName( lobj_fx.toString() );
		
		ls_xml += "<" + ls_fx_name + ">";
				
		li_argument_count = lobj_fx.arguments.length;
		
		for ( i = 0; ( i < li_argument_count ); i++ )
		{
			lobj_argument = lobj_fx.arguments[ i ];
			ls_argument_type = typeof( lobj_argument ) ;
			
			ls_xml += "<a type='" + ls_argument_type + "'>";
				
			if ( lobj_argument == null )
			{
				ls_xml += "null" ;
			}
			else
			{
				
				switch( ls_argument_type )
				{
					case "string":
						ls_xml += lobj_argument;
						break;
					default:
						ls_xml += lobj_argument.toString() ;
						break;
				}		
			}
				 
			ls_xml += "</a>";
		}
		


		ls_xml += "</" + ls_fx_name + ">";	
		lobj_fx = lobj_fx.caller;
	}		
	
	ls_xml += "</call_stack>";
	
	return( ls_xml );
}

function FxName( as_syntax )
{
	var ls_syntax;
	var ll_space_loc = -1;
	var ll_left_paren_loc = -1;
		
	if ( as_syntax ==  null ) 
		return( "" );
	
	if ( as_syntax.length < 1 ) 
		return( "" );
		
	ll_space_loc = as_syntax.indexOf( " " );
	ll_left_paren_loc = as_syntax.indexOf( "(" );
		
	ls_syntax = as_syntax.slice( ll_space_loc + 1, ( ll_left_paren_loc ) );
		
	ls_syntax= ls_syntax.replace(/^\s*/,"").replace(/\s*$/,"");
	
	return( ls_syntax );
}
//-->
