<%
'SUBROUTINES DEFINED:
'"""""""""""""""""""
'SetupSessionVariables(AuthUser)		Sets up the session variables
'GetSessionStatusStr()					Returns the error string associated with the session error code
'SetError(Message)						Sets the text of the main error message
'SetReason(Message)						Sets the text of the reason paragraph
'AddFix(Message)						Adds an item to the bulleted list of suggestions
'Check_Browser_Capabilities()			Sets error if the Client browser lacks Tables and JavaScript support
'Invalid_Password()						Sets an error due to an invalid password
'IsConfID()								Sets error if the Conference ID is not set (inConfID)
'ValidateMeetingID()					Sets error if the DCS Meeting ID is not valid (inMeetingID)
'Verify_ConfLocator()					Verifies ConfLocator points to the Conference Locator
'DisplayErrorPage()						Setup the error page when we have an error
'
'FUNCTIONS DEFINED:
'"""""""""""""""""
'CheckSetError(Source, Description) Checks for error values in Result/Err and adds error messages if appropriate
'
' ================================ CONSTANTS =================================================
'ERROR CONSTANTS:
'C++ returns HRESULTS as 4-byte signed ints, so the bit pattern
'0x81000203 comes out as a negative number.
'VBScript also uses 4-byte signed ints, so assigning the bit patterns
'as below makes for better readability while still giving the 
'same negative numbers.
'If VBScript ever changes to use ints larger than 4 bytes, the
'bit patterns below will be interpreted as positive numbers and
'will have to be changed to explicitly reference the negative
'number returned by C++.
CONST E_CMS_EVENTMANAGER_NOT_INITIALIZED                = &H8004100A
CONST E_CMS_CONFERENCE_NOT_SCHEDULED                    = &H8004100B
CONST E_CMS_CONFERENCE_NOT_STARTED                      = &H8004100C
CONST E_CMS_CONFERENCE_NOT_RUNNING                      = &H8004100D
CONST E_CMS_CONFERENCE_NOT_FOUND                        = &H8004100E
CONST E_CMS_INVALID_CONFERENCE_PASSWORD                 = &H8004100F
CONST E_CMS_ANONYMOUS_USER_DENIED_ACCESS                = &H80041010
CONST E_CMS_USER_DENIED_ACCESS                          = &H80041011
CONST E_CMS_CTP_JOIN_REQUEST_FAILED                     = &H80041012
CONST E_CMS_PROVIDER_NOT_INITIALIZED                    = &H80041013
CONST E_CMS_PROVIDER_NOT_FOUND                          = &H80041014
CONST E_CMS_E_CONFERENCE_NOT_EXIST                      = &H80041015
CONST E_CMS_RECURRING_CONFERENCE_NOT_FOUND              = &H80041016
CONST E_CMS_NOT_HOST_SERVER                             = &H80041017
CONST E_CMS_RECURRING_INSTANCE_NOT_WITHIN_TIME_BOUND    = &H80041018
CONST E_CMS_AMBIGUOUS_RECURRING_JOIN                    = &H80041019
CONST E_CMS_TIME_EXTENSIONS_NOT_ALLOWED                 = &H8004101B
CONST E_CMS_RESOURCE_EXTENSIONS_NOT_ALLOWED             = &H8004101C
CONST E_CMS_SERVER_NOT_INITIALIZED                      = &H80041037
CONST E_CMS_PROFILE_STORE_NOT_INITIALIZED               = &H80041038
CONST E_CMS_SHUTTING_DOWN                               = &H4101E

CONST E_DCS_NO_MCUS_AVAILABLE                           = &H8004F001
CONST E_DCS_CONFERENCE_NOT_RUNNING                      = &H8004F002
CONST E_DCS_CONFERENCE_ALREADY_ENDED                    = &H8004F003
CONST E_DCS_ACCESS_DENIED_CAPACITY_LIMIT                = &H8004F004
CONST E_DCS_NO_PROXY_MCUS_AVAILABLE                     = &H8004F005
CONST E_DCS_NO_INTERNET_MCUS_AVAILABLE                  = &H8004F006
CONST E_DCS_NOT_RUNNING                                 = &H8004F007
CONST E_DCS_NOT_INIT                                    = &H8004F008

CONST E_NETMEETING_ERRORS_MASK                          = &H80040300
CONST E_NETMEETING_INVITE_FAILURE                       = &H8004036A
CONST E_NETMEETING_INVITE_TIMEOUT                       = &H80040372

CONST E_PKCS7_NO_CERT_STORE                             = &H80043000
CONST E_SESSION_UNAVAILABLE                             = &H80043001
CONST E_NO_DISPLAY_STATE                                = &H80043002
CONST E_UNSUPPORTED_TABLES_BROWSER                      = &H80043003
CONST E_UNSUPPORTED_JAVASCRIPT_BROWSER                  = &H80043004

CONST E_ACCESS_DENIED                                   = 70 '&H80070005 comes across as error 70 if returned
CONST E_ACCESS_DENIED_HRESULT                           = &H80070005 'if passed back as a result
CONST E_SERVER_CREATE_OBJECT                            = &H800401F3 'Server.CreateObject() error
CONST NM_E_NOT_ACTIVE                                   = &H81000203 'NetMeeting was closed since last use
CONST E_NO_GLOBAL_CONF_CALENDAR                         = &H80010105
CONST E_DSGETSITENAME_NO_SITE                           = &H8007077F
CONST E_MANUAL_JOIN_INSTRUCTIONS                        = &H80040100
CONST E_CMS_RESTARTED                                   = &H1CE

CONST E_MCU_HANG                                        = &H800706BA
CONST E_MCU_NO_SERVER_CERTIFICATE                       = &H80070546

'DISPLAY STATE CONTANTS:
'These define the various display states that can be used
'The quotes are required because the state is passed as a string
'The DCS programmatically uses {0,7,8} so those cannot easily be changed
CONST DISPLAY_JOIN                      = "0"
CONST DISPLAY_JOIN_PASSWORD             = "6"
CONST DISPLAY_PREJOIN                   = "7"
CONST DISPLAY_POSTJOIN                  = "8"
CONST DISPLAY_NO_MADCAP_SERVERS         = "9"
CONST DISPLAY_TOO_MANY_USERS            = "10"
CONST DISPLAY_ALL_MADCAP_SERVERS_FAILED = "11"
CONST DISPLAY_NO_MADCAP_SERVERS_MATCH_SCOPE = "12"
CONST DISPLAY_NO_MADCAP_SCOPES_FOUND    = "13"
CONST DISPLAY_NO_SCOPES_IN_RESOURCE     = "14"
CONST DISPLAY_MAX_JOIN_TYPES            = "14"
CONST DISPLAY_MULTICAST_CLIENT          = "15"
CONST DISPLAY_H323_CLIENT               = "16"
CONST DISPLAY_OLDER_H323_CLIENT         = "51"
CONST DISPLAY_NO_AUDIOVIDEO_CLIENT      = "52"
CONST DISPLAY_NO_AUDIOVIDEO_ACTIVEX     = "53"

