<!-- Generated by SpecStory, Markdown v2.1.0 -->

# 1970-01-01 00:00:00Z

<!-- VS Code Copilot IDE Session a65df91b-cb02-471e-b970-556cbb7b1d64 (1970-01-01 00:00:00Z) -->

_**User (1970-01-01 00:00:00Z)**_

@workspace /fix 

---

_**Agent**_

### Plan
1. Identify the issue: The [`moreButton`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fheader.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A8%2C%22character%22%3A8%7D%7D%5D%2C%221c277c4a-564a-46eb-b05a-0d2d19204b92%22%5D "Go to definition") is appended to the [`#searchForm`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fheader.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A0%2C%22character%22%3A6%7D%7D%5D%2C%221c277c4a-564a-46eb-b05a-0d2d19204b92%22%5D "Go to definition") twice, once to the body and once to the [`#searchForm`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fheader.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A0%2C%22character%22%3A6%7D%7D%5D%2C%221c277c4a-564a-46eb-b05a-0d2d19204b92%22%5D "Go to definition").
2. Fix the issue by removing the redundant append operation.

### Updated Code
```javascript
$(document).ready(function() {
    // Remove any existing submit handlers from the search form
    $('#searchForm').off('submit');

    //#region More button and menu
    // Create the three-dots button
    var moreButton = $('<button type="button" class="btn btn-secondary" ' +
        'id="moreButton" aria-label="More options">' +
        '<i class="bi bi-three-dots-vertical"></i>' +
        '</button>');
    // Append the button to the body or another container
    $('body').append(moreButton);

    $('#moreButton').css({
        position: 'absolute',
        top: '20px',
        right: '20px',
        fontSize: 'x-large',
        color: '#ffffff',
        backgroundColor: '#85bc20',
        border: 'none',
    });

    // Create the menu
    var moreMenu = $('<div id="moreMenu" class="dropdown-menu">' +
        '<button class="dropdown-item" id="learnWebhelp"><i class="bi bi-mortarboard"></i>Learn about Webhelp features  <i class="bi bi-box-arrow-up-right"></i></button>' +
        '<div class="dropdown-divider"></div>' + 
        '<button class="dropdown-item" id="clearSessionStorage"><i class="bi bi-arrow-clockwise"></i>Reload page (F5)</button>' +
        '<button class="dropdown-item" id="clearLocalStorage"><i class="bi bi-trash"></i>Clear local storage and reload page</button>' +
        '<div class="dropdown-divider" id="logoutSeparator" hidden></div>' + 
        '<button class="dropdown-item" id="printButton"><i class="bi bi-printer"></i>Print page (Ctrl+P)</button>' +
        '<div class="dropdown-divider" id="logoutSeparator" hidden></div>' + 
        '<button class="dropdown-item" id="logoutButton" hidden><i class="bi bi-door-closed"></i>Logout</button>' +
        '</div>');
        
    // Style the menu
    moreMenu.css({
        position: 'absolute',
        display: 'none', // Initially hidden
        backgroundColor: '#ffffff',
        border: '1px solid #ccc',
        borderRadius: '8px',
        padding: '10px',
        boxShadow: '0 4px 8px rgba(0, 0, 0, 0.1)',
        zIndex: 1000,
        width: 'fit-content',
    });

    // Append the menu to the body
    $('body').append(moreMenu);

    $("#logoutButton").click(function() {
        window.location.href = "/Logout.ashx";
    });

    // Toggle the menu on button click
    $('#moreButton').click(function() {
        // Get button position and size
        var buttonOffset = $(this).offset();
        var buttonHeight = $(this).outerHeight();
        var buttonWidth = $(this).outerWidth();
        
        // Position the menu right-aligned with the button
        moreMenu.css({
            top: buttonOffset.top + buttonHeight, // Position it below the button
            left: buttonOffset.left + buttonWidth - moreMenu.outerWidth() // Right-align it with the button
        });

        // Show/hide the menu
        moreMenu.toggle();
    });

    // Add hover effect to change background color
    $('#moreButton').hover(
        function() { // On mouse over
            $(this).css('backgroundColor', '#a3d34f'); // Lighter shade of #85bc20
        },
        function() { // On mouse out
            $(this).css('backgroundColor', '#85bc20'); // Original color
        }
    );

    // Attach function to Webhelp Learning
    $('#learnWebhelp').click(function() {
        window.open('/InfoDev/Using%20InfoDev%20WebHelp/index.html', '_blank');
    });

    // Attach function to clear local storage
    $('#clearLocalStorage').click(function() {
        localStorage.clear(); // Clears local storage for the current domain
        alert('Local storage cleared!');
        location.reload(true); // Force a reload, bypassing cache
    });

    // Attach function to clear session storage and reload page
    $('#clearSessionStorage').click(function() {
        // Clear session storage for the current domain
        // sessionStorage.clear();
        location.reload(true); // Force a reload, bypassing cache
    });

    // Attach function to print button
    $('#printButton').click(function() {
        window.print();
    });

    // Hide the menu when clicking outside of it
    $(document).click(function(event) {
        var target = $(event.target);
        // Check if the click is outside of the moreButton or moreMenu
        if (!target.closest('#moreButton').length && !target.closest('#moreMenu').length) {
            moreMenu.hide(); // Hide the menu
        }
    });

    //#endregion

    // Call CollapseHeaderTOC after the document is ready
    CollapseHeaderTOC();

    function CollapseHeaderTOC() {
        if (
            Variables.IsAssumptions ||
            Variables.IsAuthRNArchives ||
            Variables.IsExpereImpGuide ||
            Variables.IsFormsDesignUG ||
            Variables.IsMortgage || 
            Variables.IsSecAdmin || 
            Variables.IsSecAdminSelfHosted || 
            Variables.IsVanceo
        ) {
            // Set the divSearch to use flexbox
            $('.divSearch').css({
                'display': 'flex', // Use flexbox for layout
                'align-items': 'center', // Center items vertically
                'position': 'absolute', // Set position to absolute
                'width': '400px'
            });

            // Report the height of the header toc and adjust
            $('.wh_top_menu').addClass("collapse");
            var b = $('<input type="button" class="btn btn-primary" id="collapsebutton" value="Hide TOC"/>');

            // Append the button to the divSearch
            if (Variables.IsExpereImpGuide) {
                $('div.divSearch').append(b); // Append button to divSearch
            } else {
                $(b).insertAfter('#btnLogout'); // If not, insert after #btnLogout
            }

            $('#collapsebutton').click(function() {
                if ($('#collapsebutton').attr('value') == 'Show TOC') {
                    $('.wh_top_menu').removeClass("collapse");
                    $('#collapsebutton').attr('value', 'Hide TOC');
                } else {
                    $('.wh_top_menu').addClass("collapse");
                    $('#collapsebutton').attr('value', 'Show TOC');
                }
            });

            var toc_height = $('.wh_top_menu').height();
            if (toc_height >= 60) {
                $('.wh_top_menu').addClass("collapse");
                $('#collapsebutton').attr('value', 'Show TOC');
            } else {
                $('.wh_top_menu').removeClass("collapse");
                $('#collapsebutton').attr('value', 'Hide TOC');
            }
        }
    }

    // Intercept the search form submission
    $('#searchForm').off('submit').on('submit', function(event) {
        console.log('searchForm submitted');

        // Capture the search term
        var searchTerm = $('#textToSearch').val();

        // Send the search term to the PHP file via AJAX
        $.ajax({
            type: 'POST',
            url: '/feedback/submit-search.php',
            data: { searchTerm: searchTerm },
            dataType: 'json',
            success: function(response) {
                // Handle the response from the PHP file if needed
                console.log('search term submitted');
                // Optionally, you can show a success message or handle errors here
                $('#searchForm')[0].submit();
            },
            error: function(jqXHR, textStatus, errorThrown) {
                console.error("Error submitting search term:", textStatus, errorThrown);
                // Handle the error if needed
            }
        });

        // Continue with the original action
        // event.preventDefault(); // Prevent the default form submission
    });
});
```

