//*********************************************************************************************************
// Copyright (c) 2007-2008 Honeywell, All Rights Reserved. This work contains 
// trade secrets and confidential material of Honeywell ACS,and its use or disclosure
// in whole or in part without explicit written permission of Honeywell is prohibited.
//
// Project Name          :   ECC B2B - Global Web Project (GWP)
// File Name             :   VFDExceptionHandler.js
// Author                :   Caritor (India) Pvt. Ltd
// Description           :   Exception Handler class
//							  
// Modification History  
//=========================================================================================================
// Modified by				Date			Version Number		Description  
//=========================================================================================================
// Caritor (India) Pvt.Ltd	18-Jul-2007		1.00				Initial Version	for 
//                                                              ITS-S-02-0002 RAS#3 CR#19		
//=========================================================================================================
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

var errorPage = "/Honeywell/AccountManager.aspx?Definition=ErrorHandler&ChannelID=&ReturnUrl=";
          
function EndRequestHandler(sender, args)
{
    var errorObject = args.get_error()
    if (errorObject != undefined)
    {
        if (errorObject.message != undefined 
            && errorObject.httpStatusCode != 12019 
            && errorObject.httpStatusCode != 0
            && errorObject.name != "Sys.WebForms.PageRequestManagerParserErrorException" 
            && errorObject.name != "Sys.WebForms.PageRequestManagerTimeoutException" 
            )
        {
            PageMethods.ThrowException(errorObject.message, SucceededCallback, FailedCallback);
        }
        args.set_errorHandled(true);
    }
}
            
// This is the callback function invoked if the Web service
// succeeded.
// It accepts the result object as a parameter.
function SucceededCallback(result, eventArgs)
{
    document.location.href = errorPage;
    
}

// This is the callback function invoked if the Web service
// failed.
// It accepts the error object as a parameter.
function FailedCallback(error)
{
    document.location.href = errorPage;
}