CONST DISPLAY_WELCOME                   = "11"
CONST DISPLAY_RECURRING                 = "14"
CONST DISPLAY_AGENDA                    = "17"
CONST DISPLAY_MODIFY                    = "18"
CONST DISPLAY_MAX_NO_JOIN_TYPES         = "19"

CONST DISPLAY_MIN_ERR_TYPES             = "20"
CONST DISPLAY_ERR_CONFID                = "22"
CONST DISPLAY_ERR_CTP_STARTUP           = "23"
CONST DISPLAY_ERR_VALUE                 = "38"
CONST DISPLAY_MAX_ERR_TYPES             = "39"

'SESSION VARIABLE CONSTANTS
CONST SESSION_CONFPROFILE            = "ConfProfile"
CONST SESSION_CONFLOCATOR            = "ConfLocator"
CONST SESSION_CMSZONE                = "CMSZone"
CONST SESSION_CMSCONFIG              = "CMSConfig"
CONST SESSION_MEETINGID              = "MeetingID"
CONST SESSION_RESULT                 = "Result"
CONST SESSION_ERRNUMBER              = "ErrNumber"
CONST SESSION_ERRSOURCE              = "ErrSource"
CONST SESSION_ERRDESCRIPTION         = "ErrDescription"
CONST SESSION_STATUS                 = "Status"
CONST SESSION_ATTENDEE               = "Attendee"
CONST SESSION_PASSWORD				 = "Password"

CONST L_Page_HTMLTitle       = "Microsoft Exchange Conferencing"
CONST L_ErrorPage_HTMLTitle  = "Microsoft Exchange Conferencing - Error"
CONST L_TryTheFollowing_Text = "Please try the following:"

'Session debugging/status information strings (must stay the same as global.asa)
CONST L_OK_Text                 = "OK"
CONST L_GetConfLocator_Text     = "Unable to get the conference locator from the conference management zone"
CONST L_GetZone_Text            = "Unable to locate the zone from the conference management configuration object"
CONST L_CreateObject_Text       = "Unable to initialize the conference management configuration object"
CONST L_Unknown_Text            = "Unknown"
CONST L_Uninitialized_Text      = "Uninitialized"

'Common strings
CONST L_MCUProxyInvite_ErrorMessage     = "If you are trying to join the conference through a proxy server, the Data Conferencing Service might be unable to connect to your client program.  To manually connect your data conferencing client, use the following information:"
CONST L_ManualJoinServer_ErrorMessage   = "Data Conferencing Server: "
CONST L_ManualJoinID_ErrorMessage       = "Conference ID: "
CONST L_ManualJoinPassword_ErrorMessage = "Conference Password: "
CONST L_NetMeetingInviteTitle_ErrorMessage  = "Data Conference Invitation Failure"
CONST L_NetMeetingInviteReason_ErrorMessage = "The Data Conferencing Service cannot invite your T.120 data conferencing client program (for example, Microsoft NetMeeting) to the conference."
CONST L_NetMeetingInviteFix1_ErrorMessage   = "Verify that you have started your conferencing client program, and then try to join the conference again."
CONST L_LinkToConferenceListsFix_ErrorMessage  = "Select a current conference from the "
CONST L_LinkToConferenceListsFix2_ErrorMessage = "list of available meetings."

CONST PR_SUBJECT             = "subject"   'Defines the subject property code for user properties
CONST PR_BODY                = "268435487" 'Defines the body text property code for user properties
CONST PR_BODY_HTML           = "269680670" 'Defines the body text (in HTML) property code for user properties
CONST MAPI_RESOURCE          = "MAPI"      'Defines the resource used when getting user properties

CONST CONF_ID_CODED_LENGTH   = 255 'Length of the Base-64 encoded conference ID
CONST CONF_ID_DECODED_LENGTH = 22 'Conference ID must be 22 digits

' ================================ VARIABLES =================================================
'ERROR VARIABLES:
DIM ErrorMsg        'Holds the main error message (displayed at the top of the error page)
DIM Reason          'Holds the paragraph description of the error (displayed below the main message)
DIM Fixes()         'Holds the suggested remedies (displayed in the bulleted list below the paragraph)
DIM HiddenError     'Holds the system-level error message (displayed in small print at the bottom)
DIM ErrorCount      'Counts the errors encountered (0 or 1)
DIM Result          'Global variable used for function return values
DIM SessionErr(5)   'Holds the error messages that are defined in the session variables code to allow localization

' =============================== INITIALIZATION ==============================================
ErrorMsg        = ""
HiddenError     = ""
Reason          = ""
ErrorCount      = 0
Result          = 0
SessionErr(0)   = L_OK_Text
SessionErr(1)   = L_GetConfLocator_Text
SessionErr(2)   = L_GetZone_Text
SessionErr(3)   = L_CreateObject_Text
SessionErr(4)   = L_Unknown_Text
SessionErr(5)   = L_Uninitialized_Text
REDIM Fixes(0)                          'Puts the array Fixes in a known state

' ================================ FUNCTIONS =================================================
'== SUB: Sets up the session variables (GetSessionStatusStr() is used for SESSION_STATUS strings)
SUB SetupSessionVariables(AuthUser)
    ON ERROR RESUME NEXT

    DIM CMSConfiguration
    DIM CMSZone
    DIM ConfLocator
    
    Session(SESSION_RESULT)          = 0
    Session(SESSION_ERRNUMBER)       = 0
    Session(SESSION_ERRSOURCE)       = 0
    Session(SESSION_ERRDESCRIPTION)  = 0
    Session(SESSION_STATUS)          = 5 'L_Uninitialized_Text
    
    'Create the CMS Configuration object (dllhost will create this from xcmsadm)
    SET CMSConfiguration = Server.CreateObject("XCMSCOM.CMSConfiguration")
    
    IF (0 <> Err.Number) THEN
        Session(SESSION_ERRNUMBER)      = Err.Number
        Session(SESSION_ERRSOURCE)      = Err.Source
        Session(SESSION_ERRDESCRIPTION) = Err.Description
        Err.Clear()
        Session(SESSION_STATUS)         = 3 'L_CreateObject_Text
        EXIT SUB
    END IF
    
    SET Session(SESSION_CMSCONFIG) = CMSConfiguration 'Save the singleton CMSConfig for up to 20 mins
    
    'Create the CMS Zone object (dllhost will create this from xcmsadm)
    CALL CMSConfiguration.GetZone("", CMSZone)
    
    IF (0 <> Err.Number) THEN
        Session(SESSION_RESULT)         = Err.Number
        Session(SESSION_ERRNUMBER)      = Err.Number
        Session(SESSION_ERRSOURCE)      = Err.Source
        Session(SESSION_ERRDESCRIPTION) = Err.Description
        Err.Clear()
        Session(SESSION_STATUS)         = 2 'L_GetZone_Text
        EXIT SUB
    END IF
    
    SET Session(SESSION_CMSZONE) = CMSZone 'Save the CMS Zone object for use later
    
    'Create the Conference Locator object (dllhost will create this from the xconfmgr service)
    CALL CMSZone.GetConferenceLocator(ConfLocator)
    
    IF (0 <> Err.Number) THEN
        Session(SESSION_RESULT)         = Err.Number
        Session(SESSION_ERRNUMBER)      = Err.Number
        Session(SESSION_ERRSOURCE)      = Err.Source
        Session(SESSION_ERRDESCRIPTION) = Err.Description
        Err.Clear()
        Session(SESSION_STATUS)         = 1 'L_GetConfLocator_Text
        EXIT SUB
    END IF

	Session(SESSION_ATTENDEE)		 = AuthUser
	    
    SET Session(SESSION_CONFLOCATOR) = ConfLocator 'Save the Conference Locator for use later
    Session(SESSION_STATUS)          = 0 'L_OK_Text