---

_**User (1970-01-01 00:00:00Z)**_

While it may be appended twice, can we instead mvoe it to #searchForm?

---

_**Agent**_

### Plan
1. Remove the initial append of [`moreButton`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fheader.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A118%2C%22character%22%3A28%7D%7D%5D%2C%22dbfc95a6-cd8b-42c4-8c06-e434762c86eb%22%5D "Go to definition") to the body.
2. Ensure [`moreButton`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fheader.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A118%2C%22character%22%3A28%7D%7D%5D%2C%22dbfc95a6-cd8b-42c4-8c06-e434762c86eb%22%5D "Go to definition") is appended to [`#searchForm`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fheader.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A118%2C%22character%22%3A7%7D%7D%5D%2C%22dbfc95a6-cd8b-42c4-8c06-e434762c86eb%22%5D "Go to definition") only.

### Updated Code
```javascript
$(document).ready(function() {
    // Remove any existing submit handlers from the search form
    $('#searchForm').off('submit');

    //#region More button and menu
    // Create the three-dots button
    var moreButton = $('<button type="button" class="btn btn-secondary" ' +
        'id="moreButton" aria-label="More options">' +
        '<i class="bi bi-three-dots-vertical"></i>' +
        '</button>');

    $('#moreButton').css({
        position: 'absolute',
        top: '20px',
        right: '20px',
        fontSize: 'x-large',
        color: '#ffffff',
        backgroundColor: '#85bc20',
        border: 'none',
    });

    // Create the menu
    var moreMenu = $('<div id="moreMenu" class="dropdown-menu">' +
        '<button class="dropdown-item" id="learnWebhelp"><i class="bi bi-mortarboard"></i>Learn about Webhelp features  <i class="bi bi-box-arrow-up-right"></i></button>' +
        '<div class="dropdown-divider"></div>' + 
        '<button class="dropdown-item" id="clearSessionStorage"><i class="bi bi-arrow-clockwise"></i>Reload page (F5)</button>' +
        '<button class="dropdown-item" id="clearLocalStorage"><i class="bi bi-trash"></i>Clear local storage and reload page</button>' +
        '<div class="dropdown-divider" id="logoutSeparator" hidden></div>' + 
        '<button class="dropdown-item" id="printButton"><i class="bi bi-printer"></i>Print page (Ctrl+P)</button>' +
        '<div class="dropdown-divider" id="logoutSeparator" hidden></div>' + 
        '<button class="dropdown-item" id="logoutButton" hidden><i class="bi bi-door-closed"></i>Logout</button>' +
        '</div>');
        
    // Style the menu
    moreMenu.css({
        position: 'absolute',
        display: 'none', // Initially hidden
        backgroundColor: '#ffffff',
        border: '1px solid #ccc',
        borderRadius: '8px',
        padding: '10px',
        boxShadow: '0 4px 8px rgba(0, 0, 0, 0.1)',
        zIndex: 1000,
        width: 'fit-content',
    });

    // Append the menu to the body
    $('body').append(moreMenu);

    $("#logoutButton").click(function() {
        window.location.href = "/Logout.ashx";
    });

    // Toggle the menu on button click
    $('#moreButton').click(function() {
        // Get button position and size
        var buttonOffset = $(this).offset();
        var buttonHeight = $(this).outerHeight();
        var buttonWidth = $(this).outerWidth();
        
        // Position the menu right-aligned with the button
        moreMenu.css({
            top: buttonOffset.top + buttonHeight, // Position it below the button
            left: buttonOffset.left + buttonWidth - moreMenu.outerWidth() // Right-align it with the button
        });

        // Show/hide the menu
        moreMenu.toggle();
    });

    // Add hover effect to change background color
    $('#moreButton').hover(
        function() { // On mouse over
            $(this).css('backgroundColor', '#a3d34f'); // Lighter shade of #85bc20
        },
        function() { // On mouse out
            $(this).css('backgroundColor', '#85bc20'); // Original color
        }
    );

    // Attach function to Webhelp Learning
    $('#learnWebhelp').click(function() {
        window.open('/InfoDev/Using%20InfoDev%20WebHelp/index.html', '_blank');
    });

    // Attach function to clear local storage
    $('#clearLocalStorage').click(function() {
        localStorage.clear(); // Clears local storage for the current domain
        alert('Local storage cleared!');
        location.reload(true); // Force a reload, bypassing cache
    });

    // Attach function to clear session storage and reload page
    $('#clearSessionStorage').click(function() {
        // Clear session storage for the current domain
        // sessionStorage.clear();
        location.reload(true); // Force a reload, bypassing cache
    });

    // Attach function to print button
    $('#printButton').click(function() {
        window.print();
    });

    // Hide the menu when clicking outside of it
    $(document).click(function(event) {
        var target = $(event.target);
        // Check if the click is outside of the moreButton or moreMenu
        if (!target.closest('#moreButton').length && !target.closest('#moreMenu').length) {
            moreMenu.hide(); // Hide the menu
        }
    });

    // Append the button to the right side of the header
    $('#searchForm').append(moreButton); // Append button to the flex container
    //#endregion

    // Call CollapseHeaderTOC after the document is ready
    CollapseHeaderTOC();

    function CollapseHeaderTOC() {
        if (
            Variables.IsAssumptions ||
            Variables.IsAuthRNArchives ||
            Variables.IsExpereImpGuide ||
            Variables.IsFormsDesignUG ||
            Variables.IsMortgage || 
            Variables.IsSecAdmin || 
            Variables.IsSecAdminSelfHosted || 
            Variables.IsVanceo
        ) {
            // Set the divSearch to use flexbox
            $('.divSearch').css({
                'display': 'flex', // Use flexbox for layout
                'align-items': 'center', // Center items vertically
                'position': 'absolute', // Set position to absolute
                'width': '400px'
            });

            // Report the height of the header toc and adjust
            $('.wh_top_menu').addClass("collapse");
            var b = $('<input type="button" class="btn btn-primary" id="collapsebutton" value="Hide TOC"/>');

            // Append the button to the divSearch
            if (Variables.IsExpereImpGuide) {
                $('div.divSearch').append(b); // Append button to divSearch
            } else {
                $(b).insertAfter('#btnLogout'); // If not, insert after #btnLogout
            }

            $('#collapsebutton').click(function() {
                if ($('#collapsebutton').attr('value') == 'Show TOC') {
                    $('.wh_top_menu').removeClass("collapse");
                    $('#collapsebutton').attr('value', 'Hide TOC');
                } else {
                    $('.wh_top_menu').addClass("collapse");
                    $('#collapsebutton').attr('value', 'Show TOC');
                }
            });

            var toc_height = $('.wh_top_menu').height();
            if (toc_height >= 60) {
                $('.wh_top_menu').addClass("collapse");
                $('#collapsebutton').attr('value', 'Show TOC');
            } else {
                $('.wh_top_menu').removeClass("collapse");
                $('#collapsebutton').attr('value', 'Hide TOC');
            }
        }
    }

    // Intercept the search form submission
    $('#searchForm').off('submit').on('submit', function(event) {
        console.log('searchForm submitted');

        // Capture the search term
        var searchTerm = $('#textToSearch').val();

        // Send the search term to the PHP file via AJAX
        $.ajax({
            type: 'POST',
            url: '/feedback/submit-search.php',
            data: { searchTerm: searchTerm },
            dataType: 'json',
            success: function(response) {
                // Handle the response from the PHP file if needed
                console.log('search term submitted');
                // Optionally, you can show a success message or handle errors here
                $('#searchForm')[0].submit();
            },
            error: function(jqXHR, textStatus, errorThrown) {
                console.error("Error submitting search term:", textStatus, errorThrown);
                // Handle the error if needed
            }
        });

        // Continue with the original action
        // event.preventDefault(); // Prevent the default form submission
    });
});
```

---

_**User (1970-01-01 00:00:00Z)**_

I need to make this so that it doesn't matter if the variables are initial caps or all small caps

---

_**Agent**_

### Plan
1. Convert the variable names to lowercase for comparison.
2. Use the lowercase variable names in the conditions.

### Updated Code
```javascript
if (Variables.IsAuthoring.toLowerCase() === 'true' || 
    Variables.IsEngine.toLowerCase() === 'true' || 
    Variables.IsI32.toLowerCase() === 'true' || 
    Variables.IsWKESign.toLowerCase() === 'true' || 
    Variables.IsWKHostedExpere.toLowerCase() === 'true') {
    TelNum = 'Tel: 1-800-274-2711, ext. 1126618';
    EmailAdd = 'E-mail: ExpereIESupport@wolterskluwer.com';
} else if (Variables.IsAssumptions.toLowerCase() === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1109001';
    EmailAdd = 'E-mail: VanceoAssumptionsSupport@wolterskluwer.com';
} else if (Variables.IsInterfaceManager.toLowerCase() === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1123665';
    EmailAdd = 'E-mail: ComplianceOneMortgageSupport@wolterskluwer.com';
} else if (Variables.IsMortgage.toLowerCase() === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1123665';
    EmailAdd = 'E-mail: ComplianceOneMortgageSupport@wolterskluwer.com';
} else if (Variables.IsTSoftPlus.toLowerCase() === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1124028';
    EmailAdd = 'E-mail: TSoftSup@wolterskluwer.com';
} else if (Variables.Workflow.toLowerCase() === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1125031';
    EmailAdd = 'E-mail: CASHSupport@wolterskluwer.com';
} else {
    TelNum = 'Tel: 800-274-2711';
}
```