END SUB

'== SUB: Creates the session status string that we use on the bottom of the error pages
FUNCTION GetSessionStatusStr(errVal)
    IF (errVal >= 0 AND errVal <= 5) THEN
        GetSessionStatusStr = SessionErr(errVal)
    ELSE
        GetSessionStatusStr = errVal
    END IF
END FUNCTION

'== SUB: Sets the text of the main error message
SUB SetError(Message, Value, Source, Description)
    IF (0 = ErrorCount) THEN
        ErrorCount  = ErrorCount + 1
        ErrorMsg    = ErrorMsg & Message
        HiddenError = HiddenError & Source & " Error #" & Hex(Value) & ": " & Description & vbNewLine
    END IF
END SUB

'== SUB: Sets the text of the reason paragraph
SUB SetReason(Message)
    Reason = Message
END SUB

'== SUB: Adds an item to the bulleted list of suggestions
SUB AddFix(Message)
    DIM NewSize
    
    NewSize = UBound(Fixes) + 1
    REDIM PRESERVE Fixes(NewSize)
    
    Fixes(NewSize) = Message
END SUB

'== FUNCTION: Checks for error values in Result/Err and adds error messages if appropriate
FUNCTION CheckSetError(ResultSource, ResultDescription)
    DIM Value, Source, Description
    
    IF (0 <> Err.Number) THEN
        Value       = Err.Number
        Source      = Err.Source & " / [" & ResultSource & "]"
        Description = Err.Description & " / [" & ResultDescription & "]"
        Err.Clear()
    ELSEIF (0 <> Result) THEN
        IF (IsNumeric(Result)) THEN
            Value = CDbl(Result)
        ELSE
            Value = Result
        END IF
        Source      = ResultSource
        Description = ResultDescription
        Result      = 0
    ELSE
        CheckSetError = FALSE
        EXIT FUNCTION
    END IF

    'Bitwise-AND to detect all NetMeeting errors
    IF (E_NETMEETING_ERRORS_MASK = (E_NETMEETING_ERRORS_MASK AND Value)) THEN

        IF (E_NETMEETING_INVITE_FAILURE = Value) THEN
            
            CALL SetError(L_NetMeetingInviteTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_NetMeetingInviteReason_ErrorMessage)
            CALL AddFix(L_NetMeetingInviteFix1_ErrorMessage)
            CALL AddFix(L_MCUProxyInvite_ErrorMessage)
            CALL AddFix(L_ManualJoinServer_ErrorMessage & Session("MCUAddress"))
            CALL AddFix(L_ManualJoinID_ErrorMessage & Request.QueryString("ID"))
            CALL AddFix(L_ManualJoinPassword_ErrorMessage & Session(SESSION_PASSWORD))
        ELSEIF (E_NETMEETING_INVITE_TIMEOUT = Value) THEN
            CONST L_NetMeetingInviteTimeoutTitle_ErrorMessage  = "Data Conference Invitation Timeout"
            CONST L_NetMeetingInviteTimeoutReason_ErrorMessage = "The invitation sent by the data conferencing server expired while the server was trying to invite your conferencing client program (for example, Microsoft NetMeeting) to the conference."
            CONST L_NetMeetingInviteTimeoutFix1_ErrorMessage   = "Rejoin the conference and accept the server's invitation. You may need to bring the invitation to the front; it may be hidden behind the active window on your desktop."
            
            CALL SetError(L_NetMeetingInviteTimeoutTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_NetMeetingInviteTimeoutReason_ErrorMessage)
            CALL AddFix(L_NetMeetingInviteTimeoutFix1_ErrorMessage)
            CALL AddFix(L_MCUProxyInvite_ErrorMessage)
            CALL AddFix(L_ManualJoinServer_ErrorMessage & Session("MCUAddress"))
            CALL AddFix(L_ManualJoinID_ErrorMessage & Request.QueryString("ID"))
            CALL AddFix(L_ManualJoinPassword_ErrorMessage & Session(SESSION_PASSWORD))
        ELSE
            CONST L_NetMeetingMaskTitle_ErrorMessage  = "NetMeeting Conflict"
            CONST L_NetMeetingMaskReason_ErrorMessage = "NetMeeting is taking control of resources on your computer, or it is otherwise functioning improperly."
            CONST L_NetMeetingMaskFix1_ErrorMessage   = "Shut down other video, audio, or network programs that may conflict with NetMeeting."
            
            CALL SetError(L_NetMeetingMaskTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_NetMeetingMaskReason_ErrorMessage)
            CALL AddFix(L_NetMeetingMaskFix1_ErrorMessage)
            CALL AddFix(L_MCUProxyInvite_ErrorMessage)
            CALL AddFix(L_ManualJoinServer_ErrorMessage & Session("MCUAddress"))
            CALL AddFix(L_ManualJoinID_ErrorMessage & Request.QueryString("ID"))
            CALL AddFix(L_ManualJoinPassword_ErrorMessage & Session(SESSION_PASSWORD))
        END IF

        EXIT FUNCTION
    END IF

    SELECT CASE Value
        CASE E_CMS_EVENTMANAGER_NOT_INITIALIZED,E_CMS_SERVER_NOT_INITIALIZED
            CONST L_EventManagerNotInitializedTitle_ErrorMessage  = "Server Not Initialized"
            CONST L_EventManagerNotInitializedReason_ErrorMessage = "The Exchange Conferencing Service is starting and has not yet completed this process."
            CONST L_EventManagerNotInitializedFix1_ErrorMessage   = "Wait a few minutes, and then try again."
            
            CALL SetError(L_EventManagerNotInitializedTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_EventManagerNotInitializedReason_ErrorMessage)
            CALL AddFix(L_EventManagerNotInitializedFix1_ErrorMessage)
        
        CASE E_CMS_PROFILE_STORE_NOT_INITIALIZED
            CONST L_ServerOrProfileStoreNotInitializedTitle_ErrorMessage    = "Server Store Not Initialized"
            CONST L_ServerOrProfileStoreNotInitializedReason_ErrorMessage   = "The Exchange Conferencing Server is not initialized."
            CONST L_ProfileStoreNotInitializedFix1_ErrorMessage             = "Contact your system administrator.  The conference calendar mailbox store may be unavailable."
                        
            CALL SetError(L_ServerOrProfileStoreNotInitializedTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_ServerOrProfileStoreNotInitializedReason_ErrorMessage)
            CALL AddFix(L_ProfileStoreNotInitializedFix1_ErrorMessage)

        CASE E_CMS_CONFERENCE_NOT_RUNNING
            CONST L_ConferenceNotRunningCMSTitle_ErrorMessage  = "Conference Not Running"
            CONST L_ConferenceNotRunningCMSReason_ErrorMessage = "The conference you tried to access is not ready or a conferencing technology provider did not allow the conference to start."
            CONST L_ConferenceNotRunningCMSFix1_ErrorMessage   = "Wait a few minutes, and then try again."
            
            CALL SetError(L_ConferenceNotRunningCMSTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_ConferenceNotRunningCMSReason_ErrorMessage)
            CALL AddFix(L_ConferenceNotRunningCMSFix1_ErrorMessage)
            CALL AddFix(L_LinkToConferenceListsFix_ErrorMessage & "<A HREF=""list.asp"">" & L_LinkToConferenceListsFix2_ErrorMessage & "</A>")

        CASE E_CMS_CONFERENCE_NOT_SCHEDULED
            CONST L_ConferenceNotScheduledTitle_ErrorMessage  = "Conference Not Scheduled"
            CONST L_ConferenceNotScheduledReason_ErrorMessage = "This conference (determined by the meeting ID in the URL) was not scheduled by the Exchange Conferencing Service."
            CONST L_ConferenceNotScheduledFix1_ErrorMessage   = "The conference may have been deleted, or the conference ID may be corrupt."
            CONST L_ConferenceNotScheduledFix2_ErrorMessage   = "Contact the meeting organizer or your system administrator."
            
            CALL SetError(L_ConferenceNotScheduledTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_ConferenceNotScheduledReason_ErrorMessage)
            CALL AddFix(L_ConferenceNotScheduledFix1_ErrorMessage)
            CALL AddFix(L_ConferenceNotScheduledFix2_ErrorMessage)
            CALL AddFix(L_LinkToConferenceListsFix_ErrorMessage & "<A HREF=""list.asp"">" & L_LinkToConferenceListsFix2_ErrorMessage & "</A>")
        
        CASE E_CMS_CONFERENCE_NOT_STARTED
            CONST L_ConferenceNotStartedTitle_ErrorMessage  = "Conference Not Started"
            CONST L_ConferenceNotStartedReason_ErrorMessage = "The conference is starting but has not yet completed the startup process."
            CONST L_ConferenceNotStartedFix1_ErrorMessage   = "Wait a few minutes, and then try again."
            
            CALL SetError(L_ConferenceNotStartedTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_ConferenceNotStartedReason_ErrorMessage)
            CALL AddFix(L_ConferenceNotStartedFix1_ErrorMessage)
            CALL AddFix(L_LinkToConferenceListsFix_ErrorMessage & "<A HREF=""list.asp"">" & L_LinkToConferenceListsFix2_ErrorMessage & "</A>")

        CASE E_CMS_CONFERENCE_NOT_FOUND,E_CMS_RECURRING_INSTANCE_NOT_WITHIN_TIME_BOUND,E_CMS_AMBIGUOUS_RECURRING_JOIN,E_CMS_E_CONFERENCE_NOT_EXIST,1 'S_FALSE
            CONST L_ConferenceNotFoundTitle_ErrorMessage  = "Conference Not Found"
            CONST L_ConferenceNotFoundReason_ErrorMessage = "The Conference Management Service cannot find the conference you are trying to join."
            CONST L_ConferenceNotFoundFix1_ErrorMessage   = "If the conference was recently scheduled, wait a few minutes, and then try again."
            CONST L_ConferenceNotFoundFix2_ErrorMessage   = "Contact the conference organizer; the conference may have been canceled."
            CONST L_ConferenceNotFoundFix3_ErrorMessage   = "Verify that the meeting ID displayed in the URL of your browser is the same as your conference's meeting ID."
            CONST L_ConferenceNotFoundFix4_ErrorMessage   = "If this is a recurring conference, there may have been problems resolving the individual occurrences."
            
            CALL SetError(L_ConferenceNotFoundTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_ConferenceNotFoundReason_ErrorMessage)
            CALL AddFix(L_ConferenceNotFoundFix1_ErrorMessage)
            CALL AddFix(L_ConferenceNotFoundFix2_ErrorMessage)
            CALL AddFix(L_ConferenceNotFoundFix3_ErrorMessage)
            CALL AddFix(L_ConferenceNotFoundFix4_ErrorMessage)
            CALL AddFix(L_LinkToConferenceListsFix_ErrorMessage & "<A HREF=""list.asp"">" & L_LinkToConferenceListsFix2_ErrorMessage & "</A>")

        CASE E_CMS_SHUTTING_DOWN
            CONST L_ConfServerShuttingDownTitle_ErrorMessage  = "Conference Management Service Shutting Down"
            CONST L_ConfServerShuttingDownReason_ErrorMessage = "The Conference Management Service is shutting down."
            CONST L_ConfServerShuttingDownFix1_ErrorMessage   = "Wait a few minutes for the service to restart so that the conference can resume."
            CONST L_ConfServerShuttingDownFix2_ErrorMessage   = "Contact your system administrator."
            
            CALL SetError(L_ConfServerShuttingDownTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_ConfServerShuttingDownReason_ErrorMessage)
            CALL AddFix(L_ConfServerShuttingDownFix1_ErrorMessage)
            CALL AddFix(L_ConfServerShuttingDownFix2_ErrorMessage)

        CASE E_CMS_INVALID_CONFERENCE_PASSWORD
            CONST L_InvalidConferencePasswordTitle_ErrorMessage  = "Invalid Conference Password"
            CONST L_InvalidConferencePasswordReason_ErrorMessage = "The Conference Management Service denied your request to join the conference because your password is invalid."
            CONST L_InvalidConferencePasswordFix1_ErrorMessage   = "Verify that you have entered the correct conference password."

            CALL SetError(L_InvalidConferencePasswordTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_InvalidConferencePasswordReason_ErrorMessage)
            CALL AddFix(L_InvalidConferencePasswordFix1_ErrorMessage)
        
        CASE E_CMS_ANONYMOUS_USER_DENIED_ACCESS
            CONST L_AnonymousUserDeniedAccessTitle_ErrorMessage  = "Anonymous Access Denied"
            CONST L_AnonymousUserDeniedAccessReason_ErrorMessage = "The Conference Management Service denied your request to join the conference because you cannot be identified."
            CONST L_AnonymousUserDeniedAccessFix1_ErrorMessage   = "Verify that you are not trying to access a private conference that you have not been invited to."
            CONST L_AnonymousUserDeniedAccessFix2_ErrorMessage   = "Verify that you are logged on to the network as yourself so that you can be identified."

            CALL SetError(L_AnonymousUserDeniedAccessTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_AnonymousUserDeniedAccessReason_ErrorMessage)
            CALL AddFix(L_AnonymousUserDeniedAccessFix1_ErrorMessage)
            CALL AddFix(L_AnonymousUserDeniedAccessFix2_ErrorMessage)
        
        CASE E_CMS_USER_DENIED_ACCESS
            CONST L_UserDeniedAccessTitle_ErrorMessage  = "Access Denied"
            CONST L_UserDeniedAccessReason_ErrorMessage = "The Conference Management Service denied your request to join the conference because you do not have the necessary permission to join.  You were authenticated as: "
            CONST L_UserDeniedAccessFix1_ErrorMessage   = "Verify that you are not trying to join a private conference that you have not been invited to. Look at the original meeting invitation and verify that Allow external attendees is checked.  Look at the original meeting invitation and verify that your username is in the invitation's To or CC list and that you are authenticated to the server as that user."
            CONST L_UserDeniedAccessFix2_ErrorMessage   = "Contact your system administrator. The conferencing virtual root permissions may not be set correctly, or the Conference Management Service is forcing client authentication for private conferences (that is, the setting Authenticate access to private meetings pages is checked)."

            CALL SetError(L_UserDeniedAccessTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_UserDeniedAccessReason_ErrorMessage & Request.ServerVariables("AUTH_USER"))
            CALL AddFix(L_UserDeniedAccessFix1_ErrorMessage)
            CALL AddFix(L_UserDeniedAccessFix2_ErrorMessage)

        CASE E_CMS_CTP_JOIN_REQUEST_FAILED
            CONST L_CTPJoinRequestFailedTitle_ErrorMessage  = "CTP Join Request Failed"
            CONST L_CTPJoinRequestFailedReason_ErrorMessage = "The Conference Management Service denied your request because the conference technology provider did not allow the conference join."
            CONST L_CTPJoinRequestFailedFix1_ErrorMessage   = "Contact your system administrator."

            CALL SetError(L_CTPJoinRequestFailedTitle_ErrorMessage, Value, Replace(Request.QueryString("PNAME"), "+"," "), Description)
            CALL SetReason(L_CTPJoinRequestFailedReason_ErrorMessage)
            CALL AddFix(L_CTPJoinRequestFailedFix1_ErrorMessage)
        
        CASE E_CMS_PROVIDER_NOT_INITIALIZED
            CONST L_ProviderNotInitializedTitle_ErrorMessage  = "Provider Not Initialized"
            CONST L_ProviderNotInitializedReason_ErrorMessage = "The Conference Management Service denied your request because the conference technology provider has not completed its initialization."
            CONST L_ProviderNotInitializedFix1_ErrorMessage   = "Contact your system administrator."

            CALL SetError(L_ProviderNotInitializedTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_ProviderNotInitializedReason_ErrorMessage)
            CALL AddFix(L_ProviderNotInitializedFix1_ErrorMessage)
        
        CASE E_CMS_PROVIDER_NOT_FOUND
            CONST L_ProviderNotFoundTitle_ErrorMessage  = "Provider Not Found"
            CONST L_ProviderNotFoundReason_ErrorMessage = "The Conference Management Service denied your request because a conference technology provider cannot be contacted."
            CONST L_ProviderNotFoundFix1_ErrorMessage   = "Contact your system administrator."

            CALL SetError(L_ProviderNotFoundTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_ProviderNotFoundReason_ErrorMessage)
            CALL AddFix(L_ProviderNotFoundFix1_ErrorMessage)
        
        CASE E_CMS_RECURRING_CONFERENCE_NOT_FOUND
            CONST L_RecurringConferenceNotFoundTitle_ErrorMessage  = "Recurring Conference Not Found"
            CONST L_RecurringConferenceNotFoundReason_ErrorMessage = "The Conference Management Service denied your request because it cannot find the recurring conference you are trying to join."
            CONST L_RecurringConferenceNotFoundFix1_ErrorMessage   = "Contact your system administrator."

            CALL SetError(L_RecurringConferenceNotFoundTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_RecurringConferenceNotFoundReason_ErrorMessage)
            CALL AddFix(L_RecurringConferenceNotFoundFix1_ErrorMessage)
            CALL AddFix(L_LinkToConferenceListsFix_ErrorMessage & "<A HREF=""list.asp"">" & L_LinkToConferenceListsFix2_ErrorMessage & "</A>")
        
        CASE E_CMS_NOT_HOST_SERVER
            CONST L_NotHostServerTitle_ErrorMessage  = "Invalid Host URL"
            CONST L_NotHostServerReason_ErrorMessage = "The Conference Management Service denied your request because this server is not the host server."
            CONST L_NotHostServerFix1_ErrorMessage   = "Contact your system administrator."

            CALL SetError(L_NotHostServerTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_NotHostServerReason_ErrorMessage)
            CALL AddFix(L_NotHostServerFix1_ErrorMessage)

        CASE E_DCS_NO_MCUS_AVAILABLE
            CONST L_NoAvailableMCUsTitle_ErrorMessage  = "No T.120 MCU Server Available"
            CONST L_NoAvailableMCUsReason_ErrorMessage = "The Data Conferencing Service is not available or not configured to allow a T.120 MCU server connection from your address. To join a conference, your data conferencing client (NetMeeting, for example) must connect to a T.120 MCU server."
            CONST L_NoAvailableMCUsFix1_ErrorMessage   = "If this problem persists, contact your system administrator."
            
            CALL SetError(L_NoAvailableMCUsTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_NoAvailableMCUsReason_ErrorMessage)
            CALL AddFix(L_NoAvailableMCUsFix1_ErrorMessage)

        CASE E_DCS_NO_PROXY_MCUS_AVAILABLE
            CONST L_NoAvailableProxyMCUsTitle_ErrorMessage  = "No Proxy T.120 MCU Server Available"
            CONST L_NoAvailableProxyMCUsReason_ErrorMessage = "The Data Conferencing Service is not available or not configured to allow a proxy T.120 MCU server connection from your Windows 2000 site. Joining a conference in another site requires a connection to a proxy T.120 MCU server."
            CONST L_NoAvailableProxyMCUsFix1_ErrorMessage   = "If this problem persists, contact your system administrator."
            
            CALL SetError(L_NoAvailableProxyMCUsTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_NoAvailableProxyMCUsReason_ErrorMessage)
            CALL AddFix(L_NoAvailableProxyMCUsFix1_ErrorMessage)

        CASE E_DCS_NO_INTERNET_MCUS_AVAILABLE
            CONST L_NoAvailableInternetMCUsTitle_ErrorMessage  = "No Internet T.120 MCU Server Available"
            CONST L_NoAvailableInternetMCUsReason_ErrorMessage = "The Data Conferencing Service is not available or not configured to allow an internet T.120 MCU server connection from outside of the organization. Joining a conference in another organization requires a connection to an internet T.120 MCU server."
            CONST L_NoAvailableInternetMCUsFix1_ErrorMessage   = "If this problem persists, contact your system administrator."
            
            CALL SetError(L_NoAvailableInternetMCUsTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_NoAvailableInternetMCUsReason_ErrorMessage)
            CALL AddFix(L_NoAvailableInternetMCUsFix1_ErrorMessage)

        CASE E_DCS_CONFERENCE_NOT_RUNNING
            CONST L_ConferenceNotRunningDCSTitle_ErrorMessage  = "Conference Not Running"
            CONST L_ConferenceNotRunningDCSReason_ErrorMessage = "The conference is not currently running on the T.120 MCU server."
            CONST L_ConferenceNotRunningDCSFix1_ErrorMessage   = "If this problem persists, contact your system administrator."
            
            CALL SetError(L_ConferenceNotRunningDCSTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_ConferenceNotRunningDCSReason_ErrorMessage)
            CALL AddFix(L_ConferenceNotRunningDCSFix1_ErrorMessage)
            CALL AddFix(L_LinkToConferenceListsFix_ErrorMessage & "<A HREF=""list.asp"">" & L_LinkToConferenceListsFix2_ErrorMessage & "</A>")
            
        CASE E_DCS_CONFERENCE_ALREADY_ENDED
            CONST L_ConferenceAlreadyEndedTitle_ErrorMessage  = "Conference Over"
            CONST L_ConferenceAlreadyEndedReason_ErrorMessage = "The data conference you tried to join is no longer in session."
            CONST L_ConferenceAlreadyEndedFix1_ErrorMessage   = "If this problem persists, contact your system administrator."
            
            CALL SetError(L_ConferenceAlreadyEndedTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_ConferenceAlreadyEndedReason_ErrorMessage)
            CALL AddFix(L_ConferenceAlreadyEndedFix1_ErrorMessage)
            CALL AddFix(L_LinkToConferenceListsFix_ErrorMessage & "<A HREF=""list.asp"">" & L_LinkToConferenceListsFix2_ErrorMessage & "</A>")
            
        CASE E_DCS_ACCESS_DENIED_CAPACITY_LIMIT
            CONST L_CapacityLimitTitle_ErrorMessage  = "Data Conference Capacity Limit"
            CONST L_CapacityLimitReason_ErrorMessage = "This data conference has reached its capacity and cannot accept any new users at the moment."
            CONST L_CapacityLimitFix1_ErrorMessage   = "Wait a few minutes, and then try to join the conference again. Other users may have left the conference since your last attempt to join."
            CONST L_CapacityLimitFix2_ErrorMessage   = "Contact the meeting organizer."
            
            CALL SetError(L_CapacityLimitTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_CapacityLimitReason_ErrorMessage)
            CALL AddFix(L_CapacityLimitFix1_ErrorMessage)
            CALL AddFix(L_CapacityLimitFix2_ErrorMessage)

        CASE E_DCS_NOT_RUNNING
            CONST L_DCSNotRunningTitle_ErrorMessage  = "Data Conference Service Not Running"
            CONST L_DCSNotRunningReason_ErrorMessage = "The Data Conferencing Service is not running at the moment."
            CONST L_DCSNotRunningFix1_ErrorMessage   = "Wait a few minutes, and then try to join the conference again. The service may be restarting."
            CONST L_DCSNotRunningFix2_ErrorMessage   = "Contact your system administrator."
            
            CALL SetError(L_DCSNotRunningTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_DCSNotRunningReason_ErrorMessage)
            CALL AddFix(L_DCSNotRunningFix1_ErrorMessage)
            CALL AddFix(L_DCSNotRunningFix2_ErrorMessage)

        CASE E_DCS_NOT_INIT
            CONST L_DCSNotInitTitle_ErrorMessage  = "Data Conference Service Not Initialized"
            CONST L_DCSNotInitReason_ErrorMessage = "The Data Conferencing Service has not finished its initialization."
            CONST L_DCSNotInitFix1_ErrorMessage   = "Wait a few minutes, and then try to join the conference again."
            CONST L_DCSNotInitFix2_ErrorMessage   = "Contact your system administrator."
            
            CALL SetError(L_DCSNotInitTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_DCSNotInitReason_ErrorMessage)
            CALL AddFix(L_DCSNotInitFix1_ErrorMessage)
            CALL AddFix(L_DCSNotInitFix2_ErrorMessage)

        CASE E_PKCS7_NO_CERT_STORE
            CONST L_NoCertStoreTitle_ErrorMessage    = "Error Opening Certificate Store"
            CONST L_NoCertStoreReason_ErrorMessage   = "An error occurred while opening the Certificate Store on the conference management server you were trying to join."
            CONST L_NoCertStoreFix1_ErrorMessage     = "Contact your system administrator."

            CALL SetError(L_NoCertStoreTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_NoCertStoreReason_ErrorMessage)
            CALL AddFix(L_NoCertStoreFix1_ErrorMessage)
        
        CASE E_MCU_NO_SERVER_CERTIFICATE
            CONST L_NoServerCertificateTitle_ErrorMessage    = "No Data Conferencing Server Certificate"
            CONST L_NoServerCertificateReason_ErrorMessage   = "The Exchange Data Conferencing Server cannot currently provide private conferences."
            CONST L_NoServerCertificateFix1_ErrorMessage     = "Contact your system administrator to make sure that a machine certificate is installed on the Data Conferencing Server."

            CALL SetError(L_NoServerCertificateTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_NoServerCertificateReason_ErrorMessage)
            CALL AddFix(L_NoServerCertificateFix1_ErrorMessage)

        CASE E_MANUAL_JOIN_INSTRUCTIONS            
            CONST L_ManualJoinInstructionsTitle_ErrorMessage  = "Join Instructions"
            CALL SetError(L_ManualJoinInstructionsTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_NetMeetingInviteReason_ErrorMessage)
            CALL AddFix(L_MCUProxyInvite_ErrorMessage)
            CALL AddFix(L_ManualJoinServer_ErrorMessage & Session("MCUAddress"))
            CALL AddFix(L_ManualJoinID_ErrorMessage & Request.QueryString("ID"))
            CALL AddFix(L_ManualJoinPassword_ErrorMessage & Session(SESSION_PASSWORD))


        CASE E_SESSION_UNAVAILABLE
        
            SELECT CASE Session(SESSION_RESULT)

                CASE &H8007000E
                    CONST L_SessionUnavailableResoveHostTitle_ErrorMessage    = "Unable To Resolve Host"
                    CONST L_SessionUnavailableResoveHostReason_ErrorMessage   = "An error occurred on the Exchange Conferencing Web server.  The server was unable to resolve the host name for the directory server."
                    CONST L_SessionUnavailableResoveHostFix1_ErrorMessage     = "Contact your system administrator."

                    CALL SetError(L_SessionUnavailableResoveHostTitle_ErrorMessage, Value, Source, Description)
                    CALL SetReason(L_SessionUnavailableResoveHostReason_ErrorMessage)
                    CALL AddFix(L_SessionUnavailableResoveHostFix1_ErrorMessage)

                CASE &H8000FFFF
                    CONST L_SessionUnavailableNoRightsTitle_ErrorMessage    = "Insufficient Rights"
                    CONST L_SessionUnavailableNoRightsReason_ErrorMessage   = "An error occurred on the Exchange Conferencing Web server.  You did not have sufficient rights to access the directory server.  The default IIS account settings or the directory server security settings might be configured incorrectly."
                    CONST L_SessionUnavailableNoRightsFix1_ErrorMessage     = "Contact your system administrator."

                    CALL SetError(L_SessionUnavailableNoRightsTitle_ErrorMessage, Value, Source, Description)
                    CALL SetReason(L_SessionUnavailableNoRightsReason_ErrorMessage)
                    CALL AddFix(L_SessionUnavailableNoRightsFix1_ErrorMessage)

                CASE &H800704E1
                    CONST L_SessionUnavailableBadSiteTitle_ErrorMessage    = "Invalid Site"
                    CONST L_SessionUnavailableBadSiteReason_ErrorMessage   = "An error occurred on the Exchange Conferencing Web server.  The service was attempting to look up a zone for a site that could not be found."
                    CONST L_SessionUnavailableBadSiteFix1_ErrorMessage     = "Contact your system administrator."

                    CALL SetError(L_SessionUnavailableBadSiteTitle_ErrorMessage, Value, Source, Description)
                    CALL SetReason(L_SessionUnavailableBadSiteReason_ErrorMessage)
                    CALL AddFix(L_SessionUnavailableBadSiteFix1_ErrorMessage)
            
                CASE ELSE
                    CONST L_SessionUnavailableTitle_ErrorMessage    = "Server Unavailable"
                    CONST L_SessionUnavailableReason_ErrorMessage   = "The Exchange Conferencing Web server is not available."
                    CONST L_SessionUnavailableFix1_ErrorMessage     = "Close your browser and retry the operation."
                    CONST L_SessionUnavailableFix2_ErrorMessage     = "Contact your system administrator."

                    CALL SetError(L_SessionUnavailableTitle_ErrorMessage, Value, Source, Description)
                    CALL SetReason(L_SessionUnavailableReason_ErrorMessage)
                    CALL AddFix(L_SessionUnavailableFix1_ErrorMessage)
                    CALL AddFix(L_SessionUnavailableFix2_ErrorMessage)
        
            END SELECT
        
        CASE E_SERVER_CREATE_OBJECT
            CONST L_ServerCreateObjectTitle_ErrorMessage  = "Web Server Configuration Error"
            CONST L_ServerCreateObjectReason_ErrorMessage = "The Web server you tried to connect to is not configured to work with the Exchange Conferencing Service components."
            CONST L_ServerCreateObjectFix1_ErrorMessage   = "Contact your system administrator."
            
            CALL SetError(L_ServerCreateObjectTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_ServerCreateObjectReason_ErrorMessage)
            CALL AddFix(L_ServerCreateObjectFix1_ErrorMessage)

        CASE E_UNSUPPORTED_JAVASCRIPT_BROWSER
            CONST L_JavaScriptRequiredTitle_ErrorMessage  = "Javascript Support Required"
            CONST L_JavaScriptRequiredReason_ErrorMessage = "To view this page, you must use a browser that supports Javascript, such as Internet Explorer 5.0."
            CONST L_JavaScriptRequiredFix1_ErrorMessage   = "<A HREF=""http://www.microsoft.com/ie"">Get Internet Explorer</A>."
        
            CALL SetError(L_JavaScriptRequiredTitle_ErrorMessage, 0, "Browser", "Browser doesn't support javascript")
            CALL SetReason(L_JavaScriptRequiredReason_ErrorMessage)
            CALL AddFix(L_JavaScriptRequiredFix1_ErrorMessage)

        CASE E_UNSUPPORTED_TABLES_BROWSER
            CONST L_TablesRequiredTitle_ErrorMessage  = "Table Support Required"
            CONST L_TablesRequiredReason_ErrorMessage = "To view this page, you must use a browser that supports tables, such as Internet Explorer 5.0."
            CONST L_TablesRequiredFix1_ErrorMessage   = "<A HREF=""http://www.microsoft.com/ie"">Get Internet Explorer</A>."
        
            CALL SetError(L_TablesRequiredTitle_ErrorMessage, 0, "Browser", "Browser doesn't support tables")
            CALL SetReason(L_TablesRequiredReason_ErrorMessage)
            CALL AddFix(L_TablesRequiredFix1_ErrorMessage)

        CASE E_ACCESS_DENIED
            CONST L_AccessDeniedTitle_ErrorMessage  = "Access Denied"
            CONST L_AccessDeniedReason_ErrorMessage = "The Conference Management Service denied your request due to a lack of permissions."
            CONST L_AccessDeniedFix1_ErrorMessage   = "Verify that you are using the correct password if the conference requires one."
            CONST L_AccessDeniedFix2_ErrorMessage   = "Verify that you are not trying to join a private conference that you have not been invited to."
            CONST L_AccessDeniedFix3_ErrorMessage   = "Contact your system administrator."

            Err.Number = E_ACCESS_DENIED_HRESULT 'Set for better display
            CALL SetError(L_AccessDeniedTitle_ErrorMessage, Value, Source, Description)
            Err.Number = E_ACCESS_DENIED 'Reset for no complications
            CALL SetReason(L_AccessDeniedReason_ErrorMessage)
            CALL AddFix(L_AccessDeniedFix1_ErrorMessage)
            CALL AddFix(L_AccessDeniedFix2_ErrorMessage)
            CALL AddFix(L_AccessDeniedFix3_ErrorMessage)

        CASE E_CMS_RESTARTED
            CONST L_CMSRestartedTitle_ErrorMessage  = "Error Connecting with the Exchange Conferencing Service"
            CONST L_CMSRestartedReason_ErrorMessage = "The Exchange Conferencing Service is not currently available."
            CONST L_CMSRestartedFix1_ErrorMessage   = "Close your browser and open a new connection to the Exchange Conferencing Service."
            CONST L_CMSRestartedFix2_ErrorMessage   = "Contact your administrator if you are still unable to connect.  The service may not be running."
            
            CALL SetError(L_CMSRestartedTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_CMSRestartedReason_ErrorMessage)
            CALL AddFix(L_CMSRestartedFix1_ErrorMessage)
            CALL AddFix(L_CMSRestartedFix2_ErrorMessage)
        
        CASE E_MCU_HANG
            CONST L_MCUHangTitle_ErrorMessage  = "Error Connecting with the Data Conferencing Server"
            CONST L_MCUHangReason_ErrorMessage = "The Exchange Conferencing Service encountered an error while working with the Data Conferencing Server."
            CONST L_MCUHangFix1_ErrorMessage   = "Contact your system administrator."
            
            CALL SetError(L_MCUHangTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_MCUHangReason_ErrorMessage)
            CALL AddFix(L_MCUHangFix1_ErrorMessage)

        CASE E_NO_GLOBAL_CONF_CALENDAR
            CONST L_NoGlobalConfCalTitle_ErrorMessage  = "Exchange Conferencing Service Incorrectly Configured"
            CONST L_NoGlobalConfCalReason_ErrorMessage = "The Exchange Conferencing Service may not have a default conferencing mailbox defined for it."
            CONST L_NoGlobalConfCalFix1_ErrorMessage   = "Contact your system administrator."
            
            CALL SetError(L_NoGlobalConfCalTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_NoGlobalConfCalReason_ErrorMessage)
            CALL AddFix(L_NoGlobalConfCalFix1_ErrorMessage)

        CASE E_DSGETSITENAME_NO_SITE
            CONST L_DsGetSiteNameTitle_ErrorMessage  = "Site Not Located"
            CONST L_DsGetSiteNameReason_ErrorMessage = "The Exchange Conferencing Service can not locate its Active Directory server."
            CONST L_DsGetSiteNameFix1_ErrorMessage   = "Contact your system administrator."
            
            CALL SetError(L_DsGetSiteNameTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_DsGetSiteNameReason_ErrorMessage)
            CALL AddFix(L_DsGetSiteNameFix1_ErrorMessage)

        CASE ELSE 'OTHER ERRORS
                    
            CONST L_DefaultTitle_ErrorMessage  = "Server Error"
            CONST L_DefaultReason_ErrorMessage = "The Exchange Conferencing Service encountered a server error."
            CONST L_DefaultFix1_ErrorMessage   = "Contact your system administrator."
            
            CALL SetError(L_DefaultTitle_ErrorMessage, Value, Source, Description)
            CALL SetReason(L_DefaultReason_ErrorMessage)
            CALL AddFix(L_DefaultFix1_ErrorMessage)

    END SELECT

    CheckSetError = Value
END FUNCTION

'== SUB: Verifies ConfLocator points to the Conference Locator
SUB Verify_ConfLocator()
    ON ERROR RESUME NEXT

	DIM AuthUser
    
	AuthUser	=  Request.ServerVariables("AUTH_USER")
    IF (L_OK_Text <> GetSessionStatusStr(Session(SESSION_STATUS)) OR 0 <> Session(SESSION_ERRNUMBER) OR NOT IsObject(Session(SESSION_CONFLOCATOR)) OR NOT IsObject(Session(SESSION_CMSZONE)) OR (AuthUser <> "" AND LCase(AuthUser) <> LCase(Session(SESSION_ATTENDEE)))) THEN
        CALL SetupSessionVariables(AuthUser)
    END IF
    
    IF (L_OK_Text <> GetSessionStatusStr(Session(SESSION_STATUS)) AND 0 <> Session(SESSION_ERRNUMBER)) THEN
        Err.Number      = Session(SESSION_ERRNUMBER)
        Err.Description = Session(SESSION_ERRDESCRIPTION)
        Err.Source      = Session(SESSION_ERRSOURCE)
    ELSEIF (L_OK_Text <> GetSessionStatusStr(Session(SESSION_STATUS)) OR NOT IsObject(Session(SESSION_CONFLOCATOR)) OR NOT IsObject(Session(SESSION_CMSZONE))) THEN
        Result          = E_SESSION_UNAVAILABLE
    END IF