---

_**User (1970-01-01 00:00:00Z)**_

Uncaught TypeError: Variables.IsAuthoring.toLowerCase is not a function
    at <anonymous>:1:139
    at b (jquery.min.js:2:866)
    at Function.globalEval (jquery.min.js:2:2905)
    at text script (jquery.min.js:2:83080)
    at jquery.min.js:2:79470
    at l (jquery.min.js:2:79587)
    at XMLHttpRequest.<anonymous> (jquery.min.js:2:82355)

---

_**Agent**_

### Plan
1. Check if the [`Variables`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fsearch.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A9%2C%22character%22%3A4%7D%7D%5D%2C%222ae5a664-bcf7-44ba-baa1-fee239b26b46%22%5D "Go to definition") object properties are strings before calling [`toLowerCase()`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fsearch.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A9%2C%22character%22%3A26%7D%7D%5D%2C%222ae5a664-bcf7-44ba-baa1-fee239b26b46%22%5D "Go to definition").
2. If they are not strings, convert them to strings.

### Updated Code
```javascript
// search.js

// const IsIndex  = window.location.href.indexOf("/index.html") != -1;
const IsSearch = window.location.href.indexOf("/search.html") != -1;
let SearchPath = '';
let TelNum = '';
let EmailAdd = '';

// Helper function to safely get the lowercase value of a variable
function safeToLowerCase(variable) {
    return typeof variable === 'string' ? variable.toLowerCase() : String(variable).toLowerCase();
}

// #region Product Support variables
if (safeToLowerCase(Variables.IsAuthoring) === 'true' || 
    safeToLowerCase(Variables.IsEngine) === 'true' || 
    safeToLowerCase(Variables.IsI32) === 'true' || 
    safeToLowerCase(Variables.IsWKESign) === 'true' || 
    safeToLowerCase(Variables.IsWKHostedExpere) === 'true') {
    TelNum = 'Tel: 1-800-274-2711, ext. 1126618';
    EmailAdd = 'E-mail: ExpereIESupport@wolterskluwer.com';
} else if (safeToLowerCase(Variables.IsAssumptions) === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1109001';
    EmailAdd = 'E-mail: VanceoAssumptionsSupport@wolterskluwer.com';
} else if (safeToLowerCase(Variables.IsInterfaceManager) === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1123665';
    EmailAdd = 'E-mail: ComplianceOneMortgageSupport@wolterskluwer.com';
} else if (safeToLowerCase(Variables.IsMortgage) === 'true') {
    console.log(Variables.IsMortgage);
    TelNum = 'Tel: 800-274-2711 EXT 1123665';
    EmailAdd = 'E-mail: ComplianceOneMortgageSupport@wolterskluwer.com';
} else if (safeToLowerCase(Variables.IsTSoftPlus) === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1124028';
    EmailAdd = 'E-mail: TSoftSup@wolterskluwer.com';
} else if (safeToLowerCase(Variables.Workflow) === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1125031';
    EmailAdd = 'E-mail: CASHSupport@wolterskluwer.com';
} else {
    TelNum = 'Tel: 800-274-2711';
}
// #endregion

// #region SEARCH FEEDBACK FORM
if (IsSearch) {
    function appendSearchFeedbackForm() {
        // Get the current date and time
        const currentDateTime = new Date().toISOString();
    
        // Create the main div
        // ...
    }
}
```