END SUB

'== SUB: Sets error if the Client browser lacks Tables and JavaScript support
SUB Check_Browser_Capabilities()
    DIM Browscap
    
    SET Browscap = Server.CreateObject("MSWC.BrowserType")

    ' No longer trying to detect javascript from the browser (wasn't working with Navigator)
    'IF (0 = Browscap.JavaScript) THEN
    '    displayState = DISPLAY_ERR_VALUE
    '    Err.Number   = E_UNSUPPORTED_JAVASCRIPT_BROWSER
    'ELSE
    IF (0 = Browscap.tables) THEN
        displayState = DISPLAY_ERR_VALUE
        Err.Number   = E_UNSUPPORTED_TABLES_BROWSER
    END IF
END SUB

'== SUB: Sets an error due to an invalid password
SUB Invalid_Password()
    CONST L_IncorrectPasswordTitle_ErrorMessage  = "Incorrect Password"
    CONST L_IncorrectPasswordReason_ErrorMessage = "You did not enter the password required to join this conference. If you typed the URL above, check your typing. You may have mistyped the password."
    CONST L_IncorrectPasswordFix1_ErrorMessage   = "Check your typing."
    CONST L_IncorrectPasswordFix2_ErrorMessage   = "Contact the conference organizer or your system administrator."
        
    CALL SetError(L_IncorrectPasswordTitle_ErrorMessage, 0, "Security", "Invalid Password")
    CALL SetReason(L_IncorrectPasswordReason_ErrorMessage)
    CALL AddFix(L_IncorrectPasswordFix1_ErrorMessage)
    CALL AddFix(L_IncorrectPasswordFix2_ErrorMessage)