---

_**User (1970-01-01 00:00:00Z)**_

this tells me if it is true or false. I need the actual value of IsMortgage.

_**User (1970-01-01 00:00:00Z)**_

this tells me if it is true or false. I need the actual value of IsMortgage.

_**User (1970-01-01 00:00:00Z)**_

this tells me if it is true or false. I need the actual value of IsMortgage.

---

_**Agent**_

### Plan
1. Ensure that the comparison is case-insensitive.
2. Use the actual value of [`Variables.IsMortgage`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fsearch.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A14%2C%22character%22%3A27%7D%7D%5D%2C%22956bd720-e170-4136-beb2-5efb8886214b%22%5D "Go to definition") for comparison.

### Updated Code
```javascript
// Helper function to safely get the lowercase value of a variable
function safeToLowerCase(variable) {
    return typeof variable === 'string' ? variable.toLowerCase() : String(variable).toLowerCase();
}

// #region Product Support variables
if (safeToLowerCase(Variables.IsAuthoring) === 'true' || 
    safeToLowerCase(Variables.IsEngine) === 'true' || 
    safeToLowerCase(Variables.IsI32) === 'true' || 
    safeToLowerCase(Variables.IsWKESign) === 'true' || 
    safeToLowerCase(Variables.IsWKHostedExpere) === 'true') {
    TelNum = 'Tel: 1-800-274-2711, ext. 1126618';
    EmailAdd = 'E-mail: ExpereIESupport@wolterskluwer.com';
} else if (safeToLowerCase(Variables.IsAssumptions) === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1109001';
    EmailAdd = 'E-mail: VanceoAssumptionsSupport@wolterskluwer.com';
} else if (safeToLowerCase(Variables.IsInterfaceManager) === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1123665';
    EmailAdd = 'E-mail: ComplianceOneMortgageSupport@wolterskluwer.com';
} else if (safeToLowerCase(Variables.IsMortgage) === 'true') {
    console.log("IsMortgage:", Variables.IsMortgage);
    TelNum = 'Tel: 800-274-2711 EXT 1123665';
    EmailAdd = 'E-mail: ComplianceOneMortgageSupport@wolterskluwer.com';
} else if (safeToLowerCase(Variables.IsTSoftPlus) === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1124028';
    EmailAdd = 'E-mail: TSoftSup@wolterskluwer.com';
} else if (safeToLowerCase(Variables.Workflow) === 'true') {
    TelNum = 'Tel: 800-274-2711 EXT 1125031';
    EmailAdd = 'E-mail: CASHSupport@wolterskluwer.com';
} else {
    TelNum = 'Tel: 800-274-2711';
}
// #endregion
```