END SUB

'== SUB: Sets error if the Conference ID is not set
SUB IsConfID()
    IF ("" = inConfID OR CONF_ID_CODED_LENGTH < Len(inConfID)) THEN
        displayState = DISPLAY_ERR_CONFID
    END IF
END SUB

'== SUB: Sets error if the DCS Meeting ID is not valid
SUB ValidateMeetingID()
    IF (CONF_ID_DECODED_LENGTH <> Len(inMeetingID)) THEN
        CONST L_NoConferenceIDTitle_ErrorMessage  = "Invalid Conference Access URL"
        CONST L_NoConferenceIDReason_ErrorMessage = "You can join a conference only from a valid conference access URL."
        CONST L_NoConferenceIDFix1_ErrorMessage   = "If you copied the URL, check your typing. Or, join a conference to which you were invited by e-mail."

        Err.Number      = Len(inMeetingID)
        Err.Description = "Invalid conference ID"
        Err.Source      = "Exchange Conferencing Service"
        CALL SetError(L_NoConferenceIDTitle_ErrorMessage, 0, "Validate Meeting ID", "Invalid Conference ID")
        CALL SetReason(L_NoConferenceIDReason_ErrorMessage)
        CALL AddFix(L_NoConferenceIDFix1_ErrorMessage)
        CALL AddFix(L_LinkToConferenceListsFix_ErrorMessage & "<A HREF=""list.asp"">" & L_LinkToConferenceListsFix2_ErrorMessage & "</A>")
    END IF