---

_**User (1970-01-01 00:00:00Z)**_

let me explain further.
These variables are derived from strings in the browser address bar path. For example:
https://dev-documentation.wolterskluwerfs.com/mortgage/search.html?searchQuery=credit

Variables.IsMortgage is identified by the '/mortgage' portion. I need this code to set TelNum and EmailAdd based on the value of the variables (Variables.IsAuthoring, Variables.IsEngine, Variables.IsMortgage, etc.).
Sometimes the browser path comes in in lowercase as in the example I provided. Sometimes it has initial case, like this (notice 'Mortgage' is initial case):
https://dev-documentation.wolterskluwerfs.com/Mortgage/search.html?searchQuery=credit
This script needs to return the desired result regardless of the case. Does this make sense?

---

_**Agent**_

Yes, that makes sense. To achieve this, we need to extract the relevant part of the URL path, convert it to lowercase, and then set the [`TelNum`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fsearch.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A5%2C%22character%22%3A4%7D%7D%5D%2C%22e4342e19-d698-4dc2-bd64-e793e8cd50b2%22%5D "Go to definition") and [`EmailAdd`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fsearch.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A6%2C%22character%22%3A4%7D%7D%5D%2C%22e4342e19-d698-4dc2-bd64-e793e8cd50b2%22%5D "Go to definition") based on the extracted value.