END SUB

'== SUB: Setup the error page when we have an error
SUB DisplayErrorPage() %>
<TITLE><%=L_ErrorPage_HTMLTitle%></TITLE>
</HEAD>
<body BGCOLOR="#FFFFFF" BACKGROUND="filespw.gif" LEFTMARGIN="40" RIGHTMARGIN="40" TEXT="#000000" LINK="#000000" ALINK="#FFCC66" VLINK="#0080FF" STYLE="background-color:#FFFFFF; background-image:url(filespw.gif); background-attachment:fixed; background-repeat:no-repeat; background-position:bottom right;">

<center>
<table CELLSPACING="12">
<tr><td COLSPAN="2" ROWSPAN="1" ALIGN="LEFT"><b><font FACE="verdana" SIZE="+3"><%=ErrorMsg%></font></b></td></tr>
<tr><td COLSPAN="2" ROWSPAN="1" ALIGN="LEFT"><font FACE="verdana" SIZE="-1">
    <%=Reason%>
    <P><%=L_TryTheFollowing_Text%></P>
    <UL>
        <%
            DIM count
            FOR count = 1 TO UBound(Fixes)
                Response.write("<LI>" + Fixes(count) + "</LI>")
            NEXT
        %>
    </UL>
    <P>
    <SMALL>
        <%=HiddenError%>
        <BR>
        <%=L_Page_HTMLTitle%>
    </SMALL>
</font></td></tr>
</table>
</center>
</body>
</HTML>
<% END SUB %>