### Plan
1. Extract the relevant part of the URL path.
2. Convert the extracted part to lowercase.
3. Set the [`TelNum`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fsearch.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A5%2C%22character%22%3A4%7D%7D%5D%2C%22e4342e19-d698-4dc2-bd64-e793e8cd50b2%22%5D "Go to definition") and [`EmailAdd`](command:_github.copilot.openSymbolFromReferences?%5B%22%22%2C%5B%7B%22uri%22%3A%7B%22scheme%22%3A%22file%22%2C%22authority%22%3A%22zusscgrcprodwebhelp.file.core.windows.net%22%2C%22path%22%3A%22%2Fwebhelp%2Fdev%2Fresources%2Fwebhelp%2Fjs%2Fsearch.js%22%2C%22query%22%3A%22%22%2C%22fragment%22%3A%22%22%7D%2C%22pos%22%3A%7B%22line%22%3A6%2C%22character%22%3A4%7D%7D%5D%2C%22e4342e19-d698-4dc2-bd64-e793e8cd50b2%22%5D "Go to definition") based on the lowercase value.

### Updated Code
```javascript
// search.js

// const IsIndex  = window.location.href.indexOf("/index.html") != -1;
const IsSearch = window.location.href.indexOf("/search.html") != -1;
let SearchPath = '';
let TelNum = '';
let EmailAdd = '';

// Helper function to safely get the lowercase value of a variable
function safeToLowerCase(variable) {
    return typeof variable === 'string' ? variable.toLowerCase() : String(variable).toLowerCase();
}

// Extract the relevant part of the URL path and convert it to lowercase
const pathParts = window.location.pathname.split('/');
const relevantPart = pathParts.length > 1 ? safeToLowerCase(pathParts[1]) : '';

// #region Product Support variables
if (relevantPart === 'authoring' || 
    relevantPart === 'engine' || 
    relevantPart === 'i32' || 
    relevantPart === 'wkesign' || 
    relevantPart === 'wkhostedexpere') {
    TelNum = 'Tel: 1-800-274-2711, ext. 1126618';
    EmailAdd = 'E-mail: ExpereIESupport@wolterskluwer.com';
} else if (relevantPart === 'assumptions') {
    TelNum = 'Tel: 800-274-2711 EXT 1109001';
    EmailAdd = 'E-mail: VanceoAssumptionsSupport@wolterskluwer.com';
} else if (relevantPart === 'interfacemanager') {
    TelNum = 'Tel: 800-274-2711 EXT 1123665';
    EmailAdd = 'E-mail: ComplianceOneMortgageSupport@wolterskluwer.com';
} else if (relevantPart === 'mortgage') {
    console.log("IsMortgage:", relevantPart);
    TelNum = 'Tel: 800-274-2711 EXT 1123665';
    EmailAdd = 'E-mail: ComplianceOneMortgageSupport@wolterskluwer.com';
} else if (relevantPart === 'tsoftplus') {
    TelNum = 'Tel: 800-274-2711 EXT 1124028';
    EmailAdd = 'E-mail: TSoftSup@wolterskluwer.com';
} else if (relevantPart === 'workflow') {
    TelNum = 'Tel: 800-274-2711 EXT 1125031';
    EmailAdd = 'E-mail: CASHSupport@wolterskluwer.com';
} else {
    TelNum = 'Tel: 800-274-2711';
}
// #endregion

// #region SEARCH FEEDBACK FORM
if (IsSearch) {
    function appendSearchFeedbackForm() {
        // Get the current date and time
        const currentDateTime = new Date().toISOString();
    
        // Create the main div
        // ...
    }
}
```
