/* Minification failed. Returning unminified contents.
(3481,34-35): run-time error JS1014: Invalid character: `
(3481,39-48): run-time error JS1100: Expected ',': following
(3481,105-111): run-time error JS1003: Expected ':': Canada
(3481,142-146): run-time error JS1003: Expected ':': work
(3481,158-162): run-time error JS1100: Expected ',': with
(3481,167-175): run-time error JS1004: Expected ';': external
(3481,235-246): run-time error JS1004: Expected ';': collections
(3481,328-331): run-time error JS1004: Expected ';': are
(3482,9-18): run-time error JS1004: Expected ';': Reference
(3482,41-47): run-time error JS1193: Expected ',' or ')': issued
(3482,76-84): run-time error JS1193: Expected ',' or ')': infobase
(3482,137-146): run-time error JS1193: Expected ',' or ')': Decisions
(3482,175-182): run-time error JS1193: Expected ',' or ')': Appeals
(3482,194-195): run-time error JS1010: Expected identifier: )
(3483,12-20): run-time error JS1004: Expected ';': Programs
(3483,60-66): run-time error JS1193: Expected ',' or ')': issued
(3483,111-114): run-time error JS1193: Expected ',' or ')': the
(3483,174-182): run-time error JS1193: Expected ',' or ')': Business
(3483,215-223): run-time error JS1004: Expected ';': infobase
(3483,293-300): run-time error JS1004: Expected ';': various
(3483,326-328): run-time error JS1004: Expected ';': as
(3483,357-360): run-time error JS1004: Expected ';': Tax
(3483,392-406): run-time error JS1004: Expected ';': Investigations
(3483,419-422): run-time error JS1004: Expected ';': Tax
(3483,447-458): run-time error JS1004: Expected ';': information
(3483,512-513): run-time error JS1010: Expected identifier: )
(3484,8-11): run-time error JS1004: Expected ';': and
(3484,20-29): run-time error JS1004: Expected ';': Reference
(3484,52-58): run-time error JS1193: Expected ',' or ')': issued
(3484,59-61): run-time error JS1197: Too many errors. The file might not be a JavaScript file: by
 */
/*globals glb_ResolveUrlJs_Base, GlobalStrings, linkImagePosition, MediaPlayer, ChangeSelectBoxVisibility, glb_StringCaseType*/
var functionOnCloseDiv = "";


/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name     :   createButtonPopup
// Desc     :   Builds and returns a modal jQuery dialog either underneath the link that triggered it or in 
//              the center of the page.
// Inputs   :   tsi_button - The button/link that raised the event
//              removeOnClick - if true any click on the page closes the dialog
//		        title - Modal dialog's title
//		        functionOnClose - function to try an on close function after div closes
//		        doNotClose - Hide or show the close(X) button on the modal dialog title bar
//
//              Changes made to accommodate JqueryUI
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function createButtonPopup(tsi_button, removeOnClick, title, functionOnClose, doNotClose, AdditionalOptions) {


    if (arguments.length < 4) {
        doNotClose = false;
    }

    if (arguments.length > 3) {
        functionOnCloseDiv = functionOnClose;
    }
    else {
        functionOnCloseDiv = "";
    }

    var jqObj;

    var linkImage = document.getElementById(tsi_button);
    if (linkImage != null) {
        linkImagePosition = findPos(linkImage);
    }
    ChangeSelectBoxVisibility("hidden");

    var dialogID = "popUpDivFromButton";
    var msgDialog = "<div id=\"" + dialogID + "\" style=\"padding:5px;\" title=\"" + title + "\"></div>";

    if ($("#" + dialogID).length > 0) {
        $("#" + dialogID).dialog('destroy').remove();
    }

    var jqObj = $(msgDialog);

    jqObj.appendTo(document.body);

    var initialDialogOption = {

        width: 'auto',
        height: 'auto',
        autoResize: true,
        draggable: true,
        modal: true,
        resizable: false,
        fluid: true,
        open: function (event, ui) {
            if (removeOnClick) {
                $('.ui-widget-overlay').bind('click', function () {
                    removeButtonPopup();
                });
            }
        },
        close: function (event, ui) {
            removeButtonPopup();
        }
    };

    jqObj.dialog(initialDialogOption);

    //Dialog's Position
    var additionalDialogOption;
    if (Globals.Utilities.isUndefinedOrNull(AdditionalOptions)) {
        additionalDialogOption = {
            width: 480,
            maxHeight: 450
        };
    }
    else {
        additionalDialogOption = AdditionalOptions;
    }
    var jqButtonAnchorPoint = $("#" + tsi_button);

    try {
        if (jqButtonAnchorPoint.length > 0) {

            var positionOption = {
                my: "left top", //the possition of the div
                of: jqButtonAnchorPoint, //the object that the pop up needs to anchor to
                at: "left bottom" // the location where it should show in relation of the "of" object.
            };

            additionalDialogOption["position"] = positionOption;
            additionalDialogOption.width = 480;
        }
    }
    catch (e) { }

    jqObj.dialog(additionalDialogOption);

    $('div.ui-dialog-titlebar-close').hide();
    $('div.ui-dialog-titlebar').css('min-height', '25px');


    if (!doNotClose) {
        //Show the X button on the dialog
        $('.ui-dialog-titlebar-close').show();
    }

    return jqObj;

}



/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name     :   check4rightAlign
// Desc     :   positions the window 
//
// Status   :   MAY NOT BE NEEDED ANYMORE. IMPLEMENTED IN createButtonPopup(..)
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
//function check4rightAlign(tsi_button) {


//    var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth;
//    var popup = document.getElementById("popUpDivFromButton");

//    if (width < parseInt(popup.style.left) + $(popup).outerWidth(false)) {
//        //if its not already on the left hand of the window
//        if (width / 2 < parseInt(popup.style.left)) {
//            buttonToGoUnder = document.getElementById(tsi_button);
//            if (buttonToGoUnder != null) {
//                linkUnderPos = findPos(buttonToGoUnder);
//                popup.style.left = (linkUnderPos[1] + $(buttonToGoUnder).outerWidth(false) - $(popup).outerWidth(false)) + 'px';

//            }
//        }
//    }

//}

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name     :   fixTableWidth
// Desc     :   Fixes the width of the modal window
//
// Status   :   MAY NOT BE NEEDED ANYMORE. IMPLEMENTED IN createButtonPopup(..)
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
//function fixTableWidth() {
//	if (document.getElementById("popupHeadingTable") == null) {
//		return;
//	}

//    if ($("#popupHeadingTable").width() > $("#popUpDivFromButton").width() - 20) {
//    	$("#popupHeadingTable").width($("#popUpDivFromButton").width() + 20);
//    }
//    else {
//    	$("#popupHeadingTable").width($("#popUpDivFromButton").width());
//    }
//}


/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name     :   removeButtonPopup
// Desc     :   Closes the modal window and removes it from the DOM.
//
//              Changes made to accommodate JqueryUI
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function removeButtonPopup() {

    if ($("#popUpDivFromButton").length > 0) {

        if ($("#popUpDivFromButton").html().indexOf('MediaPlayer') != -1) {
            MediaPlayer.stop();
        }

        $("#popUpDivFromButton").dialog('destroy').remove();

        ChangeSelectBoxVisibility("visible");
        tryFunctionOnClose();
    }
}


/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name     :   createCenteredPopupDiv
// Desc     :   Triggers the creation of a modal dialog then adds content to it. 
// Inputs   :   innerHTML - The content of the modal dialog
//              removeOnClick - if true any click on the page closes the dialog
//		        title - Modal dialog's title
//		        functionOnClose - function to try an on close function after div closes
//		        doNotClose - Hide or show the close(X) button on the modal dialog title bar
//
//              Changes made to accommodate JqueryUI
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function createCenteredPopupDiv(innerHTML, removeOnClick, title, functionOnClose, doNotClose, DialogOptions) {
    var jqDiv = null;

    if (arguments.length > 3) {
        jqDiv = createButtonPopup("", removeOnClick, title, functionOnClose, doNotClose, DialogOptions);
    }
    else {
        jqDiv = createButtonPopup("", removeOnClick, title);
    }

    try {
        if (jqDiv.length == 0) {
            return null;
        }
    }
    catch (e) {
        return null;
    }

    jqDiv.html(innerHTML);

    //this is needed since the position at this point is based on an empty div without any dimensions so things will look out of place.
    if (typeof (DialogOptions) === "undefined" || DialogOptions === null) {
        var positionOptions = {
            "my": "center",
            "at": "center",
            "of": window
        };

        jqDiv.dialog("option", "position", positionOptions);
    }

    return jqDiv;
}

//function to try an on close function after div closes
function tryFunctionOnClose() {
    if (functionOnCloseDiv != null && functionOnCloseDiv.length > 0) {
        try {
            eval(functionOnCloseDiv);
        }
        catch (Err) {
            //do nothing
        }
    }
}

//function to get any element postion
function findPos(obj) {
    if (obj == null) {
        return [0, 0];
    }

    var curleft = 0;
    var curtop = 0;
    if (obj.offsetParent) {
        do {
            curleft += obj.offsetLeft;
            curtop += obj.offsetTop;
        } while (obj = obj.offsetParent);
    }
    return [curtop, curleft];
}





function paddingFix4Element(sElemId) {
    //no longer need to run this since we are using a doctype
    try {

        var objElement = document.getElementById(sElemId);
        //no longer run this code, since we added the box model fix to the css
        if (false) {
            //check if it has already been applied
            if (document.getElementById("lstElementsFixed").value.indexOf(sElemId) == -1) {
                document.getElementById("lstElementsFixed").value += sElemId + ",";

                var iDifference = objElement.offsetWidth - $("#" + sElemId).width();
                $(objElement).width(objElement.offsetWidth - iDifference - iDifference);
            }

        }
    }
    catch (Error) {

    }

}



function paddingFix() {
    //no longer run this code, since we added the box model fix to the css
    if (false) {

        for (var i = 0; i < document.styleSheets.length; i++) {
            var mysheet = document.styleSheets[i];
            var myrules = mysheet.cssRules ? mysheet.cssRules : mysheet.rules;
            for (var j = 0; j < myrules.length; j++) {
                if (!isNaN(parseInt(myrules[j].style.height)) && myrules[j].style.height.indexOf('px') > 0) {
                    if (parseInt(myrules[j].style.paddingBottom) > 0 && !isNaN(parseInt(myrules[j].style.paddingBottom))) {
                        myrules[j].style.height = (parseInt(myrules[j].style.height) - parseInt(myrules[j].style.paddingBottom)) + 'px';
                    }
                    if (parseInt(myrules[j].style.paddingTop) > 0 && !isNaN(parseInt(myrules[j].style.paddingTop))) {
                        myrules[j].style.height = (parseInt(myrules[j].style.height) - parseInt(myrules[j].style.paddingTop)) + 'px';
                    }
                }
                if (!isNaN(parseInt(myrules[j].style.width)) && myrules[j].style.width.indexOf('px') > 0) {
                    if (parseInt(myrules[j].style.paddingLeft) > 0 && !isNaN(parseInt(myrules[j].style.paddingLeft))) {
                        myrules[j].style.width = (parseInt(myrules[j].style.width) - parseInt(myrules[j].style.paddingLeft)) + 'px';
                    }
                    if (parseInt(myrules[j].style.paddingRight) > 0 && !isNaN(parseInt(myrules[j].style.paddingRight))) {
                        myrules[j].style.width = (parseInt(myrules[j].style.width) - parseInt(myrules[j].style.paddingRight)) + 'px';
                    }
                }
            }
        }
    }
}

//fix safari and chrome padding problem
function documentBodyFix4Safari() {
    if (jQuery) {
        //@ CHANGE FOR JQUERY 3.6
        //$(document).ready(function () {
        if (
            document.readyState === "complete" ||
            (document.readyState !== "loading" && !document.documentElement.doScroll)
        ) {
            documentBodyFix();
        };
    }
    else {
        documentBodyFix();
    }
}

function documentBodyFix() {
    //check if its playbook/old ipad to run the padding fix
    if (navigator.userAgent.toLowerCase().indexOf('playbook') != -1 || (navigator.userAgent.toLowerCase().indexOf('ipad') != -1 && (navigator.userAgent.toLowerCase().indexOf('cpu os 4') != -1 || navigator.userAgent.toLowerCase().indexOf('cpu os 3') != -1))) {
        var divDocumentBodyContext = document.getElementById("divDocumentBodyContext");
        if (divDocumentBodyContext != null) // <- this only exists in briefcase.aspx and home.aspx
        {
            $(divDocumentBodyContext).width(parseInt($(divDocumentBodyContext).width()) - Math.max(10, parseInt($(divDocumentBodyContext).css("padding-left"))) - Math.max(10, parseInt($(divDocumentBodyContext).css("padding-right"))) - 10);
            // $(divDocumentBodyContext).height(parseInt($(divDocumentBodyContext).height())  - 4);
            var divDocumentBody = document.getElementById("divDocumentBody");
            $(divDocumentBody).width(parseInt($(divDocumentBody).width()) - Math.max(10, parseInt($(divDocumentBody).css("padding-left"))) - Math.max(10, parseInt($(divDocumentBody).css("padding-right"))) - 3);
        }
    }
}


/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name     :   GetString
// Desc     :   Get a JS string. This also uses the glb_StringCaseType variable to set weather or not it should
//				use the alternate string.
// Inputs   :   stringName - The variable name assigned to the string desired.
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function GetString(stringName) {
    var obj = GlobalStrings[stringName];
    var stringToReturn = "";
    if (stringName.length > 0 && typeof (obj) !== "undefined") {

        if (Globals.Utilities.isArray(obj) && obj.length > 1)// Mapped to another array, different case type is defined for this string
        {
            switch (glb_StringCaseType) {
                case Globals.StringCaseType.SentenceCase:
                    stringToReturn = GlobalStrings[stringName][1];
                    break;
                case Globals.StringCaseType.TitleCase:
                default:
                    stringToReturn = GlobalStrings[stringName][0];
                    break;
            }
        }
        else if (Globals.Utilities.isArray(obj) && obj.length === 1) {
            stringToReturn = GlobalStrings[stringName][0];
        }
        else {
            // Must be mapped to a regular string
            stringToReturn = GlobalStrings[stringName];
        }

    }
    else {
        // Could not find string
        stringToReturn = "N/A";
    }

    return stringToReturn;
}



function UnDecodeHTMLCharacters(strValueToDecode) {
    if (!strValueToDecode) {
        return "";
    }
    if (strValueToDecode.length == 0) {
        return "";
    }

    var objTA = document.createElement("textarea");

    strValueToDecode = strValueToDecode.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/&amp;#/gi, "&#");
    objTA.innerHTML = strValueToDecode;

    return objTA.value;
}

function parseAjaxResponse(sThisReqStatusCode, sThisReqResponseText) {
    var oResponse;
    try {
        oResponse = eval("(" + sThisReqResponseText + ")");
    }
    catch (exc) {
        var sTestText = sThisReqResponseText.toLowerCase();
        if (
			(sTestText.indexOf("form id=\"floginhidden\"") >= 0)
			||
			(sThisReqStatusCode == 0 && sTestText.length == 0)
			) {
            var reTwoSlash = new RegExp("//");
            var sLocation = window.location.toString();
            var i = sLocation.replace(reTwoSlash, "").indexOf("/") + 2;
            var sReturnUrl = sLocation.substr(i);
            window.location.replace("/Login/Login.aspx?ReturnUrl=" + encodeURIComponent(sReturnUrl));
            return (null);
        }
    }
    return (oResponse);
}

function toLowerCaseExceptFirstCharacter(strToFix) {
    if (typeof strToFix == 'string' && strToFix.length > 1) {
        if (strToFix.length == 1) {
            return strToFix.toUpperCase();
        }
        else {
            return strToFix.substring(0, 1).toUpperCase() + strToFix.substring(1, strToFix.length).toLowerCase();
        }
    }
    else {
        return strToFix;
    }
}


function imgTextMouseOver(strBaseID) {
    var imgName = '#img' + strBaseID;
    var src = $(imgName).attr("src").replace("_UP.gif", "_OVR.gif");
    $(imgName).attr("src", src);

    var txtName = '#txt' + strBaseID;
    $(txtName).css("text-decoration", "underline");

}

function imgTextMouseOut(strBaseID) {
    var sName = '#img' + strBaseID;
    var src = $(sName).attr("src").replace("_OVR.gif", "_UP.gif");
    $(sName).attr("src", src);

    var txtName = '#txt' + strBaseID;
    $(txtName).css("text-decoration", "none");
}

function replaceAll(txt, replace, with_this) {
    return txt.replace(new RegExp(replace, 'g'), with_this);
}

String.prototype.ReplaceAll = function (stringToFind, stringToReplace) {
    var temp = this;
    var index = temp.indexOf(stringToFind);
    while (index != -1 && stringToFind.length > 0) {
        temp = temp.substring(0, index) + temp.substring(index).replace(stringToFind, stringToReplace);
        index = temp.indexOf(stringToFind, index + stringToReplace.length);
    }
    return temp;
};


function js_resolveURL(path) {
    return path.replace("~/", glb_ResolveUrlJs_Base);
}

function getURLParameter(name) {
    var oneParam = new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)', 'gi');

    return decodeURIComponent((oneParam.exec(location.search) || [, ""])[1].replace(/\+/g, '%20')) || null;
}



//WAS ON GWTR -- 

function openDialog(title, innerHTML, isModal, width) {

    msgDialog = document.createElement("div");
    msgDialog.id = "messageDialog";
    msgDialog.setAttribute("title", title);
    msgDialog.innerHTML = innerHTML;
    document.body.appendChild(msgDialog);
    var jqObj = $(msgDialog)

    jqObj.css("width", "440px");
    var widthOfJqObj = jqObj.width();
    var heightOfJqObj = jqObj.height();

    // Check if dialog will scroll horizontally
    if (msgDialog.scrollWidth > widthOfJqObj) {
        // Try make the dialog scoll horizontally as little as possible while keeping it smaller than the outer window size
        var newWidth = Math.min($(window).width() - 100, msgDialog.scrollWidth + 10);
        jqObj.css("width", newWidth.toString() + "px");
        widthOfJqObj = newWidth;
    }

    var initialDialogOption = {
        width: widthOfJqObj + 20,
        resizable: true,
        modal: false
    };

    if (!Globals.Utilities.isUndefinedOrNull(isModal)) {
        initialDialogOption.modal = isModal;
    }

    if (!Globals.Utilities.isUndefinedOrNull(width)) {
        initialDialogOption.width = width;
    }

    jqObj.dialog(initialDialogOption);
    if (jqObj.parent().height() + 10 > $(window).height()) {
        jqObj.dialog("option", "height", $(window).height() - 10);
        jqObj.height($(window).height() - 80);
    }
    return jqObj
}

function closeDialog() {
    $("#messageDialog").dialog('close');
    $("#messageDialog").dialog('destroy').remove();
}





function openYesNo(title, innerHTML, onYes, onNo) {
    msgDialog = document.createElement("div");
    msgDialog.style.fontSize = "0.7em";
    msgDialog.style.paddingLeft = "0.5em";
    msgDialog.setAttribute("title", title);
    msgDialog.innerHTML = innerHTML;
    document.body.appendChild(msgDialog);
    $(msgDialog).width(440);
    while ($(window).height() < $(msgDialog).height() + 100 && $(msgDialog).width() * 1.5 < $(window).width()) {
        $(msgDialog).width($(msgDialog).width() * 1.5);
    }

    $(msgDialog).dialog({ width: $(msgDialog).width() + 20, height: $(msgDialog).height() + 160, resizable: true, buttons: { No: onNo, Yes: onYes } });

    if ($(msgDialog).parent().height() + 10 > $(window).height()) {
        $(msgDialog).dialog("option", "height", $(window).height() - 10);
        $(msgDialog).height($(window).height() - 80);
    }

}





/// This is a generic function that gets called at Logout
///

function LogoutBodyOnload() {
    StopSessionTrackerTimer();
    //put this deletion operation on a try catch (do nothing) in case jQuery cookie plugin changes its specs.
    try {
        Globals.Cookies.deleteCookie("lastViewedMenuTab");
    }
    catch (e1) {

    }
    loadPage('/Login/Logout.aspx');
}
;
/*globals calCultureType*/
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// START OF GLOBAL UI FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

// Register "Globals" in JS as a valid object.
if (typeof (Globals) === "undefined" || Globals === null) {
    Globals = {};
}

Globals.UI = {

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// START OF jQUERY TOOLBAR/SEARCH BAR FUNCTIONS
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name: Globals.UI.showSimpleDialog
	// Desc: just like Globals.UI.showjQueryToolbarDialog, but simpler for just a dumb dialog box of text
	//
	// Inputs: dialogText, dialogTitle (required)
	//         dialogWidth, dialogHeight (optional)
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	showSimpleDialog: function (dialogText, dialogTitle, dialogWidth, dialogHeight) {
		var objectID = "simpleDialog_" + (new Date()).getTime().toString();
		$("body").append("<div id='" + objectID + "'></div>");
		this.showjQueryToolbarDialog(objectID, dialogWidth, dialogHeight, dialogTitle, dialogText, null, null, null, null);
		return objectID;
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name: Globals.UI.showjQueryToolbarDialog
	// Desc: Builds and displays a modal jQuery dialog underneath the specified toolbar/searchbar button.
    //
	// Inputs: toolbarSectionItemID - ID string of target toolbar section
	//		dialogWidth - Width (in pixels) of dialog box. Enter 0 to use default value of 300.
	//		dialogHeight - Height (in pixels) of dialog box. Enter 0 to use default value of "auto".
	//		dialogTitle - Title of dialog box (displays at top of box)
	//		dialogContent - HTML content for dialog box
	//      onOpen - Function to be called once dialog is opened
    //      alwaysUseSpecifiedHeight - Used to specify the dialog height
    //      RemoveOnClick - Determines whether the dialog should close when the user clicks outside
    //      OnClose - Function to be called before the dialog is about to close
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	showjQueryToolbarDialog: function (toolbarSectionItemID, dialogWidth, dialogHeight, dialogTitle, dialogContent, onOpen, alwaysUseSpecifiedHeight, RemoveOnClick, OnClose, specifiedPosition) {
		var fullDivID = "dialog_" + toolbarSectionItemID;
		var fullDivJQObj = $("#" + fullDivID);

		var removeOnClick = false;
		if (!Globals.Utilities.isUndefinedOrNull(RemoveOnClick)) {
			removeOnClick = RemoveOnClick;
		}

		// If dialog already exists, close it (i.e., remove it from DOM) before re-building
		if (fullDivJQObj.length !== 0) {
			//$fullDivJQObj.dialog("close");
			fullDivJQObj.dialog("close");
		}
		else {
			//For performance consideration we are not appending the HTML here since JQuery UI takes forever to render the dialog in IE7.
			var titleAttr;
			if (dialogTitle == null) {
				titleAttr = "";
			}
			else {
				titleAttr = "title='" + dialogTitle + "'";
			}
			fullDivJQObj = $("<div id='" + fullDivID + "' " + titleAttr + "></div>").appendTo("body");
		}

		// Set default values for jQuery dialog box
		var x = 300;
		var y = "auto";
		var maxDialogHeight = Math.ceil(($(window).height()) * 0.5); //dialog shouldn't be bigger than the window viewport

		if (!Globals.Utilities.isUndefinedOrNull(dialogWidth) && dialogWidth > 0) {
			x = dialogWidth;
		}

        //ie is not supported anymore
		//if ($.browser.msie || (alwaysUseSpecifiedHeight && !Globals.Utilities.isUndefinedOrNull(alwaysUseSpecifiedHeight))) {
		//	if (!Globals.Utilities.isUndefinedOrNull(dialogHeight) && dialogHeight > 0) {
		//		y = dialogHeight;
		//	}
		//}

		var dialogPosition;
		if (specifiedPosition != null) {
			dialogPosition = specifiedPosition;
		}
		else if (toolbarSectionItemID.indexOf("simpleDialog_") === 0) { // starts with
			var centerIn = $("#divOuterDiv");
			if (centerIn.length == 0) {
				centerIn = window;
			}
			dialogPosition = { "my": "center center", "at": "center center", "of": centerIn };
		}
		else {
			dialogPosition = { "my": "left top", "at": "left bottom", "of": "#" + toolbarSectionItemID };
		}

		fullDivJQObj.dialog({
			position: dialogPosition,
			width: x,
			height: y,
			maxHeight: maxDialogHeight,
			modal: true,
			close: function (event, ui) {
				if (!Globals.Utilities.isUndefinedOrNull(OnClose)) {
					OnClose();
				}
				$(this).empty().dialog('destroy').remove();
            },
            closeText: "",
			open: function (event, ui) {
				if (removeOnClick) {
					$('.ui-widget-overlay').bind('click', function () {
						if (Globals.Utilities.isUndefinedOrNull(OnClose)) {
							Globals.UI.closejQueryToolbarDialog(toolbarSectionItemID);
						}
						else {
							Globals.UI.closejQueryToolbarDialog(toolbarSectionItemID, OnClose);
						}

					});
				}
				if (!Globals.Utilities.isUndefinedOrNull(onOpen)) {
					onOpen();
				}
			}
		});

		//now that we have the schelectal dialog object created we can now append the content. 
		fullDivJQObj.html(dialogContent);

		Globals.UI.modernizeHTMLElements({ "ElementID": fullDivID });
		//return the object if the code who calls it wish to customize it some more.
		return fullDivJQObj;
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name: Globals.UI.closejQueryToolbarDialog
	// Desc: Closes specified modal jQuery dialog and removes it from the DOM
	// Inputs: toolbarSectionItemID - ID string of target toolbar section
    //      OnClose - Function to be called before the dialog is about to close
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	closejQueryToolbarDialog: function (toolbarSectionItemID, OnClose) {
		if (!Globals.Utilities.isUndefinedOrNull(OnClose)) {
			OnClose();
		}

		var fullDivID = "dialog_" + toolbarSectionItemID;
		$("#" + fullDivID).empty().dialog('destroy').remove();
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name: Globals.UI.isJqueryDialogOpen
	// Desc: This function will check if a JQuery dialog is openned or not. NOTE: The dialog in question must be
    //       created by this JS Library!!!!!
	// Inputs: DialogID - ID of the dialog to test
    //
    // Returns: True if it is opened false otherwise or when things goes wrong.      
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	isJqueryDialogOpen: function (DialogID) {
		var returnValue = false;
		if (!Globals.Utilities.isUndefinedOrNull(DialogID)) {
			try {
				var jqDialog = $("#dialog_" + DialogID);
				if (jqDialog.length > 0 && jqDialog.dialog("isOpen")) {
					returnValue = true;
				}
			}
			catch (e2) {
				returnValue = false;
			}
		}
		return returnValue;
	},

    /*///////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Name:    Globals.UI.appendTojQueryToolbarDialog
    // Desc:    TO DO
    // Inputs:  toolbarSectionItemID - To be comented
    //          elementToAppend - To be comented
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	appendTojQueryToolbarDialog: function (toolbarSectionItemID, elementToAppend) {
		var fullDivID = "dialog_" + toolbarSectionItemID;
		fullDivID.appendChild(elementToAppend);
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name: Globals.UI.appendWarningTojQueryToolbarDialog
	// Desc: Appends a warning string to the specified modal jQuery dialog. Overwrites any previous warnings.
	// Inputs: toolbarSectionItemID - ID string of target toolbar section
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	appendWarningTojQueryToolbarDialog: function (toolbarSectionItemID, warningText) {
		var fullDivID = "dialog_" + toolbarSectionItemID;
		//check if there's a previous warning
		if ($("#" + fullDivID + " .js--div--display-warning").length > 0) {
			$("#" + fullDivID + " .js--div--display-warning").val(warningText);
		}
		else {
			$("#" + fullDivID).append("<div class=\"js--div--display-warning\">" + warningText + "</div>");
		}

	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name: Globals.UI.addButtonsTojQueryToolbarDialog
	// Desc: Adds a button pane to the specified modal jQuery dialog.
	// Inputs: toolbarSectionItemID - ID string of target toolbar section
	//		buttonArray - Array of buttons to add to dialog. See jQuery docs for proper array structure.
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	addButtonsTojQueryToolbarDialog: function (toolbarSectionItemID, buttonArray) {
		var fullDivID = "dialog_" + toolbarSectionItemID;
		$("#" + fullDivID).dialog("option", "buttons", buttonArray);
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// END OF jQUERY TOOLBAR/SEARCH BAR FUNCTIONS
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Name:    Globals.UI.setContentContainerHeight
    // Desc:    This method will set the height of the content container. It will try to calculate the proper height based on certain
    //          other factors to consider.
    // Inputs:  ContainerID - The ID of the container that needs to have its height adjusted.
    //          OtherContainers - This is an array of containerIDs that would affect the height of the container value.
    //                            This means any footer values etc.
    //          DiscretionaryPadding - Fancy name for a fudge factor / padding that is kind of hard coded.
    // Returns: The inner height and width of the container should you need it.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	setContentContainerHeight: function (ContainerID, OtherContainers, MinimumContainerHeight, DiscretionaryPadding) {

		var containerHeight = parseInt($(window).height(), 10) - parseInt($("#" + ContainerID).offset().top, 10);

		if (Globals.Utilities.isArray(OtherContainers)) {
			var numberOfOtherContainersToDeal = OtherContainers.length;
			for (var i = 0; i < numberOfOtherContainersToDeal; i++) {
				containerHeight -= parseInt($("#" + OtherContainers[i]).outerHeight(), 10);
			}
		}

		// this is to make sure that the discretionary padding is needed.
		try {
			containerHeight -= DiscretionaryPadding;
		}
		catch (e) {
			//do nothing
		}
		try {
			containerHeight = Math.max(containerHeight, MinimumContainerHeight);
		}
		catch (e) {
			// do nothing since we just accept the container height.
		}

		$("#" + ContainerID).css("height", containerHeight + "px");
		$("#" + ContainerID).css("overflow-y", "auto");
		var returnObj = {
			width: $("#" + ContainerID).innerWidth(),
			height: $("#" + ContainerID).innerHeight()
		};
		return returnObj;
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name: Globals.UI.makeCheckboxIntoAllCheckboxForOtherCheckboxes
	// Desc: Creates "all" functionality on one checkbox for a group of checkboxes
	//		i.e., if you click the "all" box, all the others get set to that status;
	//		if you check any of the other boxes, the "all" box gets checked if the others are all checked;
	//		and on initialization, the "all" box gets checked if the others are all checked
	// Inputs: allCheckboxSelector - the jquery selector of the checkbox that should act as the ALL checkbox
	//		otherCheckboxesSelector - the jquery selector of all checkboxes that should act as a group controlled by the all checkbox
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	makeCheckboxIntoAllCheckboxForOtherCheckboxes: function (allCheckboxSelector, otherCheckboxesSelector, afterCheckAllFunction) {
		Globals.UI.setAllCheckboxStatusBasedOnOtherCheckboxes(allCheckboxSelector, otherCheckboxesSelector);

		$(allCheckboxSelector).on("change", function () {
            if ($(this)[0].checked) {
                //@ CHANGE FOR JQUERY 3.6
                //$(otherCheckboxesSelector).attr("checked", "checked");
                $(otherCheckboxesSelector).prop('checked', true);
			}
            else {
                //@ CHANGE FOR JQUERY 3.6
                //$(otherCheckboxesSelector).removeAttr("checked");
                $(otherCheckboxesSelector).prop('checked', false);
			}

			if (afterCheckAllFunction != null) {
				afterCheckAllFunction.call();
			}
		});

		$(otherCheckboxesSelector).on("change", function () {
			Globals.UI.setAllCheckboxStatusBasedOnOtherCheckboxes(allCheckboxSelector, otherCheckboxesSelector);
		});
	},

	setAllCheckboxStatusBasedOnOtherCheckboxes: function (allCheckboxSelector, otherCheckboxesSelector) {
		if ($(otherCheckboxesSelector).length == $(otherCheckboxesSelector).filter(":checked").length) { // all children are checked
            //@ CHANGE FOR JQUERY 3.6
            //$(allCheckboxSelector).attr("checked", "checked");
            $(allCheckboxSelector).prop("checked", true);
		}
        else {
            //@ CHANGE FOR JQUERY 3.6
            //$(allCheckboxSelector).removeAttr("checked");
            $(allCheckboxSelector).prop("checked", false);
		}
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// START OF jQUERY based UI tools
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name:    Globals.UI.isElementVisibleInContainer
	// NOTE:    There is a dependency with Global.Utilities.js since this function needs to check if the elem parameter is actually a jQuery object.
	// Desc:    Checks if the element is actually viewable to the user within a given viewContainer. So this way this method takes into consideration the
	//          relevant viewing area as opposed to what the browser window can see. If view Container is null then it will use the window object.
	// Inputs:  element           - The element that we are trying to see if it is viewable in the browser.
	//		    viewContainerID   - The view container ID so it could be the ID of a DIV or it could be the Windows Object. (OPTIONAL)
	// Returns: TRUE if it is viewable false otherwise.
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	isElementVisibleInContainer: function (element, viewContainerID) {
		var jqElemToTest = element;
		var jqViewContainer;

		//these variables will store the top and bottom of the viewable document area.
		var docViewTop, docViewBottom;
		//these variables will store top and bottom coordinates that the element actually is shown.
		var elemTop, elemBottom;

		//test if the parameters are jQuery objects if not then make them jQuery Objects
		if (!Globals.Utilities.isObjectAJQueryObject(element)) {
			jqElemToTest = $(element);
		}

		//if the viewContainerID is null (i.e. its not passed then let's assert they mean the whole browser window)
		if (Globals.Utilities.isUndefinedOrNull(viewContainerID)) {
			jqViewContainer = $(window);
			docViewTop = jqViewContainer.scrollTop();
		}
		else {
			jqViewContainer = $("#" + viewContainerID);
			docViewTop = jqViewContainer.offset().top;
		}

		//now I need bottom of what is viewable.
		docViewBottom = docViewTop + jqViewContainer.height();

		//let's get the element's possition on screen to see if it is actually on screen.
		elemTop = jqElemToTest.offset().top;
		elemBottom = elemTop + jqElemToTest.height();

		// if the bottom of the element less then the height of the doc view and the top of the element is greather than the top y-coordinates of the 
		// top of the viewing container then this is visible. Otherwise it is not.        
		return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name:    Globals.UI.modernizeHTMLElements
	// Desc:    Converts a set of HTML elements to the modernized look of jQuery. 
    //          HTML elements must be tagged with the proper classnames in order to be updated.
    //          Please refer to /Resources/CSS/Selectors/_DO-NOT-INCLUDE-jsSelectorsDocumentation.css for a list of pre-defined selectors
    //          Specifically,
    //          -converts buttons to jQuery buttons
    //          -adds round corners to textboxes/textareas
	// Inputs:  
    //          OptionsObj {
    //                  "ElementID": The ID of element you want to filter in,
    //                  "RenderingFunction": Modernizing function that needs to execute,
    //                  "Parameters" : The parameters to pass,
    //                  }
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	modernizeHTMLElements: function (OptionsObj) {
		var objTest = Globals.Utilities.isUndefinedOrNull;
		// let's apply this for site theming for now
		if (Globals.UI.isSiteThemeEnabled()) {
			var optionsObjExists = !objTest(OptionsObj);
			var includeThisElementID = " ";

			if (optionsObjExists && !objTest(OptionsObj.ElementID)) {
				includeThisElementID = "#" + OptionsObj.ElementID + " ";
			}

			// call the standards for knotia flat if there are other style types of sister sites populate the SiteStyle
			Globals.UI.knotiaFlatModernizeStandardElements(includeThisElementID);

			if (optionsObjExists && !objTest(OptionsObj.RenderingFunction)) {
				if (!objTest(OptionsObj.Parameters)) {
					OptionsObj.RenderingFunction(includeThisElementID, OptionsObj.Parameters);
				}
				else {
					OptionsObj.RenderingFunction(includeThisElementID);
				}
			}
		}
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Name:    Globals.UI.knotiaFlatModernizeStandardSelects
    // Desc:    Convert the select tags to modern jQuery UI designs and filters by the JS css selectors.
    // Inputs:  ElementID   - Parent element of the html tags to be converted. If not passed in, it will grab from the entire DOM.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	knotiaFlatModernizeStandardElements: function (ElementID) {
		if (Globals.UI.isSiteThemeEnabled()) {
			Globals.UI.knotiaFlatModernizeStandardSelects(ElementID);
			Globals.UI.knotiaFlatModernizeStandardButtons(ElementID);
			Globals.UI.knotiaFlatModernizeStandardTextBoxes(ElementID);
			Globals.UI.knotiaFlatModernizeStandardBulletLinkLists(ElementID);
			Globals.UI.knotiaFlatModernizeStandardBulletLists(ElementID);
			Globals.UI.knotiaFlatModernizeStandardLabels(ElementID);
		}
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Name:    Globals.UI.knotiaFlatAttachHoverEvents
    // Desc:    Convert any PNG images to have an alternate on hover event. Unlike the other helper functions this is a global change.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	knotiaFlatAttachHoverEvents: function () {
		if (!Globals.UI.isSiteThemeEnabled()) {
			return;
		}
		$(document).on('mouseover', '.js--img--pnghover', function (event) {
			event.stopPropagation();
            var currObject = $(this);
            if (currObject.length > 0
                && !Globals.Utilities.isUndefinedOrNull(currObject.attr('src'))
                    && currObject.attr('src').indexOf('-hover') === -1) {
				var newSrc = currObject.attr('src').replace('.png', '-hover.png');
				currObject.attr('src', newSrc);
			}
		});

		$(document).on('mouseout', '.js--img--pnghover', function (event) {
			event.stopPropagation();
			var currObject = $(this);
			if (currObject.length > 0 && !Globals.Utilities.isUndefinedOrNull(currObject.attr('src'))) {
				var newSrc = currObject.attr('src').replace('-hover.png', '.png');

				currObject.attr('src', newSrc);
			}
		});
	},

    /*///////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Name:    Globals.UI.useDivOuterDivElementIDForKnotia
    // Desc:    This method will test if the paramater being passed is empty for the ElementID if it is it will return #divOuterDiv
    //          otherwise use the ElementID being paseed.
    // Inputs:  ElementID   - Parent element of the html tags to be converted. If not passed in, it will grab from the entire DOM.
    // Returns: The ElementID being passed or the #divOuterDiv string.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	useDivOuterDivElementIDForKnotia: function (ElementID) {
	    var returnValue = ElementID;
	    if (Globals.Utilities.isNullOrWhitespace(ElementID)) {
	        returnValue = "#divOuterDiv";
	    }
	    return returnValue;
    },
	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name:    Globals.UI.knotiaFlatModernizeStandardBulletLinkLists
	// Desc:    Convert the UL tags to modern jQuery UI designs and filters by the JS css selectors.
	// Inputs:  ElementID   - Parent element of the html tags to be converted. If not passed in, it will grab from the entire DOM.
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	knotiaFlatModernizeStandardLabels: function (ElementID) {
	    var elementIDToUse = Globals.UI.useDivOuterDivElementIDForKnotia(ElementID);

	    if (Globals.UI.isSiteThemeEnabled())
	    {   
	        $(elementIDToUse).find(".js--td--align-label").attr("align", "right");
	        $(elementIDToUse).find(".js--td--adjust-column-width").attr("width", "20%");
	        
		}
	},
	
	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name:    Globals.UI.knotiaFlatModernizeStandardBulletLinkLists
	// Desc:    Convert the UL tags to modern jQuery UI designs and filters by the JS css selectors.
	// Inputs:  ElementID   - Parent element of the html tags to be converted. If not passed in, it will grab from the entire DOM.
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	knotiaFlatModernizeStandardBulletLinkLists: function (ElementID) {
	    var elementIDToUse = Globals.UI.useDivOuterDivElementIDForKnotia(ElementID);

	    if (Globals.UI.isSiteThemeEnabled())
	    {
	        $(elementIDToUse).find(".js--unorderedlist--apply-bullet-style").addClass("arrow-bullet");
		}
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name:    Globals.UI.knotiaFlatModernizeStandardBulletLists
	// Desc:    Convert the LI tags to modern jQuery UI designs and filters by the JS css selectors.
	// Inputs:  ElementID   - Parent element of the html tags to be converted. If not passed in, it will grab from the entire DOM.
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	knotiaFlatModernizeStandardBulletLists: function (ElementID) {
	    var elementIDToUse = Globals.UI.useDivOuterDivElementIDForKnotia(ElementID);

	    if (Globals.UI.isSiteThemeEnabled())
	    {
		    Globals.UI.knotiaFlatModernizeStandardBulletLinkLists(ElementID);
		    $(elementIDToUse).find(".js--listitem--text-only").addClass("black");
		    
		}
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name:    Globals.UI.knotiaFlatModernizeStandardSelects
	// Desc:    Convert the select tags to modern jQuery UI designs and filters by the JS css selectors.
	// Inputs:  ElementID   - Parent element of the html tags to be converted. If not passed in, it will grab from the entire DOM.
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	knotiaFlatModernizeStandardSelects: function (ElementID) {
	    var elementIDToUse = Globals.UI.useDivOuterDivElementIDForKnotia(ElementID);

	    if (Globals.UI.isSiteThemeEnabled()) {
	        
	        $(elementIDToUse).find(".js--select--adjust-width").css("width", "90%");
	        $(elementIDToUse).find(".js--select--adjust-width-medium").css("width", "50%");
	        $(elementIDToUse).find(".js--select--adjust-width-small").css("width", "25%");
	        
		}
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Name:    Globals.UI.knotiaFlatModernizeStandardButtons
    // Desc:    Convert the buttons to modern jQuery UI designs and filters by the JS css selectors.
    // Inputs:  ElementID   - Parent element of the html tags to be converted. If not passed in, it will grab from the entire DOM.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	knotiaFlatModernizeStandardButtons: function (ElementID) {
	    var elementIDToUse = Globals.UI.useDivOuterDivElementIDForKnotia(ElementID);

	    if (Globals.UI.isSiteThemeEnabled()) {
	        $(elementIDToUse).find(".js--button--align-wrapper").css("text-align", "right");
	        $(elementIDToUse).find(".js--button--convert-to-jQuery").button();
	        
		}
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Name:    Globals.UI.knotiaFlatModernizeStandardTextBoxes
    // Desc:    Convert the text boxes to modern jQuery UI designs and filters by the JS css selectors.
    // Inputs:  ElementID   - Parent element of the html tags to be converted. If not passed in, it will grab from the entire DOM.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	knotiaFlatModernizeStandardTextBoxes: function (ElementID) {
	    var elementIDToUse = Globals.UI.useDivOuterDivElementIDForKnotia(ElementID);

	    if (Globals.UI.isSiteThemeEnabled()) {

	        $(elementIDToUse).find(".js--textbox--round-corners").addClass("text ui-widget-content ui-corner-all");
	        $(elementIDToUse).find(".js--textbox--adjust-width").css("width", "90%");
	        $(elementIDToUse).find(".js--textbox--adjust-width-medium").css("width", "50%");
	        $(elementIDToUse).find(".js--textbox--adjust-width-small").css("width", "25%");
	        $(elementIDToUse).find(".js--textarea--adjust-width").css("width", "80%");
	        
	        Globals.UI.knotiaFlatModernizeDatePickers(ElementID);

		}
	},

    /*///////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Name:    Globals.UI.knotiaFlatModernizeDatePickersWithJqWidgets
    // Desc:    For Future use - Convert the text boxes to modern jqWidgets designs and filters by the JS css selectors. 
    //          This also does hide the input element and add a div element to its parent because jqwedgets onlly works with div element
    // Inputs:  ElementID   - Parent element of the html tags to be converted. If not passed in, it will grab from the entire DOM.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	knotiaFlatModernizeDatePickersWithJqWidgets: function (ElementID) {
		if (!Globals.UI.isSiteThemeEnabled()) {
			return;
		}

	    var elementIDToUse = Globals.UI.useDivOuterDivElementIDForKnotia(ElementID);
	    var arrDatePickers = $(elementIDToUse).find(".js--textbox--convert-to-datepicker");
	    var arrLen = arrDatePickers.length;
	    var dateInputOptions = {
	        "width": '100px',
	        "height": '25px',
	        "formatString": 'yyyy-MM-dd',
	        "culture": calCultureType
	    };
        //commented in code review because this is un tested code in jqWidgets. Must be developed properly
	    //for (var i = 0; i < arrLen; i++) {
	    //    var currentElementID = arrDatePickers[i].id;
	    //    var calCultureType = GetString("CurrentLanguageAbbr") + '-CA';

	    //    $("#" + currentElementID).after("<div id='div" + currentElementID + "'></div>").hide();
            
	    //    $("#div" + currentElementID).jqxDateTimeInput(dateInputOptions).on('change', function (event) {
        //        // Put the value of selected date from DIV into the INPUT
	    //        var date = $(this).jqxDateTimeInput('value');
	    //        var formattedDate = $.jqx.dataFormat.formatdate(date, 'yyyy-MM-dd');
	    //        $("#" + this.id.replace("div", "")).val(formattedDate);
	    //    }).on('open', function (event) {
        //        // Close all the open calendars
	    //        for (var j = 0; j < arrLen; j++) {
	    //            if (i != j) {
	    //                $("#div" + arrDatePickers[j].id).jqxDateTimeInput('close');
	    //            }
	    //        }
	    //    });

        //    //Align the "end datepicker" to the right of the associated input
	    //    if (currentElementID === "datepickerEnd") {
	    //        $("#div" + currentElementID).jqxDateTimeInput({ dropDownHorizontalAlignment: 'right' });
	    //    }
	    //}
	},

    /*///////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Name:    Globals.UI.knotiaFlatModernizeDatePickers
    // Desc:    Convert the text boxes to modern jQuery UI designs and filters by the JS css selectors.
    // Inputs:  ElementID   - Parent element of the html tags to be converted. If not passed in, it will grab from the entire DOM.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	knotiaFlatModernizeDatePickers: function (ElementID)
	{
	    var elementIDToUse = Globals.UI.useDivOuterDivElementIDForKnotia(ElementID);
	    if (Globals.UI.isSiteThemeEnabled()) {
	        // localzing the datepicker with the current language
	        $.datepicker.setDefaults($.datepicker.regional[GetString("CurrentLanguageAbbr")]);

	        var dateFormat = "yy-mm-dd";
	        if (document.dateFormat && document.dateFormat != "dd MMM yyyy") {
	        	dateFormat = document.dateFormat;
	        }


	        var datePickerOptions = {
	            "showOn" : "both",
	            "buttonImage" : "/UserControls/Toolbar/Images/KNOTIAFLAT/Icons/Flat-Calendar.png",
	            "buttonImageOnly" : true,
	            "buttonText" : GetString("str_ChooseDate"),
	            "dateFormat": dateFormat,
	            "beforeShow": function () {
	                setTimeout(function () {
	                    $(".ui-datepicker").css("z-index", "2001");
	                }, 250);
	            }
	        };
	        $(elementIDToUse).find(".js--textbox--convert-to-datepicker").datepicker(datePickerOptions);

	        var cssOptions = {
	            "vertical-align": "text-bottom",      
            };

	        $(elementIDToUse).find(".hasDatepicker").css(cssOptions);
            // Defining CSS options for Calendar 
	        cssOptions = {
	            "vertical-align": "text-bottom",
	            "position": "relative",
	            "right": "0px"
	        };

	        $(elementIDToUse).find(".ui-datepicker-trigger").css(cssOptions);
	        
	    }
	},

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// END OF jQUERY based UI tools
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // START OF HTML DOM tools
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Name:    Globals.UI.observeDomChangeAttributeToObjectWithoutParameters
    // NOTE:    This will create a global document object called document.knotiaObserver if the MutationObserver object exists.
    //          look at this for an example: michalbe.blogspot.ca/2013/04/javascript-less-known-parts-dom.html
    // Desc:    This is a simplification of DOM change monitor for any attribute changes for a given objectID name. 
    //          If a modern browser is used then MutationObserver object is used other wise we bind the given object the
    //          DOMSubtreeModified method. (IE 9). For IE 8 propertychange event was added.
    // Inputs:  elementToObserve  - The element that we are trying to see what the changes are please put # at the begining of the ID value.
    //		    callBackFunction  - The funciton as an object e.g. if you have doWork() just pass it as doWork
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	observeDomChangeAttributeToObjectWithoutParameters: function (elementToObserve, callBackFunction) {
		var browserMutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;

		// if it is a modern browser.
		if (typeof browserMutationObserver != "undefined") {
			var objToObserve = document.querySelector(elementToObserve);
			var observerConfig = {
				attributes: true,
				childList: false,
				characterDate: false
			};
			document.knotiaObserver = new browserMutationObserver(function (mutations) {
				mutations.forEach(function (mutation) {
					if (mutation.type == "attributes") {
						callBackFunction();
					}
				});
			});
			document.knotiaObserver.observe(objToObserve, observerConfig);
		}
			// if we are using IE 9 & IE 8
		else {
			$(elementToObserve).on("DOMSubtreeModified propertychange", function () {
				callBackFunction();
			});
		}
	},
	/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // END OF HTML DOM tools
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

	// Name:    Globals.UI.selectAllTextInSpecifiedDiv
	selectAllTextInSpecifiedDiv: function (divID) {
		if (document.selection) {
			document.selection.empty();

			var range = document.body.createTextRange();
			range.moveToElementText(document.getElementById(divID));
			range.select();
		} else if (window.getSelection) {
			window.getSelection().removeAllRanges();

			var range = document.createRange();
			range.selectNode(document.getElementById(divID));
			window.getSelection().addRange(range);
		}
	},
	/*////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Name: Globals.UI.isSiteThemeEnabled
    // Desc: This method will determine if site thme is enabled or not.
    // Returns: True if the hdnField exists and the value is > 0 otherwise false.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	isSiteThemeEnabled: function () {
		var hdnField = $("#hdnUseSiteTheme");
		var returnValue = false;
		try {
			if (hdnField.length !== 0 && parseInt(hdnField.val(), 10) > 0) {
				returnValue = true;
			}
		}
		catch (e) {
			returnValue = false;
		}
		return returnValue;
	},

	/*////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name: Globals.UI.displayFadingMessage
	// Desc: displays a message that fades and disappears
	// Returns: nothing
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	displayFadingMessage: function (divID, message, timeToWaitBeforeFading) {
		if (timeToWaitBeforeFading == null) {
			timeToWaitBeforeFading = 990;
		}

		var div = $("#" + divID);
		div.html("<span class=\"fading-message\">" + message + "</span>");
		div.show();
		div.animate({ opacity: "1" }, 10).animate({ opacity: "1" }, timeToWaitBeforeFading).animate({ opacity: "0" }, 1000, function () { div.hide(); });
	},

	/*////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name: Globals.UI.fadeOut
	// Desc: fades a message out
	// Returns: nothing
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	fadeOut: function (divID) {
		var div = $("#" + divID);
		div.animate({ opacity: "0" }, 1000, function () { div.hide(); });
	},

	/*////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name: Globals.UI.handleEnterKeyPressInInputField
	// Desc: performs an action if the enter key is pressed in the specified input field
	// Returns: nothing
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	handleEnterKeyPressInInputField: function (inputFieldID, actionFunction) {
		$("#" + inputFieldID).on("keypress", function (event) {
			if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
				actionFunction.call();
				event.stopPropagation();
				return false;
			}
		});
	},

	/*////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Name: Globals.UI.showProcessingStatusDialog
	// Desc: Opens a modal dialog with a "processing" message
	// Params: dialogContent: the text of the message, or null to close the dialog
	// Returns: nothing
	///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
	showProcessingStatusDialog: function (dialogContent, includeCloseButton) {
		var fullDivJQObj = $("#processingStatusDialog");

		if (dialogContent == null) {
			this.removeProcessingStatusDialog();
			return;
		}

		if (fullDivJQObj.length == 0) {
			fullDivJQObj = $("<div id='processingStatusDialog' title='Processing'></div>").appendTo("body");
		}

		fullDivJQObj.dialog({
			modal: true
		});

		var content = "<p style='font-size:10pt;'>" + dialogContent + "</p>";
		if (includeCloseButton) {
			content += "<button onclick=\"$('#processingStatusDialog').empty().dialog('destroy').remove();\" style='font-size:10pt'>Close</button>";
		}

		fullDivJQObj.html(content);
	},

	removeProcessingStatusDialog: function () {
		var fullDivJQObj = $("#processingStatusDialog");
		if (fullDivJQObj.length > 0) {
			fullDivJQObj.empty().dialog('destroy').remove();
		}
	}
};
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// END OF GLOBAL UI FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
;
if (typeof (Globals) === "undefined" || Globals === null) {
    Globals = {};
}

Globals.LanguageType = {
    Unspecified: -1,
    en: 1,
    fr: 2
};

///This is currently used for IGAA country type.
Globals.ExtendedCountryPropertyTypeID = {
    NOT_SET: 0,
    Country: 1,
    SpecialCountry: 2
};

Globals.PinboardItemType = {
    NOT_SET: 0,
    Document: 1,
    Search: 2,
    Notes: 3
};

Globals.PinboardSearchType = {
    NOT_SET: 0,
    SearchResultList: 1,
    SelectedSearchDocuments: 2
};

Globals.PinboardStates = {
    Collapsed: 0,
    Expanded: 1
};

Globals.Status = {
    NOT_SET: 0,
    Live: 0,
    Deleted: 2,
    Draft: -1
};

Globals.DoctypeID = {
    NOT_SET: 0,
    IGAANews: 6100
};

Globals.StringCaseType = {
    NOT_SET: 0,
    TitleCase: 1,
    SentenceCase: 2
};

Globals.InteractiveHelpType =
{
    NOT_SET: 0,
    SITEWIDE: 1,
    PRODUCTWIDE: 2
};

Globals.InteractiveHelpStatus =
{
    NOT_SET: 0,
    DRAFT: 1,
    LIVE: 2,
    ARCHIVED: 3,
    DELETED: 4
};

Globals.LearningMediaType = {
    NOT_SET: 0,
    VIEW_PRESENTATION: 1,
    DOWNLOAD_PRESENTATION: 2,
    DOWNLOAD_SLIDES: 3
};

Globals.MediaSizeOrDurationType =
{
    NOT_SET: 0,
    MEGABYTES: 1,
    MINUTES: 2
};

Globals.LearningNewsStatus =
{
    NOT_SET: 0,
    NEW: 1,
    SAVED: 2,
    RELEASED: 3
};

Globals.SiteType =
{
    NOT_SET: 0,
    EYTaxNavigator: 2,         // Internal EY Tax Navigator site
    EYOnlineUS: 3,             // Canadian Tax Library site (login via EY Client Portal)
    CCRA: 4,                   // Canada Revenue Agency site
    EYO_Inactive: 5,           // INACTIVE
    Knotia: 6,                 // Main Knotia.ca site
    EYTaxNavigatorMNP: 8,      // Meyers Norris Penny private Tax Navigator portal
    KnotiaCOM_Inactive: 9,     // INACTIVE
    KnotiaEDU: 10,             // Knotia site for universities
    KnotiaCAUBO_Inactive: 11,  // INACTIVE
    KnotiaIDA: 12,             // INACTIVE
    CdnTaxLib_Inactive: 13,    // INACTIVE
    GWTR: 14,                  // Global Withholding Tax Reporter (uses GWTR Platform, login via Client Portal)
    GrantThornton: 15,         // Grant Thornton private Knotia portal
    EYAccountingPortal: 16,    // EY Accounting Portal site (login via EY Client Portal)
    EYAviation: 17,            // EY Aviation (formerly Tax Aviation Leasing Knowledgebase (TALK)) (uses GWTR Platform, login via Client Portal)
    IGAA: 18,                  // Intergovermental Agreement Analyzer (IGA Analyzer) (uses GWTR Platform, login via Client Portal)
    USTaxNewsExternal: 19,		// login via emailed validation link (not super secure, but no private content)
    USTaxNewsInternal: 20,		// EY SSO
    GTNUExternal: 21,			// login via emailed validation link (not super secure, but no private content)
    GTNUInternal: 22,			// EY SSO
    CATaxAlerts: 23,			// login via emailed validation link (not super secure, but no private content)
    AUSTaxExchange: 27,
    EXAMREF: 29                // CPA Canada Secure Exam
};

Globals.HotTopicsViewMode =
{
    NOT_SET: 0,
    LIST_VIEW: 1,
    GRID_VIEW: 2
};

Globals.AlertExtraMetadata =
{
    Key_EditLinks: 0,
    Key_IsInternalOnlyContent: 1,
    Key_IsExternalAndInternalContent: 2,
    Key_ExternalVersionAlertID: 3,
    Key_IsMarkFIDOContent: 4,
    Key_TwitterLink: 5,
    Key_LinkedInLink: 6,
    Key_FacebookLink: 7,
    Key_PromotionalMaterial: 8,
    Key_alertID: 9,
    Key_IsDocumentSharable: 10
};;
/*globals getObj, glb_sPageColor, createCenteredPopupDiv, glb_SiteStyle*/
/// <reference path="_references.js" />
var lockedImage = "NULL";
function hideSelectBox() {
	var boxObj = getObj("formSelectBox");
	var i = 1;
	while (boxObj) {
		boxObj.visibility = "hidden";
		i = i + 1;
		boxObj = getObj("formSelectBox" + i);
	}
}
function restoreSelectBox() {
	var boxObj = getObj("formSelectBox");
	var i = 1;
	while (boxObj) {
		boxObj.visibility = "visible";
		i = i + 1;
		boxObj = getObj("formSelectBox" + i);
	}
}
function showImage(menuId) {
	var imgName = menuId + "Image";
	var offImg = document [imgName].src;
	var onImgFile = offImg.substring(offImg.lastIndexOf("/")+1, offImg.lastIndexOf("."));
	if (onImgFile.indexOf("FX") == -1) {
		document[imgName].src = "/_IncludeFiles/DefinitionFiles_EYO/Images/TopMenu/" + onImgFile + "FX.gif";
	}
	else {
		lockedImage = onImgFile;
	}
}
function hideImage(menuId) {
	var imgName = menuId + "Image";
	var onImg = document [imgName].src;
	var offImgFile = onImg.substring(onImg.lastIndexOf("/")+1, onImg.lastIndexOf("FX."));
	if (lockedImage.indexOf(offImgFile) == -1) {
		document[imgName].src = "/_IncludeFiles/DefinitionFiles_EYO/Images/TopMenu/" + offImgFile + ".gif";
	}
}
function PopupWindow(pageURL, winName, winDimensions) {
	// pageUrl = destination
	// winName = name of window Created
	// winDimensions = WidthxHeight eg/ 800x600
	var toolbarStr;
	if (PopupWindow.arguments.length == 4) {
		toolbarStr = PopupWindow.arguments[3];
	} else {
		toolbarStr = "toolbar=no,scrollbars=no,resizeable=yes";
	}
	var winWidth = eval(winDimensions.substring(0, winDimensions.indexOf("x")));
	var winHeight = eval(winDimensions.substring(winDimensions.indexOf("x")+1, winDimensions.length));
	var xPos = (screen.availWidth - winWidth) / 2;
	var yPos = (screen.availHeight - winHeight) / 2;
	toolbarStr = toolbarStr + ",height="+winHeight+",width="+winWidth;
	var detWin = window.open(pageURL, winName, toolbarStr);
	try
	{
		detWin.moveTo(xPos, yPos);
		detWin.focus();
	}
	catch (exc)
	{
		// do nothing, sometimes it just won't do this
	}
}
function PopupInWindow(pageURL, winName, winDimensions) {
    // pageUrl = destination
    // winName = name of window Created
    // winDimensions = WidthxHeight eg/ 800x600
    var winWidth, winHeight;
    

    var sizeOfDialog = winDimensions.toString();
    //if-zilla ...grab the window size from the global strings if there is a glb_SiteStyle variable designated.
    // value is retrieved from GlobalStrings.js
    var sizeToUse = "str_SessionTracker_PopupScreenSize";
    if (!Globals.Utilities.isUndefinedOrNull(glb_SiteStyle)) {
        sizeToUse = "str_SessionTracker_PopupScreenSize_" + glb_SiteStyle;
        winDimensions = GetString(sizeToUse);
    }

    
    winWidth = parseInt(winDimensions.substring(0, winDimensions.indexOf("x")), 10);
    winHeight = parseInt(winDimensions.substring(winDimensions.indexOf("x") + 1, winDimensions.length), 10);
   
    
    winHeight = calculateWinHeightForSessionTrackerPopUp(winHeight);
    
    var innerHTML = '<iframe id="ifPopupInWin" frameBorder="0" width="' + winWidth + '" height="' + winHeight + '" src="' + pageURL + '"></iframe>';

    createCenteredPopupDiv(innerHTML, false, winName, "", false);
    //@ CHANGE FOR JQUERY 3.6
    //$("#ifPopupInWin").load(function () {
    $("#ifPopupInWin").on("load", function() {
        // do something once the iframe is loaded
        $("#popupHeadingTable .redHeader").html($("#ifPopupInWin")[0].contentWindow.document.title);        
    });
}


/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    calculateWinHeightForSessionTrackerPopUp
// Desc:    This function is used to calculate the height of the session tracker popup for IE.
// Input:   winHeight = The original height of the windows.
// Returns: The adjusted height of the windows for IE otherwise it will return the original height.
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function calculateWinHeightForSessionTrackerPopUp(winHeight) {
    var winHeightCalculated = winHeight;

    // IF Zilla
    if ($("#hdnUseSiteTheme").val()) {
        var browserInfo = Globals.Utilities.getBrowser();
        if (browserInfo.browser === "msie" || browserInfo.browser === "ie") {
       
            switch (browserInfo.version) {
                case 9: case 10:
                    winHeightCalculated += 13;
                    break;
                case 11:
                    winHeightCalculated += 10;
                    break;
                case 12:
                    winHeightCalculated += 5;
                    break;
                default:
                    //the original value was a -= 8 value this turns out to be not necessary.
                    break;
            }
        }
    }
    return winHeightCalculated;
}

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name     :   ShowLoginMessage
// Desc     :   This function will display the popup for the interactive help. If there is a video it will
//				initialize the MediaElement pluggin that interactive help requires to show the video.
// Inputs	:	WindowTitle -- The title that I should display on the jQueryUI dialogue.
//				WinDimensions -- deprecated but kept it since we have it all over the code and I don't want to
//								recompile the project.
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function ShowLoginMessage(WindowTitle, WinDimensions)
{
	var loginMessageContainerJQO = $("#LoginMessageContainer");

	loginMessageContainerJQO.css("visibility", "visible");
	loginMessageContainerJQO.dialog({
        autoOpen: false,
        width: 'auto',
        height: 'auto',
        modal: true,
        title: WindowTitle,
        close: function (event, ui) {
            var myplayer = $('#MediaElement')["0"];
            if (typeof (myplayer) !== "undefined" && myplayer !== null && myplayer.length !== 0) {
                myplayer.player.pause();
            }
        },
        resizable: false
    });
    
	loginMessageContainerJQO.dialog("open");
    $('video,audio').mediaelementplayer({
        enableAutosize: true,
        plugins: ['flash'],
        //features: ['playpause', 'current', 'duration', 'tracks', 'volume'],
        pluginPath: '/_IncludeFiles/Scripts/jQuery/MediaElements/',
        flashName: 'flashmediaelement.swf',
        success: function (player, node) {
            $('#' + node.id + '-mode').html('mode: ' + player.pluginType);
        }
    });
    //@ CHANGE FOR JQUERY 3.6
    //$(document).ready(function () {
    if (
        document.readyState === "complete" ||
        (document.readyState !== "loading" && !document.documentElement.doScroll)
    ) {
    	$("#me_flash_0").find('param[name="movie"]').val("/IncludeFiles/MediaElements/flashmediaelement.swf?x=" + Date.now());
    	//this is needed to make the title of the dialogue to be centre.
    	$(".ui-dialog-title").css("width", "99.5%").css("text-align", "center");
    	//this is needed tho remove the video player text 
    	$("span.mejs-offscreen").css("display", "none").css("visibility", "hidden");
    };

	Globals.Utilities.generateInlineStylesFromDataStyles();
}


/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name     :   closePopupInWin
// Desc     :   Closes the modal window and removes it from the DOM.
//
//              Changes made to accommodate JqueryUI
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function closePopupInWin() {    
    if ($("#popUpDivFromButton").length > 0) {
        $("#popUpDivFromButton").dialog('destroy').remove();
    }
}

function loadPage(newPage) {
	var dt = new Date();
	var gotoPage;
	if (newPage.indexOf("?") >= 0) {
		gotoPage = newPage + "&";
	} else {
		gotoPage = newPage + "?";
	}
	gotoPage = gotoPage + "nc=" + dt.getTime();
	window.location = gotoPage;
}
function noFrames() {
	if (parent.frames[0]) {
		top.location.href = self.location;
	}
}
function doNothing() { }
function printWindow(destinationPage) {
	if (document.submitThisFormToPrint) {
		document.submitThisFormToPrint.printFriendly.value = "2";
		document.submitThisFormToPrint.target = "_blank";
		document.submitThisFormToPrint.submit();
	} else {
		window.open(destinationPage, "", "");
	}
}

// ////////////////////////////////////////////
// Stuff for the left-hand navigation rollovers
// ////////////////////////////////////////////

// constant, kDelayTime, the number of milliseconds the page waits before changing open/close status of menus
var kDelayTimeShow = 250;
var kDelayTimeHide = 450;

// global vars
var glb_LeftHandNavMenus_DisplayedPopoutMenu = null;
var glb_LeftHandNavMenus_iEventDoSoon = new Array(0, 0, 0);

// function createDelayedEvent (function to call, after i seconds, the priority group of the event)
function createDelayedEvent (sEvent, iDelayTime, iGroup)
{
	// an iGroup event kills all events with the same iGroup or lower
	for (var i=0 ; i<=iGroup ; i++)
	{
		if (glb_LeftHandNavMenus_iEventDoSoon[i] > 0)
		{
			window.clearTimeout(glb_LeftHandNavMenus_iEventDoSoon[i]);
		}
	}
	glb_LeftHandNavMenus_iEventDoSoon[iGroup] = window.setTimeout(sEvent, iDelayTime);
}

// function LeftHandNavMenus_Highlight (item to highlight, whether to fully highlight or just outline (true, false))
function LeftHandNavMenus_HighlightItem (objItem, bFullyHighlight)
{
	if (document.all)
	{
		objItem.style.borderColor = "black";
		if (bFullyHighlight)
		{
			objItem.style.backgroundColor = "#333333";
		}
	}
}

// function LeftHandNavMenus_Unhighlight (item to unhighlight)
function LeftHandNavMenus_UnhighlightItem (objItem)
{
	if (document.all)
	{
		objItem.style.borderColor = glb_sPageColor;
		objItem.style.backgroundColor = glb_sPageColor;
	}
}

// fired by the PLBs when a mouse passes over a menu item, see if it has a popout
function LeftHandNavMenus_PopOutIfExists (sMenuName)
{
	if (document.all)
	{
		if (document.all["elPopout_" + sMenuName])
		{
			LeftHandNavMenus_EnablePopoutMenu(sMenuName, event);
		}
	}
}

// fired by the PLBs when a mouse passes out of a menu item, hide it's popout (if exists)
function LeftHandNavMenus_UnpopOutIfExists (sMenuName)
{
	if (document.all)
	{
		if (document.all["elPopout_" + sMenuName])
		{
			LeftHandNavMenus_DisablePopoutMenu();
		}
	}
}

// function LeftHandNavMenus_EnablePopoutMenu (name of element, firing element) -- causes a menu to become displayed
function LeftHandNavMenus_EnablePopoutMenu (sMenuName, evt)
{
	if (document.all)
	{
		if (document.all["elPopout_" + sMenuName].style.top == "0px")
		{
			var iThisElementTop = evt.clientY - 6 + document.body.scrollTop; // line is 12px, so 6 is the average of the pos within it that we will be
			createDelayedEvent("LeftHandNavMenus_private_hideAllPopoutMenus();LeftHandNavMenus_private_showPopoutMenu('" + sMenuName+ "', " + iThisElementTop +")", kDelayTimeShow, 2);
		}
		else
		{
			createDelayedEvent("LeftHandNavMenus_private_hideAllPopoutMenus();LeftHandNavMenus_private_showPopoutMenu('" + sMenuName+ "')", kDelayTimeShow, 2);
		}
	}
}

// function LeftHandNavMenus_MaintainPopoupMenu (name of element) -- causes a menu to remain displayed
function LeftHandNavMenus_MaintainPopoutMenu (sMenuName)
{
	if (document.all)
	{
		createDelayedEvent("LeftHandNavMenus_private_showPopoutMenu('" + sMenuName+ "')", kDelayTimeShow, 2);
		LeftHandNavMenus_HighlightItem(document.all["LeftHandNavMenu_" + sMenuName], true);
	}
}

// function LeftHandNavMenus_DisablePopoutMenu () -- causes all open menus to become hidden
function LeftHandNavMenus_DisablePopoutMenu ()
{
	if (document.all)
	{
		createDelayedEvent("LeftHandNavMenus_private_hideAllPopoutMenus()", kDelayTimeHide, 0);
	}
}

// function showPopoutMenu (name of element, optional height of menu) -- displays the specified popout menu
function LeftHandNavMenus_private_showPopoutMenu (sMenuName)
{
	if (document.all)
	{
		var iSetElementTop = null;
		if (LeftHandNavMenus_private_showPopoutMenu.arguments.length > 1)
		{
			iSetElementTop = LeftHandNavMenus_private_showPopoutMenu.arguments[1];
		}
		if (document.all["elPopout_" + sMenuName] != null)
		{
			document.all["elPopout_" + sMenuName].style.visibility = "visible";
			LeftHandNavMenus_HighlightItem(document.all["LeftHandNavMenu_" + sMenuName], true);
			glb_LeftHandNavMenus_DisplayedPopoutMenu = sMenuName;
			
			if (iSetElementTop != null)
			{
				document.all["elPopout_" + sMenuName].style.left = document.all["elPopout_" + sMenuName].style.pixelWidth - 7;
				document.all["elPopout_" + sMenuName].style.top = iSetElementTop - 5;
			}
		}
	}
}

// function hideAllPopoutMenus -- hides any popout menus that are visible
function LeftHandNavMenus_private_hideAllPopoutMenus ()
{
	if (document.all)
	{
		if (glb_LeftHandNavMenus_DisplayedPopoutMenu != null)
		{
			document.all["elPopout_" + glb_LeftHandNavMenus_DisplayedPopoutMenu].style.visibility = "hidden";
			LeftHandNavMenus_UnhighlightItem(document.all["LeftHandNavMenu_" + glb_LeftHandNavMenus_DisplayedPopoutMenu]);
			glb_LeftHandNavMenus_DisplayedPopoutMenu = null;
		}
	}
}
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    RememberSelectedText
// Desc:    This function will append to the dom a DIV called rememberFirefoxSelectedText. This is so we can
//          store selected text. This is needed in Firefox since it takes the litereal meaning/implementation.
//          If the DIV exists then it will just overwrite the value.
//          of selected text on the z-index element of a CSS (think modal popups in jQuery).
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function RememberSelectedText() {
    //var html = Globals.Utilities.getSelectedText();
    var html = Globals.Utilities.getSelectedHtml();
    var firefoxSelectedTextJQueryObject = $("#rememberFirefoxSelectedText");

    if (firefoxSelectedTextJQueryObject.length === 0) {
        $("#divOuterDiv").append("<div id='rememberFirefoxSelectedText' class='display-none'>" + html + "</div>");
    }
    else {
        firefoxSelectedTextJQueryObject.html(html);
    }
}


/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    ChangeLanguagePreferenceFromPageNavigation
// Desc:    This function will make an AJAX GET request to change the user's current language setting.
// Input:   newLanguageSetting - language that the user wants to switch to. Expecting an abbreviated format (eg. en, fr)
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function ChangeLanguagePreferenceFromPageNavigation(newLanguageSetting) {
	var sAjaxPage;
    if(location.protocol.toLowerCase().indexOf('https') < 0){
        sAjaxPage = "/Knowledge/SetOneUserPreference.aspx";
    }
    else {
        sAjaxPage = "/Login/SetOneUserPreference.aspx";
    }

	$.ajax(sAjaxPage,
		{
		    type: "GET",
		    //added cache option to prevent browsers from caching previous GET request. 
		    //IE automatically caches responses from GET requests. Once it's been cached, it will not even make the AJAX call.
		    //see http://www.itworld.com/article/2693447/ajax-requests-not-executing-or-updating-in-internet-explorer-solution.html for more info.
            cache: false, 
			data: { "preferenceID": 1, "newSetting": newLanguageSetting },
			success: function() {
				window.location.reload(true);
			}
		});
}

// this function opens a dialog window with a link to the US tax help desk
function openTemporaryNewsroomHelpDialog(message) {
	if (message == null) {
		message = "<p>Our quick reference guide and FAQs are coming soon. For now, you can request help from <a href='mailto:ustaxalertshelp@ey.com'>ustaxalertshelp@ey.com</a>.</p>";
	}

	Globals.UI.showSimpleDialog(message, "Help");
}

function setCookieAcceptanceCookie() {
	Globals.Cookies.createCookie("cookieAcceptanceAcknowledged", "yes", { "NumberOfDays": 13 * 30, "IsPersistent": true });
	$("#pageBottomCookieNotificationBanner").remove();
}

function checkForCookieAcceptanceCookie() {
	if (Globals.Cookies.exists("cookieAcceptanceAcknowledged")) {
		$("#pageBottomCookieNotificationBanner").remove();
	}
	else {
		$("#pageBottomCookieNotificationBanner").show();
	}
}
;
/*globals GlobalStrings*/
/* ENGLISH GLOBAL STRINGS FILE */
/* RULES:
        1) SEPARATE YOUR STRINGS BY SITE SECTION THAT THEY BELONG TO,
        2) MAKE SURE THE STRINGS FOR ALL RESOURCE FILES ARE IN THE EXACT SAME ORDER TO MAKE MANAGEMENT EASIER,
        3) FOR NEW STRINGS THAT HAVEN'T BEEN TRANSLATED YET, PREFIX THE STRING WITH "(fr)" TO MAKE EYE-BALLING EASIER LATER
        4) FOR STRINGS THAT MAY HAVE A SENTENCE CASE VERSION, PLEASE PUT THE VALUES IN AN ARRAY. THE FIRST ELEMENT BEING THE TITLE CASE VERSION AND THE SECOND ELEMENT AS THE SENTENCE CASE VERSION.
            FOR EXAMPLE: str_DocumentType : ["Document Type:", "Document type:"]
*/

GlobalStrings = {

    // USED TO DETERMINE CURRENT LANGUAGE FROM WITHIN JS FILES -- DO NOT CHANGE!!!
    CurrentLanguageAbbr: "en",
    CurrentLanguageID: "1",

    // START COMMON STRINGS (USED BY MULTIPLE AREAS) //
    str_No: "No",
    str_Yes: "Yes",
    str_Cancel: "Cancel",
    str_Start: "Start",
    str_Stop: "Stop",
    str_Feedback: "Feedback",
    str_Questions: "Questions",
    str_Colon: ":",
    str_Save: "Save",
    str_Save_Note_Popup: "Save",
    str_Ok: "OK",
    str_Go: "Go",
    str_Note: "Note",
    str_ChooseDate: "Choose a date",
    str_Name: "Name",
    str_Submit: "Submit",
    str_Company: "Company",
    str_Email: "Email",
    str_Country: "Country",
    str_Reset: "Reset",
    str_SelectAll: "Select All",
    str_ClearSelection: "Clear Selection",
    str_Reload: "Reload",
    str_Copy: "Copy",
    str_Visit: "Visit",
    str_Download: "Download",
    str_Increase: "Increase",
    str_AriaLabel_Increase: "Increase the font size",
    str_Decrease: "Decrease",
    str_AriaLabel_Decrease: "Decrease the font size",
    str_Comment: "Comment",
    str_Access: "Access",
    str_Welcome: "Welcome",
    str_PleaseSelectAnOptionBelow: "Please select an option below",
    str_FrequentlyAskedQuestions_Short: "FAQ",
    str_FrequentlyAskedQuestions: "Frequently asked questions",
    str_More: "More",
    str_More_LowerCase: "more",
    str_Less_LowerCase: "less",
    str_Less: "Less",
    str_Print: "Print",
    str_Pin: "Pin",
    str_Tools: "Tools",
    str_Documents: "Documents",
    str_Document: "Document",
    str_Close: "Close",
    str_Back_To: "Back to",
    str_Back: "Back",
    str_Tabs: "Tabs",
    str_Tabs_LowerCase: "tabs",
    str_To: "to",
    str_Top: "Top",
    str_Next: "Next",
    str_BackToTop: "Back to Top",
    str_Loading: "Loading",
    str_Add: "Add",
    str_Invalid: "Invalid",
    str_NA: "N/A",
    str_Enabled: "Enabled",
    str_Disabled: "Disabled",
    str_Relevancy: "Relevancy",
    str_Date: "Date",
    str_Toc: "Table of Contents",
    str_E_Books: "eBooks",
    str_Options: "Options",
    str_Help: "Help",

    // END COMMON STRINGS (USED BY MULTIPLE AREAS) //

    // START OF LOGIN STRINGS //
    str_ContinueToHomepage: "Click here to continue to the home page.",
    str_InvalidLogin: "Invalid login. Please try again.",
    str_InvalidEmailAddress: "Invalid e-mail address.",
    str_PasswordRequired: "Password is required.",
    str_EmailAddressRequired: "Email address is required.",
    str_EnterEmailAddress: "Enter email address",
    str_EnterPassword: "Enter password",
    str_Login: "Login",
    str_Log_In: "Log in",
    str_BackToEmail: "Back to email address",
    // END OF LOGIN STRINGS //

    // START SEARCH BAR STRINGS //
    str_EnterDocumentID: "[enter Document ID]",
    str_SearchBar_NewsArchive: "News Archive",
    // END SEARCH BAR STRINGS //

    // START FETCH ASSISTANCE STRINGS //
    str_Province: "Province:",
    str_DocumentType: ["Document Type:", "Document type:"],
    str_Matches: "Matches:",
    str_DocumentID: "Document ID:",
    str_FetchAssistance: ["Fetch Assistance", "Fetch assistance"],
    str_FetchPrefixExamples: ["Fetch Prefix Examples", "Fetch prefix examples"],
    str_FetchCriteria: "Fetch Criteria",
    str_FetchCommand: "Fetch Command:",
    str_FetchCommand_Description:"Please enter a fetch command",
    str_DocumentID_Matches: "Document ID Matches:",
    str_Retrieve: "Retrieve",
    str_NotSelected: "Not Selected",
    str_FetchAssistance_FilterDocumentType: "Filter Document Type",
    str_FetchAssistance_FilterDocumentID: "Filter Document ID",
    // END FETCH ASSISTANCE STRINGS //

    // START COPY SELECTED TEXT WITH CONTEXT //
    str_CopySelectedTextWithContext: ["Copy Selected Text with Context", "Copy selected text with context"],
    str_PressCtrlCToCopySelectedText: "Please press &quot;Ctrl + C&quot; to copy the selected text (shown below) to your clipboard.",
    str_PleaseSelectSomething: "Please select the text you wish to copy.",
    str_TheFollowingTextWasCopied: "The following text was copied to your clip board:",
    // END COPY SELECTED TEXT WITH CONTEXT //   

    // START DOCUMENT SHARING STRINGS //
    str_Share_CreateLink: ["Create Link to Document", "Create link to document"],
    str_Share_CopyPasteLink: "Please copy and paste the following link(s)",
    // START DOCUMENT SHARING STRINGS //

    //START DOCUMENT TWISTY STRINGS//
    str_Twisty_FutureApplication: "Future application",
    str_Twisty_Concordance: "Concordance",
    str_Twisty_Commentary: "Commentary",
    str_Twisty_History: "History",
    //END DOCUMENT TWISTY STRINGS//

    // START DOCUMENT NAVIGATION STRINGS //
    str_DocNav_SearchHit: "Hit",
    str_DocNav_SearchResults: ["Search Results:", "Search results:"],
    str_DocNav_SearchResultsCompressed: ["Search Results:", "Search results:"],
    str_DocNav_BackToSearchResults: ["Back to Search Results", "Back to search results"],
    str_DocNav_OpenInNewWindow: ["Open in New Window", "Open in new window"],
    str_DocNav_Of: " of ",
    str_DocNav_BriefcaseDocuments: ["Briefcase Documents", "Briefcase documents"],
    str_DocNav_NextDocument: "Next",
    str_DocNav_PreviousDocument: "Previous",
    str_DocNav_NextSearchHit: ["Next Hit", "Next hit"],
    str_DocNav_PreviousSearchHit: ["Previous Hit", "Previous hit"],
    str_DocNav_clickToResize: "Click anywhere in the shaded area to resize",
    str_DocNav_seeFutureApplication: "See Future application below.",
    str_DocNav_PreviousPageLink: "Previous page link",
    str_DocNav_NextPageLink: "Next page link",
    str_DocNav_FirstPageLink: "First page link",
    str_DocNav_LastPageLink: "Last page link",
    str_DocNav_Page: ["Page", "page"],
    str_DocNav_Link: ["Link", "link"],
    // END DOCUMENT NAVIGATION STRINGS //

    // START TREEVIEW STRINGS //
    str_Filters_For: "Filters for",
    // END TREEVIEW STRINGS //

    // START CREATE NEW FOLDER STRINGS //
    str_CreateFolder_CreateFolder: ["Create Folder", "Create folder"],
    str_CreateFolder_EnterNewFolderName: "Enter new folder name here",
    str_CreateFolder_Create: "Create",
    str_CreateFolder_FolderCreated: "Folder created",
    str_CreateFolder_UnableToCreateFolder: "Unable to create folder",
    str_CreateFolder_EnterValidFolderName: "Please enter a valid folder name",
    str_CreateFolder_FolderExists: "Folder name already exists",
    str_CreateFolder_BriefcaseFolderError: "Error creating Briefcase folder.",
    // END CREATE NEW FOLDER STRINGS //

    // START ERROR HANDLER STRINGS //
    str_Error_WaitTimedOut: "<p class='normalTextResizable'>It appears that an error has occurred while processing your request.</p><p class='normalTextResizable'>Please hit CTRL-F5 and then try again.</p><p class='normalTextResizable'>If the problem persists, please contact our help desk (see below).</p>",
    str_Query_UnknownError: "The query contains unknown error.",
    str_Query_Malformed: "The query is malformed.",
    str_Query_Unsupported: "The query contains unsupported characters or escapes.",
    str_Query_SyntaxError: "The query contains syntax error.",
    str_Query_IncorrectDataType: "The query contains incorrect data type.",
    str_Query_SemanticError: "The query caused semantic error.",
    str_Query_ElasticSearchError: "The query is too complex or contains invalid terms; please simplify it or use parentheses around terms.",
    str_Query_RangeError: "Please specify a proximity range between 0 and 128.",
    str_Query_NonParsingRrelatedError: "An unexpected issue occurred while processing your request.",
    // END ERROR HANDLER STRINGS //

    // START DELETE ITEM STRINGS //
    str_DelItem_DeleteFolderOrDocuments: ["Delete Folder(s)/Document(s)", "Delete folder(s)/document(s)"],
    str_DelItem_ChooseItem: "Please choose an item from the table of contents",
    str_DelItem_CannotDeleteReadOnly: "You cannot delete a read-only file",
    str_DelItem_FoldersDeleted: "The following folder(s) will be deleted:",
    str_DelItem_DocumentsDeleted: "The following document(s) will be deleted:",
    str_DelItem_Delete: "Delete",
    str_DelItem_ItemDeleted: "Item(s) deleted",
    str_DelItem_ErrorDeleted: "Some item(s) could not be deleted",
    str_ClearAll: "Clear All",
    str_ClearAll_Tooltip: "Clear all items in Pinboard",
    // END DELETE ITEM STRINGS //

    // START MANAGE FOLDER ACCESS STRINGS //
    str_MngAccess_Title: ["Manage Folder Access", "Manage folder access"],
    str_MngAccess_ChooseFolder: "Please choose a folder:",
    str_MngAccess_FolderNames: ["Folder Names", "Folder names"],
    str_MngAccess_NoFolderToManage: "There are no folders to manage in your Briefcase.",
    str_MngAccess_Briefcase_ChangeAccessError: "Error changing Briefcase access.",
    str_MngAccess_Briefcase_GetFoldersError: "Error during get folder Briefcase access.",
    str_MngAccess_FolderAccessRoles: ["Folder Access Roles:", "Folder access roles:"],
    str_MngAccess_ReadOnly: ["Read Only", "Read only"],
    str_MngAccess_FullAccess: ["Full Access", "Full access"],
    str_MngAccess_AccessChanged: "Your changes have been saved.",
    str_MngAccess_ErrorChange: "Some user access could not be changed",
    str_MngAccess_SaveChanges: ["Save Changes", "Save changes"],
    str_MngAccess_Reset: "Reset",
    str_MngAccess_FilterFolder: "Filter Folder",
    str_MngAccess_NoAccess: "No Access",
    str_MngAccess_FilterRole: "Filter Role",
    // END MANAGE FOLDER ACCESS STRINGS //

    // START MOVE/COPY DOCS STRINGS //
    str_MoveCopyDocs_Title: ["Move/Copy Document(s)", "Move/copy document(s)"],
    str_MoveCopyDocs_ChooseItem: "Please choose an item from the table of contents",
    str_MoveCopyDocs_ChooseDoc: "Please choose at least one document from the table of contents",
    str_MoveCopyDocs_DocumentsMoved: "The following document(s) will be moved/copied:",
    str_MoveCopyDocs_MoveDocs: "Move document(s)",
    str_MoveCopyDocs_CopyDocs: "Copy document(s)",
    str_MoveCopyDocs: "Move/Copy",
    str_MoveCopyDocs_ToExistingFolder: "To existing folder:",
    str_MoveCopyDocs_ToNewFolder: "To new folder:",
    str_MoveCopyDocs_Save: "Save",
    str_MoveCopyDocs_CanOnlyCopyReadOnly: "You can only copy a document from a read only folder",
    str_MoveCopyDocs_ItemMovedCopied: "Item(s) moved/copied",
    str_MoveCopyDocs_ErrorMoved: "Some items could not be moved/copied",
    str_MoveCopyDocs_ChooseDestination: ["Choose Destination", "Choose destination"],
    str_MoveCopyDocs_ChooseOperation: ["Choose Operation:", "Choose operation:"],
    str_MoveCopyDocs_ChooseFolder: ["Choose a Folder:", "Choose a folder:"],
    str_MoveCopyDocs_EnterNewFolderName: ["Enter New Folder Name", "Enter new folder name"],
    str_MoveCopyDocs_BriefcaseMoveError: "Error moving Briefcase item.",
    // END MOVE/COPY DOCS STRINGS //

    // START RENAME FOLDER STRINGS //
    str_RenameFolder_Title: ["Rename Folder", "Rename folder"],
    str_RenameFolder_Rename: "Rename",
    str_RenameFolder_FolderRenamed: "Folder renamed",
    str_RenameFolder_UnableToRename: "Unable to rename folder",
    str_RenameFolder_FolderToRename: "Select a folder to rename",
    str_RenameFolder_NoFolderToRename: "There are no folders to rename in your briefcase.",
    str_RenameFolder_BriefcaseRenameError: "Error renaming Briefcase folder.",
    // END RENAME FOLDER STRINGS //

    // START PRINT OPTIONS STRINGS //
    str_Print_PrintEnglishHotTopics: "Print English Hot Topics",
    str_Print_PrintFrenchHotTopics: "Print French Hot Topics",
    str_Print_PrintOptions: ["Print Options", "Print options"],
    str_Print_PrintPage: "Print the contents of the page",
    str_Print_PrintThisDocument: "Print this document",
    str_Print_PrintThisDocument_Description: "Print the current document",
    str_Print_PrintSelectedText: "Print selected text",
    str_Print_PrintSelectedText_Description: "Print the highlighted text",
    str_Print_PrintCheckedBoxes: "Print checked boxes",
    str_Print_PrintCheckedBoxes_Description: "Print the documents selected on the table of contents",
    str_Print_PrintSearchResultDocuments: "Print search result documents",
    str_Print_PrintSearchResultDocuments_Description: "Print the documents selected from the search results",
    str_Print_PrintSearchResultlist: "Print search results list",
    str_Print_PrintSearchResultlist_Description: "Print the current search results",
    str_Print_PrintTableOfContents: "Print table of contents",
    str_Print_PrintTableOfContents_Description: "Print the entire table of contents",
    str_Print_PrintTaggedParagraphs: "Print tagged paragraphs",
    str_Print_PrintTaggedParagraphs_Description: "Print the tagged paragraphs on the current document",
    str_Print_Preview: "Preview",
    str_Print_Print: "Print",
    str_Print_Close: "Close",
    str_Print_ErrorToManyDocuments: "You have selected too many documents to print. Please select no more than 10 documents. \n(Tip: Uncheck the \"What's New\" box at the top of the table of contents.)",
    str_Print_ErrorToManyDocumentsNoTip: "You have selected too many documents to print. Please select no more than 10 documents.",
    str_Print_Footnotes: "Footnotes",
    str_Word_SaveTaggedParagraphs: "Save tagged paragraphs",
    str_Email_EmailThisDocument: ["Email This Document", "Email this document"],
    // END PRINT OPTIONS STRINGS//

    //START SMART BRIEFCASE BUTTON//
    str_briefcase: "Briefcase",
    str_ucTB_SaveDocsToBriefcase: ["Save Document(s) to Briefcase", "Save document(s) to Briefcase"],
    str_ucTB_SaveToBriefcase: "Save to Briefcase",
    str_Select_Documents: "Select Document(s)",
    str_Select_All_Documents: "Select All Documents",
    str_Deselect_Documents: "Deselect Documents",
    str_Deselect_All_Documents: "Deselect All Documents",
    //END SMART BRIEFCASE BUTTON//

    // START ADD TO BRIEFCASE STRINGS //   

    str_AddToBriefcase_SaveThisDocument: ["Save This Document", "Save this document"],
    str_AddToBriefcase_SaveCheckedBoxes: ["Save Checked Boxes", "Save checked boxes"],
    str_AddToBriefcase_SaveSearchResultDocuments: "Save search results documents",
    str_AddToBriefcase_SaveToBriefcase: "Save to Briefcase",
    str_AddToBriefcase_ChooseDestination: ["Choose Destination", "Choose destination"],
    str_AddToBriefcase_ChooseDestinationDescription: "Please choose the destination to save the document",
    str_AddToBriefcase_SaveSearch: ["Save Search", "Save search"],
    str_AddToBriefcase_SearchNameMessage: "Please enter a search name.",
    str_AddToBriefcase_ToExistingFolder: "To existing folder",
    str_AddToBriefcase_ToExistingFolder_Description: "Select an existing folder below to add the document to",
    str_AddToBriefcase_ToNewFolder: "To new folder",
    str_AddToBriefcase_ToNewFolder_Description: "Create a new folder to add the document to",
    str_AddToBriefcase_SaveDocuments: ["Save Document(s)", "Save document(s)"],
    str_AddToBriefcase_SuccessfullSave: "Your document(s) have been successfully saved to your briefcase.",
    str_AddToBriefcase_SearchSuccessfullSave: "Your search has been successfully saved to your briefcase.",
    str_AddToBriefcase_SearchName: ["[Search Name]", "[Search name]"],
    str_AddToBriefcase_FolderName: ["[Folder Name]", "[Folder name]"],
    str_AddToBriefcase_AsExistingSearch: ["Existing Search", "existing search"],
    str_AddToBriefcase_AsExistingSearch_Description: "Replace previous search query with this one for an existing search name",
    str_AddToBriefcase_AsNewSearch: ["New search", "new search"],
    str_AddToBriefcase_AsNewSearch_Description: "Save search query to a new search name",
    str_AddToBriefcase_SaveSearchToBriefcase: "Save search to Briefcase",
    str_AddToBriefcase_ChooseFolder: ["Choose a folder", "Choose a Folder"],
    str_AddToBriefcase_EnterNewFolderName: "Enter new folder name",
    str_AddToBriefcase_SaveSearchResultAs: "Save search results as",
    str_AddToBriefcase_EnterSearchName: "Enter search name",
    str_AddToBriefcase_NewFolderName: "New folder name",
    str_AddToBriefcase_NewSearchName: "New search name",

    str_AddToBriefcase_ChooseSearchName: ["Choose a Search", "Choose a search"],
    str_MSWord_SaveDocument: ["Save to Hard Drive", "Save to hard drive"],
    str_MSWord_SuccessfulSave: "Your text or document(s) have been successfully saved to your hard drive.",
    // END ADD TO BRIEFCASE STRINGS //   

    //START BRIEFCASE BODY DEFAULT
    str_BriefcaseBody_title: ["All Folders", "All folders"],
    str_BriefcaseBody_line1: "Keep track of your research by saving documents to Briefcase folders you create and name. You can also search within your Briefcase folders &#151; creating your own specialized library.",
    str_BriefcaseBody_line2: "Manage folder access so that others in your organization can view or edit Briefcase folders and documents.",
    str_BriefcaseBody_line3: "Save searches to your Briefcase and re-run them at a later date against updated content.",
    //END BRIEFCASE BODY DEFAULT

    //Attachment with hits
    str_attachmentWithHits: "Attachments with hits",
    str_attachmentWithHitsShort: "Attachments",

    //START SEARCH HITS BAR STRINGS
    str_searchHitsBar_hideHighlightedSearchTerms: "Hide Highlighted Terms",
    str_searchHitsBar_showHighlightedSearchTerms: "Show Highlighted Terms",
    //END SEARCH HITS BAR STRINGS

    //START SEARCH STRINGS
    str_search_noResults: "No results.",
    str_search_folder: "Folder",
    str_search_product: "Product",
    str_search_documentType: ["Document Type", "Document type"],
    str_search_documentTitle: ["Document Title", "Document title"],
    str_search_relevance: "Relevance",
    str_search_displaying: "Displaying",
    str_search_toDisplay: " to ",
    str_search_ofDisplay: " of ",
    str_search_searchWithinResults: "Search within results",
    str_search_hits: "Results",
    str_search_showSearchHits: "Show Results",
    str_search_hideSearchHits: "Hide Results",
    str_search_backToResults: "Back to results",
    str_search_searchAssistance: ["Search Assistance", "Search assistance"],
    str_search_options: ["Search Options", "Search options"],
    str_search_advancedSearch: ["Advanced Search", "Advanced search"],
    str_search_searchPreferences: ["Search Preferences", "Search preferences"],
    str_search_editSearch: ["Edit Search", "Edit search"],
    str_search_searchAll: ["Search All", "Search all"],
    str_search_searchAllNoProductsSearchable: "You do not have access to any searchable products.",
    str_search_searchAllNoProductsInList: "Your customized list does not contain any searchable products that you can access.",
    str_filteredNodes_within: "within",
    str_allDocuments: "All documents",
    str_referring: "referring to",
    str_containing: "containing",
    //END SEARCH STRINGS

    //START SEARCH TIPS STRINGS
    str_searchTip_1: "This is the default behaviour in standard search.",
    str_searchTip_2: "You can do this in standard search by \"surrounding your phrase with quotes\".",
    str_searchTip_3: "You do this in standard search by typing OR between your alternate words.",
    str_searchTip_4: "You do this in standard search by typing W/# between your words that should be near each other, or PRE/# to specify the order they should appear (# is how far apart the words can appear).",
    str_searchTip_5: "You can do this in standard search by typing NOT before the word you don't want.",
    str_searchTip_6: "This setting will be remembered for ALL searches. It can be changed from this page or My Account &gt; Preferences.",
    str_searchTip_7: "You can change it such that your results list is in table-of-contents order or relevance order under <img id=tempImage align=texttop> Edit search preferences.",
    //END SEARCH TIPS STRINGS

    //START SEARCH FIELDS STRINGS
    str_searchFields_FindDocumentsThatHave: "Find documents that have ...",
    str_searchFields_allWords: "all these words:",
    str_searchFields_thisPhrase: "this exact phrase:",
    str_searchFields_oneOrMoreWords: "one or more of these words:",
    str_searchFields_wordsNearEachOther: "these words near each other:",
    str_searchFields_nearWithin: "\"near\" means within ",
    str_searchFields_wordsIn: "words in",
    str_searchFields_order: "order",
    str_searchFields_dontShow: "But don't show pages that have...",
    str_searchFields_unwantedWords: "any of these unwanted words:",
    str_searchFields_clear: "Clear",
    str_searchFields_search: "Search",
    str_searchFields_fetch: "Fetch",
    str_searchFields_searchKeywords: ["Search Keywords:", "Search keywords:"],
    str_searchFields_getSearchSyntaxHelp: ["Get Search Syntax Help", "Get search syntax help"],
    str_searchFields_turnOffKeywordAssistant: ["<br>Turn off<br>Keyword<br>Assistant", "<br>Turn off<br>keyword<br>assistant"],
    str_searchFields_turnOnKeywordAssistant: ["<br>Turn on<br>Keyword<br>Assistant", "<br>Turn on<br>keyword<br>assistant"],
    str_searchFields_tip: "tip",
    str_searchFields_any: "any",
    str_searchFields_theSpecified: "the specified",
    str_searchFields_enterOneOrMoreKeywords: "Please enter one or more keywords.",
    str_searchFields_AND: "AND",
    str_searchFields_NOT: "NOT",
    str_searchFields_OR: "OR",
    //END SEARCH FIELDS STRINGS 

    //START SEARCH TEMPLATES STRINGS
    str_searchTemplate_searchCriteria: "Search Criteria",
    str_searchTemplate_pleaseSelectStatute: "Please Select Statute",
    str_searchTemplate_pleaseRefineCategory: "Please Refine Category",
    str_searchTemplate_filterCategory: "Filter Category",
    str_searchTemplate_courtInformation: "Court Information",
    str_searchTemplate_other: "Other",
    str_searchTemplate_rulingInformation: "Ruling Information",
    str_searchTemplate_filterStatutes: "Filter Statutes",
    str_searchTemplates_caseSearchTemplate: ["Case Search Template", "Case search template"],
    str_searchTemplates_casesFrom: ["Cases From:", "Cases from:"],
    str_searchTemplates_rulingsSearchTemplate: ["Rulings Search Template", "Rulings search template"],
    str_searchTemplates_documentType: ["Document Type:", "Document type:"],
    str_searchTemplates_documentTopic: ["Document Topic:", "Document topic:"],
    str_searchTemplates_revenueFocus: ["Revenue Focus:", "Revenue focus:"],
    str_searchTemplates_countriesAffected: ["Countries Affected:", "Countries affected:"],
    str_searchTemplates_subject: "Subject:",
    str_searchTemplates_documentNumber: ["Document Number:", "Document number:"],
    str_searchTemplates_author: "Author:",
    str_searchTemplates_language: "Language:",
    str_searchTemplates_documentDate: ["Document Date:", "Document date:"],
    str_searchTemplates_caseName: ["Case Name:", "Case name:"],
    str_searchTemplates_citation: "Citation:",
    str_searchTemplates_court: "Court:",
    str_searchTemplates_courtFileNumber: ["Court File Number:", "Court file number:"],
    str_searchTemplates_judge: "Judge:",
    str_searchTemplates_language: "Language:",
    str_searchTemplates_both: "Both",
    str_searchTemplates_french: "French",
    str_searchTemplates_english: "English",
    str_searchTemplates_decisionDate: ["Decision Date:", "Decision date:"],
    str_searchTemplates_annotationsSearchTemplate: ["References Search Template", "References search template"],
    str_searchTemplates_commentarySearchTemplate: ["Commentary Search by Section Template", "Commentary search by section template"],
    str_searchTemplates_contentSearchTemplate: "Content Search Template",
    str_searchTemplates_matrixSearchTemplate: "Matrix Search Template",
    str_searchTemplates_alertsSearchTemplate: "Alerts Search Template",
    str_searchTemplates_topicalIndexSearchTemplate1: ["Income Tax Topical Index (FITA)", "Income tax topical index (FITA)"],
    str_searchTemplates_topicalIndexSearchTemplate2: ["Commentary Topical Index", "Commentary topical index"],
    str_searchTemplates_caseCommentarytopicalIndexSearchTemplate: ["Case Commentary Topical Index", "Case commentary topical index"],
    str_searchTemplates_rulingReviewtopicalIndexSearchTemplate: ["Ruling Commentary Topical Index", "Ruling commentary topical index"],
    str_searchTemplates_exciseTaxActSearchTemplate: "Excise Tax Act Topical Index",
    str_searchTemplates_releaseNumber: ["Release Number:", "Release number:"],
    str_searchTemplates_category: "Category:",
    str_searchTemplates_documentCreated: ["Document Created:", "Document created:"],
    str_searchTemplates_wealthAndEstatePlanning: ["Personal Tax, Wealth, and Estate Planning", "Personal tax, wealth, and estate planning"],
    str_searchTemplates_taxPrecentLetterSearchTemplate: ["Tax Precedent Letter Search Template", "Tax precedent letter search template"],
    str_searchTemplates_taxSubjectFileSearchTemplate: ["Tax Subject File Search Template", "Tax subject file search template"],
    str_searchTemplates_legislativeReference: ["Legislative Reference:", "Legislative reference:"],
    str_searchTemplates_specifyLegislativeReference: "Please specify a legislative reference.",
    str_searchTemplates_enterASectionOfTheAct: "Please enter a section of the act.",
    str_searchTemplates_chooseStatute: "Please choose a statute, a regulation, or a treaty from the list.",
    str_searchTemplates_TempMessage_Rulings1: "<b>Note:</b> <span class='red'>Ruling Letters released since --0-- are not included in Ruling Letters search template results.</span>",
    str_searchTemplates_TempMessage_Rulings2: "<b>Searching for recent ruling letters:</b> To include the most recent ruling letters in a \"regular\" search, use the Search box at the top left of your screen and ensure you check the <nobr>What's New &gt; Income Tax Rulings</nobr> box (as well as the Income Tax Rulings table of contents box).",
    str_searchTemplates_TempMessage_Cases1: "<b>Note:</b> <span class='red'>Cases released since --0-- are not included in Case search template results.</span>",
    str_searchTemplates_TempMessage_Cases2: "<b>Searching for recent cases:</b> To include the most recent cases in a \"regular\" search, use the Search box at the top left of your screen and ensure you check the <nobr>What's New &gt; Cases box</nobr> (as well as the Case Law table of contents boxes relevant to your search).",
    str_searchTemplates_topicalIndexInstructions1: "Use this tool to search the income tax topical index for terms in the legislation (<i>Income Tax Act</i> and Income Tax Regulations)<span id='templateDescriptionAndCommentary'> and commentary</span>.",
    str_searchTemplates_topicalIndexInstructions2: "To jump to a particular alphabetical listing within the topical index, click on the applicable letter below.",
    str_searchTemplates_topicalIndexInstructions3: "More commentary is available with <a href='http://www.cpastore.ca/product/federal-income-tax-collection-platinum/637' target='_blank'>FITAC Platinum</a>",
    str_searchTemplates_topicalIndexInstructions4: "A full list of search templates can be found under the <img src='/UserControls/Toolbar/Images/~sitestyle~/Icons/MagnifyingGlass.gif' height='14'> icon above.",
    str_searchTemplates_topicalIndexInstructions5: "Use this tool to search the income tax topical index for terms in the legislation (<i>Income Tax Act</i> and Income Tax Regulations).",
    str_searchTemplates_topicalIndex_Commentary: "Commentary",
    str_searchTemplates_topicalIndex_AllCommentary: ["All Commentary", "All commentary"],
    str_searchTemplates_topicalIndex_EYCommentary: ["EY Commentary", "EY commentary"],
    str_searchTemplates_topicalIndex_ThirdPartyCommentary: ["Third Party Commentary", "Third party commentary"],
    str_searchTemplates_topicalIndex_TaxRulesTopicalIndex: ["Tax Rules Topical Index", "Tax rules topical index"],
    str_searchTemplates_topicalIndex_T1TopicalIndex: "T1 topical index",
    str_searchTemplates_topicalIndex_EYGuideToIncomeTax: ["EY&rsquo;s Guide to Income Tax", "EY&rsquo;s guide to income tax"],
    str_searchTemplates_topicalIndex_TaxExchangeTopicalIndex: "Tax Exchange Topical Index",
    str_searchTemplates_topicalIndex_RevenueFocus: "Revenue Focus Topical Index",
    str_searchTemplates_topicalIndex_TaxPrecedents: "Tax Precedents Topical Index",
    str_searchTemplates_include: "Include:",
    str_searchTemplates_keywords: "Keywords:",
    str_searchTemplates_topicalIndex_keywords: "Keywords",
    str_searchTemplates_Title: ["Search Tools", "Search tools"],
    str_searchTemplates_searchTemplateSubTitle: ["Search Templates", "Search templates"],
    str_searchTemplates_topicalIndex_viewCommentary: "View commentary",
    str_searchTemplates_topicalIndex_theEnd: "The End",
    str_searchTemplates_topicalIndex_typeOfCommentary: "Type of Commentary",
    str_searchTemplates_topicalIndex_commentaryAll: "All",
    str_searchTemplates_topicalIndex_commentaryEY: "EY",
    str_searchTempaltes_topicalIndex_numberOfResults: "Number of Results",
    str_searchTemplates_topicalIndex_loadMore: "Load More",
    //END SEARCH TEMPLATES STRINGS  

    //START SEARCH PREFERENCES STRINGS
    str_searchPreferences_wordsAroundFirstHit: "Words around first hits:",
    str_searchPreferences_off: "Off",
    str_searchPreferences_low: "Low",
    str_searchPreferences_medium: "Medium",
    str_searchPreferences_high: "High",
    str_searchPreferences_sortOrder: ["Sort Order:", "Sort order:"],
    str_searchPreferences_tableOfContents: ["Table of Contents", "Table of contents"],
    str_searchPreferences_relevance: "Relevance",
    str_searchPreferences_sortOrderDate: "Order By Date",
    str_useStemming: "Use stemming:",
    str_searchPreferences_Stemming: "Stemming",
    str_searchPreferences_Stemming_Colon: "Stemming:",
    str_searchPreferences_Stemming_Description: "Stemming reduces your typed word to the root word to find the content you are looking for. (E.g.  With stemming on, Taxable will also search: Taxing, Tax, Taxes, Taxation, etc.).",
    str_searchPreferences_Stemming_Enable: "Enable Stemming",
    str_searchPreferences_SearchResultsSortOrder: "Search Results Sort Order",
    str_searchPreferences_SearchResultsSortOrder_Colon: "Search Results Sort Order:",
    str_searchPreferences_SearchResultsSortOrder_TOC_Description: "Sort order curated by our content experts that prioritizes the importance of the content",
    str_searchPreferences_SearchResultsSortOrder_Relevance_Description: "Search engine based relevancy that's more in-line to modern search engines",
    str_searchPreferences_sortOrderDate_Description: "Sort order showing the most recent documents first",
    str_searchPreferences_WordsAroundFirstHit: "Words around First Hit",
    str_searchPreferences_WordsAroundFirstHit_Colon: "Words around First Hit:",
    str_searchPreferences_WordsAroundFirstHit_Description: "Words around First Hit controls the amount of words displayed around the found text",
    str_searchPreferences_WordsAroundFirstHit_Off_Description: "No words",
    str_searchPreferences_WordsAroundFirstHit_Low_Description: "Few words",
    str_searchPreferences_WordsAroundFirstHit_Medium_Description: "Up to a sentence worth of words",
    str_searchPreferences_WordsAroundFirstHit_High_Description: "Up to two lines worth of words",
    str_searchPreferences_CountryFilter: "Country Filter:",
    str_searchPreferences_CountryFilter_all: "All",
    str_searchPreferences_CountryFilter_australia: "Australia",
    str_searchPreferences_CountryFilter_newzealand: "New Zealand",
    str_searchPreferences_DefaultSearchProduct: "Default search product",
    str_searchPreferences_DefaultSearchProduct_Colon: "Default search product:",
    str_searchPreferences_DefaultSearchProduct_Description: "Please select your default search product.",
    str_searchPreferences_DefaultSearchProduct_Description_Refresh: "Please refresh your screen after you have selected your default subscription.",
    //END SEARCH PREFERENCES STRINGS        

    //START SEARCH ALL STRINGS
    str_searchAll_search: "Search: ",
    str_searchAll_all: "All",
    str_searchAll_allSubscriptions: ["All Subscriptions", "All subscriptions"],
    str_searchAll_englishSubscriptions: ["English Subscriptions", "English subscriptions"],
    str_searchAll_frenchSubscriptions: ["French Subscriptions", "French subscriptions"],
    str_searchAll_customSubscriptions: ["Custom Subscriptions", "Custom subscriptions"],
    str_searchAll_editSubscriptions: ["Edit Custom Subscriptions", "Edit custom subscriptions"],
    str_searchAll_myList: ["My Search List", "My search list"],
    str_searchAll_customizeMyList: ["Customize My Search List", "Customize my search list"],
    str_searchAll_myHistory: "My History",
    //END SEARCH ALL STRINGS    

    str_definitionDiv_error: "Loading of document failed",
    str_noDocumentInFolder_error: "No documents in this folder",

    // START SAVED SEARCH STRINGS //
    str_savedSearches_NoSearches: "You do not have any saved searches.",
    str_savedSearches_FilterSavedSearch: "Filter Saved Search",
    // END SAVED SEARCH STRINGS //

    // START RENAME SEARCH STRINGS //
    str_RenameSearch_Title: ["Rename Search", "Rename search"],
    str_RenameSearch_Rename: "Rename",
    str_RenameSearch_SearchRenamed: "Search renamed",
    str_RenameSearch_UnableToRename: "Unable to rename search",
    str_RenameSearch_enterSearchName: "Enter search name here",
    str_RenameSearch_EnterValidSearchName: "Please enter a valid search name",
    str_RenameSearch_SearchExists: "Search name already exists",
    str_RenameSearch_SearchName: "Search Name",
    str_RenameSearch_ProductSearched: "Product Searched",
    str_RenameSearch_SearchTerm: "Search Term",
    // END RENAME SEARCH STRINGS //

    // START DELETE SEARCH STRINGS //
    str_DelSearch_DeleteSearch: ["Delete Search", "Delete search"],
    str_DelSearch_ChooseSearch: "Please choose a search to delete",
    str_DelSearch_SearchWillBeDeleted: "The following search(es) will be deleted:",
    str_DelSearch_Delete: "Delete",
    str_DelSearch_SearchDeleted: "Search(es) deleted",
    str_DelSearch_ErrorDeleted: "Some search(es) could not be deleted",
    str_DelSearch_AlertMessage: "Are you sure you want to remove this search from saved searches?",
    // END DELETE SEARCH STRINGS //

    // START GLOBAL ERROR STRINGS //
    str_CommonErrorTitle: "An error has occurred while processing your request",
    str_CommonErrorMessage: "<p class=\"MostNormal\">An error report has been automatically sent to the site administrators.</p><br class=\"MostNormal\"/><p class=\"MostNormal\">We will work to have the problem resolved as soon as possible.</p><br class=\"MostNormal\"/>",
    // END GLOBAL ERROR STRINGS //

    // START VIEWER STRINGS //
    str_docDeleted: "The document you have selected has been deleted from the collection.",
    // END VIEWER STRINGS //

    // START FOOTNOTE STRINGS //
    str_footnote_annotationsFor: "Annotations for ",
    str_footnote_all: "All",
    // END FOOTNOTE STRINGS //

    // START HOT TOPIC STRINGS//
    str_HotTopics_RemoveTitle: ["Remove Topic", "Remove topic"],
    str_HotTopics_RemoveCategory: "Are you sure you want to remove <b>{0}</b> from this view?<BR><br>(Note: You can always click <b>View all topics</b> at the top of the page to return to the default view.)",
    str_HotTopics_Remove: "Remove",
    str_HotTopics_TouchToReadMore: "Touch to read more...",
    // END HOT TOPIC STRINGS

    // START CRA PROGRAM CHECK STRINGS//
    str_CRA_ProgramCheck_popupTitle: "Friendly reminder",
    str_CRA_ProgramCheck_popupMessage: "Please select your current Branch. Thank you!",
    str_CRA_ProgramCheck_buttonText: "Submit",
    str_CRA_ProgramCheck_errorMessage: "Please select your current Branch.",
    str_CRA_ProgramCheck_defaultSelectOption: "Select your Branch",
    // END CRA PROGRAM CHECK STRINGS //

    // START NEWS PAGE SPECIFIC STRINGS //
    str_ucTB_EditNewsDisplayPrefs: "Edit news display preferences",
    str_ucTB_ChooseNewsDate: ["Choose a News Date", "Choose a News date"],
    str_ucTB_ChooseNewsCollectionDate: ["Choose a News Date", "Choose a News date"],
    str_ucTB_NewsArchive: ["View News Archive", "View News archive"],
    str_ucTB_EmailDoc: ["Email Document", "Email document"],
    str_newsArchive_showAllNewsForPast: "Show all News for the past",
    str_newsArchive_showAllNewsForRange: "Show all News between",
    str_newsArchive_choose: "choose",
    str_newsArchive_lastXDays: "{0} days",
    str_newsArchive_lastWeek: "1 week",
    str_newsArchive_lastXWeeks: "{0} weeks",
    str_newsArchive_lastXMonths: "{0} months",
    str_newsArchive_lastYear: "1 year",
    str_LinkToThisDocument: "Link to this document",
    str_LinkToDocument: "Link to Document",
    str_News_FilteredBy: "filtered by",
    str_News_ChooseRange: ["Choose Range", "Choose range"],
    str_News_EmailNews: ["Email News", "Email news"],
    str_rxTB_ChooseNewsDate: ["Choose Date", "Choose date"],
    str_rxTB_NewsArchive: ["View Archive", "View archive"],
    str_rxTB_EmailNews: ["Email News", "Email news"],
    // END NEWS PAGE SPECIFIC STRINGS //

    // START ANNOTATION STRINGS
    str_References: "References",
    str_Notes: "Notes",
    str_commentary: "Commentary",
    str_for: "for",
    str_All: "All",
    str_and: "and",
    str_Purpose: "Purpose",
    str_Application: "Application",
    str_ExplanatoryNote: ["Consolidated Explanatory Notes", "Consolidated explanatory notes"],
    str_PrintAnnotations1a: ["Primary Annotations", "Primary annotations"],
    str_PrintAnnotations2a: "(included in <a href='javascript:;' style='cursor:text; text-decoration:none;' title='References listed under Primary annotations also appear in EY&apos;s print version of the Federal Income Tax Act (FITA). The list is compiled by EY tax professionals and includes only the most relevant, significant, or informative references for particular sections of the Act.'>EY's FITA</a>)",
    str_PrintAnnotations1b: "Print annotations",
    str_ShowOnlyPrintAnnotations: "Show only primary annotations",
    str_ShowAllAnnotations: "Show all annotations",
    str_iboxTabName_Tools: "Tools",
    str_iboxTabHeading_Tools: "Tools",
    str_iboxTabName_Solutions: "Solutions",
    str_iboxTabHeading_Solutions: "Solutions",
    str_iboxTabName_CTF: "CTF",
    str_iboxTabHeading_CTF: "Canadian Tax Foundation Articles",
    str_iboxTabName_APFF: "APFF",
    str_iboxTabHeading_APFF: "Congrès annuel",
    str_iboxTabName_Videos: "EY Video Library",
    str_iboxTabHeading_Videos: "EY Video Library",
    str_iboxTabName_WCONotes: "WCO Notes",
    str_iboxTabHeading_WCONotes: "WCO Explanatory Notes",
    str_iboxTabName_USTariff: "US Tariff",
    str_iboxTabHeading_USTariff: "US Tariff",
    str_iboxTabName_WCONotesFrench: "Notes de l'OMD",
    str_iboxTabHeading_WCONotesFrench: "Notes explicatives de l'OMD",
    str_iboxTabName_USTariffFrench: "US Tariff",
    str_iboxTabHeading_USTariffFrench: "US Tariff",
    str_iboxTabName_FutureRates: "Future Rates",
    str_iboxTabName_FutureRatesFrench: "Taux futurs",
    str_iboxTabHeading_FutureRates: "Future Rates",
    str_iboxTabHeading_FutureRatesFrench: "Taux futurs",
    str_FutureRates_ViewFullTable: "View full table",
    str_FutureRatesFrench_ViewFullTable: "Voir tableau au complet",
    str_FutureRates_for: "for",
    str_FutureRatesFrench_for: "pour",
    str_FutureRates_TableFooter: "Note: The rates are based on the enacted relevant staging for each preferential tariff listed, and the enacted MFN rates (static until further WTO negotiations).",
    str_FutureRatesFrench_TableFooter: "Note : Les taux sont fondés sur les échelonnements pertinents édictés pour chaque tarif de préférence énuméré, et sur les taux édictés de la N.P.F. (statiques jusqu’à d’éventuelles négociations à l’OMC).",
    str_iboxTabName_CCO: "CCO",
    str_iboxTabHeading_CCO: "Compendium of Classification Opinions",
    str_iboxTabName_CCOFrench: "RAC",
    str_iboxTabHeading_CCOFrench: "Recueil des avis de classement",
    str_RelatedTo: "Related To",
    str_ReferencedBy: "Referenced By",
    str_EY_Digest: "EY Digest",
    str_EY_Headnote: "EY Headnote",

    // END ANNOTATION STRINGS

    // START EMAIL DOC STRINGS
    str_YourEmail: ["Your Email Address", "Your email address"],
    str_ReceipientEmail: ["Recipient's Email Address", "Recipient's email address"],
    str_ReceipientEmailNote: "Separate multiple email addresses with commas. Limited to 3 addresses.",
    str_SendCopy: ["Send Me a Copy", "Send me a copy"],
    str_Subject: "Subject",
    str_PersonalMsg: ["Personal Message", "Personal message"],
    str_Optional: "optional",
    str_NoteEmailMsg: "Email recipients do not require a subscription to access the document link you are sending, which will remain active for 30 days. The email addresses you supply to use this service will not be shared with any third parties.",
    str_Send: "Send",
    str_EmailSent: "Your email has been sent to",
    str_TooManyEmailAddresses: "Please limit the number of recipients to 3 addresses or fewer, separated by commas.",
    str_BadEmailFormatting: "Please ensure that the address(es) you have entered is properly formatted (e.g. \"some.one@email.com, someone.else@email.com\") <br> The following address(es) are incorrect:",
    // END EMAIL DOC STRINGS

    //START DATE Month definition
    str_Long_Month_Name: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
    str_Short_Month_Name: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"],
    str_PostDayQualifier: "",
    //END Date Month Definition

    //START NEWS PREFERENCES
    str_general_preferences: ['General Preferences', 'General preferences'],
    str_email_preferences: ['Email Preferences', 'Email preferences'],
    str_sort_preferences: ['Sort Preferences', 'Sort preferences'],
    str_vacation_mode: ['Vacation Mode', 'Vacation mode'],
    str_clear_vacation_mode: ['Clear Vacation Mode', 'Clear vacation mode'],
    str_reset_fields: ['Reset Fields', 'Reset fields'],
    str_pref_submit_button: 'Save',
    str_news_preference_start_date: ['Start Date', 'Start date'],
    str_news_preference_end_date: ['End Date', 'End date'],
    str_email_frequency: ['Email Frequency', 'Email frequency'],
    str_email_settings: ['Email Settings', 'Email settings'],
    str_advanced_options: ['Advanced Options', 'Advanced options'],
    str_news_preferences: ['News Preferences', 'News preferences'],
    str_show: 'show all news',
    str_hide: 'hide all news',
    str_set_defaults: ['Set Defaults', 'Set defaults'],
    str_default: 'Default',
    str_turn_off: 'Turn off',
    str_pref_cancel: 'Cancel',
    str_dragdrop_description: 'Drag and drop the following headings to customize your news sort order',
    str_advanced_options_description: 'Uncheck all news types that you do not wish to receive news for',
    str_online_preferences: ['Online Preferences', 'Online preferences'],
    str_NewsPreferences_EmailDescription: 'Expand each section to set your preferences',
    str_NewsPreferences_OnlineDescription: 'Expand each section to set your preferences',
    str_NewsPreferences_VacationModeDescription: 'Enter your vacation period',
    str_at: 'at',
    str_cases: 'Cases',
    //END NEWS PREFERENCES

    //START NEWS SEARCHRESULTS
    str_NewsSearchResults_NoNewsForThisDate: "No news documents were released today.",
    str_NewsSearchResults_CriteriaYieldedNoHits: "No news documents were found for your search criteria.",

    str_NewsSearchResults_ViewDocument: "open document",
    str_NewsSearchResults_CloseDocument: "close document",

    str_NewsSearchResults_AlertPreview: "Alert Preview",
    //END NEWS SEARCHRESULTS


    //START Session Tracker
    str_SessionTracker_Label: "Session Tracker",
    str_SessionTracker: "Session Tracker",
    str_SessionTracker_Title: "Start Session Tracker?",
    str_SessionTracker_CreateClient: ["Create Client", "Create client"],
    str_SessionTracker_ClientName: ["Client Name", "Client name"],
    str_SessionTracker_RenameClient: ["Rename Client", "Rename client"],
    str_SessionTracker_DeleteClient: ["Delete Client(s)", "Delete client(s)"],
    str_SessionTracker_AddCommentToSession: "Add a Comment to This Session",
    str_SessionTracker_AddComment: ["Add a Comment", "Add a comment"],
    str_SessionTracker_ChooseClient: ["Choose Client", "Choose client"],
    str_SessionTracker_ManageClientList: ["Manage Client List", "Manage client list"],
    str_SessionTracker_GenerateReport: ["Generate Report", "Generate report"],
    str_SessionTracker_PopupScreenSize: "460x315",
    str_SessionTracker_PopupScreenSize_KNOTIAROUND: "460x250",
    str_SessionTracker_PopupScreenSize_KNOTIAFLAT: "460x275",
    str_SessionTracker_PopupScreenSize_EYEPFLAT: "460x298",
    str_SessionTracker_PopupScreenSize_EYFLAT: "460x298",
    str_SessionTracker_PopupScreenSize_EYFLAT: "460x300",
    str_SessionTracker_PopupScreenSize_TAXNAV: "460x275",
    str_SessionTracker_StartSession: "Start Session Tracker",
    str_SessionTracker_StopSession: "Stop Session Tracker",
    str_SessionTracker_PleaseStopTrackerMessage: "Your Session Tracker is currently on. Please hit \"stop\" before continuing.",
    str_SessionTracker_GeneralResearch: "General Research",
    str_SessionTracker_ChangeMySessionTrackerPreferences: "Change my session tracker preferences",
    str_SessionTracker_ChangeStartUpOption: "Change start up option",
    str_SessionTracker_Tab_Record: "Record",
    str_SessionTracker_Tab_Manage: "Manage",
    str_SessionTracker_ChooseExistingClient: "Choose existing client",
    str_SessionTracker_ChooseExistingClient_Description: "Choose an existing client to start the session tracker",
    str_SessionTracker_CreateNewClient: "Create new client",
    str_SessionTracker_CreateNewClient_Description: "Create a new client to start the session tracker",
    str_SessionTracker_ChooseClientDescription: "Please choose the client to start the session tracker",

    str_SessionTrackerPreferences_Label: "Session Tracker Preferences",
    str_SessionTrackerPreferences_StartUpOptions: "Start up option",
    str_SessionTrackerPreferences_StartUpOption_StartManually: "Start Session Tracker manually.",
    str_SessionTrackerPreferences_StartUpOption_AlwaysStartWithGeneralResearch: "Always start Session Tracker with General Research as “client”.",
    str_SessionTrackerPreferences_StartUpOption_PromoptToChooseAClient: "Prompt to Choose a client after login.",
    //END Session Tracker

    //START Pinboard
    str_Pinboard_HeaderTitle: "My Pinboard",
    str_Pinboard_PinnedItemAlreadyAdded: "You have already pinned this {0} to your Pinboard",
    str_Pinboard_ModalDialogTitle_EmptyPinboard: ["Empty Your Pinboard", "Empty your Pinboard"],
    str_Pinboard_ModalDialogTitle_DeleteSinglePinboardItem: ["Delete This Item", "Delete this item"],
    str_Pinboard_ModalDialogContent_EmptyPinboard: "This will remove all items from your Pinboard. Are you sure?",
    str_Pinboard_ModalDialogContent_DeleteSinglePinboardItem: "Are you sure you want to remove this {0} from your Pinboard?",
    str_Pinboard_DisplayTextPinTypeDoc: "document",
    str_Pinboard_DisplayTextPinTypeSearch: "search",
    str_Pinboard_EmptyPinboard: "Your pinboard is currently empty",
    str_Pinboard_Expand: ["Expand Your Pinboard", "Expand your Pinboard"],
    str_Pinboard_Collapse: ["Collapse Your Pinboard", "Collapse your Pinboard"],
    str_Pinboard_RemovePinnedItem: "Remove this ",
    str_Pinboard_DeleteAll: "Remove all items from your Pinboard",
    str_Pinboard_ModalDialogContent_AlreadySavedSearch: "You have already pinned this search to your Pinboard.",
    str_Pinboard_ModalDialogContent_AlreadySavedDocument: "You have already pinned this document to your Pinboard.",
    str_Pinboard_ModalDialogContent_DeleteSearchPinboardItem: "Are you sure you want to remove this search from your Pinboard?",
    str_Pinboard_ModalDialogContent_DeleteDocumentPinboardItem: "Are you sure you want to remove this document from your Pinboard?",
    //END Pinboard


    // START CPE 
    str_CPE_EnterDate: "Please enter the date for which you earned your CPE hours.",
    str_CPE_IncorrectDateFormat: "Please use the correct date format: yyyy-mm-dd",
    str_CPE_InvalidDate: "You have entered an invalid date.",
    str_CPE_EnterActivity: "Please enter the CPE activity.",
    str_CPE_EnterProvider: "Please enter the CPE provider.",
    str_CPE_EnterHour: "Please enter your CPE hours.",
    str_CPE_EnterOnlyStructuredOrUnstructured: "Please enter only structured or unstructured CPE hours.",
    str_CPE_InvalidHour: "Invalid CPE hour.",
    str_CPE_InvalidMinute: "Invalid CPE minute.",
    str_CPE_ConfirmDelete: "Are you sure you want to delete this entry?",
    str_CPE_CurrentlyEditingAnotherEntry: "You are currently editing another CPE entry. Please close/save that one first.",

    // END CPE

    // START OF NOTE STRINGS
    str_MyNotes: ["My notes", "My Notes"],
    str_LastModified: "Last modified on ",
    str_HighlightColour: ["Highlight Colour: ", "Highlight colour: "],
    str_AccessMyNotesUnderBriefcase: "Access My Notes under the Briefcase tab.",
    str_Notes_YouAreAboutToDeleteYourNotesAndHighlight: "Your notes and highlights will be removed from the following document(s)",
    str_Notes_LandingPageMessage1: "Browse your customized collection of notes and highlights using the table of contents pane on the left, or call up a particular note in an instant with the dedicated Search My Notes feature above.",
    str_Notes_LandingPageMessage2: "You can also edit existing notes by adding or updating text.",
    str_Notes_NoNotes: "You do not have any saved notes.",
    str_GoToThisDocumentIn: "Go to this document in",
    str_BelowAreTheParagraphs: "Below are the paragraphs where you put a note or highlight:",
    str_WarningTextChange: "Warning! The text of this paragraph has changed since you highlighted it. Consider whether this changes the context.",
    str_ParagraphContentHasChanged: "Paragraph content has changed",
    str_TextYouAppliedHasChanged: "The text that you applied your highlight and/or note to has changed.",
    str_TextOriginallyRead: "The text originally read as follows:",
    str_YourNoteIs: ["Your Note Is:", "Your note is:"],
    str_YourNote: " and your note",
    str_Colour_None: "None",
    str_Colour_Yellow: "Yellow",
    str_Colour_Orange: "Orange",
    str_Colour_Green: "Green",
    str_Colour_Blue: "Blue",
    str_Colour_Purple: "Purple",
    str_Colour_Red: "Red",
    str_PleaseSelectText: "Please select some text before adding a note.",
    str_RemoveHighlight: "Are you sure you want to remove this highlight",
    str_Notes_UnableToAddNoteAndHighlight: "Unable to add your notes and highlight.",
    str_Notes_UnableToAddHighlight: "Unable to add your highlight.",
    // END OF NOTE STRINGS

    // START BASELINE TEXT //
    str_FATCA_IGA_Baseline_Prefix: "FATCA IGA Baseline ",
    str_FATCA_Baseline_Tooltip_Text: "FATCA baseline is based on Reciprocal Model 1A Agreement, Pre-existing TIEA or DTC issued on 11/30/2014, United Kingdom FATCA Guidance notes issued on 8/28/2014 and various IRS publications (see country page for more detail).",
    str_CRS_IGA_Baseline_Prefix: "CRS IGA Baseline ",
    str_CRS_Baseline_Tooltip_Text: "CRS Basline “CRS baseline is based on the Standard for Automatic Exchange of Financial Account Information issued by OECD on 7/21/2014",
    // END BASELINE TEXT //

    //START DOWNLOADS HELP TEMPLATE STRINGS
    str_Downloads_DownloadList: "Download List",
    str_Downloads_Title: "Title",
    str_Downloads_DownloadLinks: "Downloads",
    str_Downloads_AllLanguages: "All Languages",
    str_Downloads_English: "English",
    str_Downloads_French: "French",
    str_Downloads_EmailPreferences: "Email Preferences",
    str_Downloads_EmailDescription: "Your email preferences have been updated.",
    str_Downloads_DownloadsEmpty: "You don't have any downloads available in your subscription.",
    //END DOWNLOADS HELP TEMPLATE STRINGS

    //START INTERACTIVE HELP TEMPLATES STRINGS
    str_InteractiveHelp_Archived: "Archived",
    str_InteractiveHelp_CreateMessage: "Create Message",
    str_InteractiveHelp_DateTime: "Date / Time",
    str_InteractiveHelp_Deleted: "Deleted",
    str_InteractiveHelp_DeleteEvent: "Delete Event",
    str_InteractiveHelp_DeleteMessage: "Delete Message",
    str_InteractiveHelp_Draft: "Draft",
    str_InteractiveHelp_EditEvent: "Edit Event",
    str_InteractiveHelp_EditMessage: "Edit Message",
    str_InteractiveHelp_EndDate: "End Date",
    str_InteractiveHelp_EndTime: "End Time",
    str_InteractiveHelp_English: "English",
    str_InteractiveHelp_Events: "Events",
    str_InteractiveHelp_EmptyTitle: "Title cannot be empty.",
    str_InteractiveHelp_EmptyStatus: "Status has not been selected.",
    str_InteractiveHelp_EmptyPriority: "Priority cannot be empty.",
    str_InteractiveHelp_EmptyStartDate: "Start date format is incorrect (dd/mm/yyyy).",
    str_InteractiveHelp_EmptyEndDate: "End date is format incorrect (dd/mm/yyyy).",
    str_InteractiveHelp_EmptyStartTime: "Start time format is incorrect (hh/mm/ss am/pm).",
    str_InteractiveHelp_EmptyEndTime: "End time format is incorrect (hh/mm/ss am/pm).",
    str_InteractiveHelp_EmptyTargetAudience: "Target audience has not been selected.",
    str_InteractiveHelp_EmptyMessages: "The Status cannot be \"live\" without at least one english and one french message.",
    str_InteractiveHelp_EmptyDescription: "Description cannot be empty.",
    str_InteractiveHelp_EventSaveRequired: "Event must be saved before adding a new message.",
    str_InteractiveHelp_ErrorMessage: "Error Message",
    str_InteractiveHelp_ErrorOnSaveEvent: "Please fix the following errors to save the event.",
    str_InteractiveHelp_ErrorOnSaveMessage: "Please fix the following errors to save the message.",
    str_InteractiveHelp_ErrorOnCreateMessage: "Please fix the following errors to create a message.",
    str_InteractiveHelp_French: "French",
    str_InteractiveHelp_InteractiveHelpEvent: "Interactive Help Event",
    str_InteractiveHelp_InteractiveHelpEvents: "Interactive Help Events",
    str_InteractiveHelp_InteractiveHelpMessage: "Interactive Help Message",
    str_InteractiveHelp_Live: "Live",
    str_InteractiveHelp_Message: "Message",
    str_InteractiveHelp_MessageTitle: "Title",
    str_InteractiveHelp_MessageVideoLink: "Video Link",
    str_InteractiveHelp_MessageDescription: "Description",
    str_InteractiveHelp_Messages: "Messages",
    str_InteractiveHelp_MessageList: "Message List",
    str_InteractiveHelp_MessageAlreadyExists: "Message Already Exists in the Selected Language.",
    str_InteractiveHelp_Metadata: "Metadata",
    str_InteractiveHelp_NewEvent: "New Event",
    str_InteractiveHelp_NotSet: "Not Set",
    str_InteractiveHelp_NoMessages: "No Messages",
    str_InteractiveHelp_NoOptionsAvailable: "No Options Available",
    str_InteractiveHelp_NoSelectedOptions: "No Selected Options",
    str_InteractiveHelp_Options: "Options",
    str_InteractiveHelp_PreviewMessage: "Preview Message",
    str_InteractiveHelp_Priority: "Priority",
    str_InteractiveHelp_ProductWide: "Product Wide",
    str_InteractiveHelp_RefreshEvent: "Refresh Event",
    str_InteractiveHelp_ReturnToEventList: "Return to Interative Help Event List",
    str_InteractiveHelp_SaveEvent: "Save Event",
    str_InteractiveHelp_SaveMessage: "Save Message",
    str_InteractiveHelp_SelectedOptions: "Selected Options",
    str_InteractiveHelp_Search: "Search",
    str_InteractiveHelp_Status: "Status",
    str_InteractiveHelp_SiteWide: "Site Wide",
    str_InteractiveHelp_SiteWideorProductWide: "Site Wide or Product Wide",
    str_InteractiveHelp_StartDate: "Start Date",
    str_InteractiveHelp_StartTime: "Start Time",
    str_InteractiveHelp_Status: "Status",
    str_InteractiveHelp_TargetAudience: "Target Audience",
    str_InteractiveHelp_Title: "Title",
    //END INTERACTIVE HELP TEMPLATES STRINGS

    //START LEARNING TEMPLATES STRINGS
    str_Learning: "Learning",
    str_Learning_more: "More",
    str_Learning_less: "Less",
    str_Learning_Year: "Year",
    str_Learning_Search: "Search",
    str_Learning_Find: "Find",
    str_Learning_Find_Presentation: "Find a presentation",
    str_Learning_Back: "Back to the top",
    str_Learning_View_Presentation: "View Presentation",
    str_Learning_Download_Presentation: "Download Presentation",
    str_Learning_Download_Slides: "Download Slides",
    str_Learning_Empty: "There are no results based on the year selected and search term.",
    str_Learning_Add_Media: "Add media to the webcast",
    str_Learning_Delete_Media_Success: "Media is deleted",
    str_Learning_Add_Media_Error: "Error occured in adding new media",
    str_Learning_Add_Media_Success: "New media is added",
    str_Learning_Update_Media_success: "Media is updated",
    str_Learning_Empty_Fields: "Empty fields",
    str_Learning_Empty_Webcast_Name: "Empty webcast name",
    str_Learning_Empty_Webcast_Date: "Empty webcast date",
    str_Learning_Empty_Webcast_CPE_Credit: "Empty webcast CPE credit",
    str_Learning_Empty_Webcast_Description: "Empty webcast description",
    str_Learning_Incorect_Date_Format: "Date format is incorrect",
    str_Learning_Update_Webcast_Success: "Webcast changes saved",
    str_Learning_Update_Webcast_Error: "Error occured in webcast update",
    str_Learning_Create_Webcast_Error: "Error occured in creating update",
    str_Learning_Create_Webcast_Success: "Webcast successfully added",
    str_Learning_Description_Note: "Description goes here",
    str_Learning_Media_Size_Error: "Media size is not a number",
    str_Learning_Media_Update: "Update the media",
    str_MediaSize_Or_Duration_Type_MEGABYTES: "Megabytes",
    str_MediaSize_Or_Duration_Type_MINUTES: "Minutes",
    str_Selected: "Selected: ",
    str_Select_Year: "Please select a year",
    str_Select_Month: "Please select a month",

    str_LearningNews_AlertID: "Alert ID",
    str_LearningNews_EnglishTitle: "English Title",
    str_LearningNews_EnglishDescription: "English Description",
    str_LearningNews_FrenchTitle: "French Title",
    str_LearningNews_FrenchDescription: "French Description",
    str_LearningNews_CreateTitle: "Create Draft",
    str_LearningNews_SaveTitle: "Save Draft",
    str_LearningNews_SavedTitle: "Draft Saved",
    str_LearningNews_SavedMessage: "The draft has been saved.",
    str_LearningNews_DeleteTitle: "Delete Draft",
    str_LearningNews_DeleteMessage: "Are you sure you want to delete the draft?",
    str_LearningNews_ReleaseTitle: "Release Draft",
    str_LearningNews_ReleaseMessage: "Are you sure you want to release the draft?",
    str_LearningNews_ReleasedMessage: "The draft has been released.",
    str_LearningNews_Preview: "Preview",
    str_LearningNews_ValidationTitle: "Missing Information",
    str_LearningNews_ValidationMessage: "Please fill in all of the form.",

    str_Learning_Service_Prefix: "/Services/LearningService.svc/",
    //END LEARNING TEMPLATES STRINGS
    //START INTERACTIVE HELP TEMPLATES STRINGS
    str_InteractiveHelp_Select_Sites: "Select the sites",
    str_InteractiveHelp_Select_Products: "Select the products",
    //END INTERACTIVE HELP TEMPLATES STRINGS

    // START GWTR FEEDBACK STRINGS //
    str_Feedback_Request: "Please complete the form below to submit a comment or question to the ~SiteName~ team.",
    str_Comment_Limit: "Please write your comment/question within 2000 characters.",
    str_Comment_Question: "Comment / Question",
    str_Response_requested: "Response requested",
    str_Required_if_request: "Required if response requested",
    // END GWTR FEEDBACK STRINGS //

    //START OF HOLDING BAY STRINGS
    str_HoldingBay_RegistrationApprove: ["Registration Approval", "Registration approval"],
    str_HoldingBay_RegistrationApproveButton: ["Approve Registration", "Approve registration"],

    str_HoldingBay_RegistrationApprovedMessage_: "Your registration has been approved.",
    str_HoldingBay_RegistrationApprovedMessage_AUSTaxExchange: "Your registration for Tax Oceania Navigator has been approved. Please [link]click here[end-link] to visit.",
    str_HoldingBay_RegistrationApprovedMessage_USTaxNewsInternal: "Your registration for US Tax Alerts has been approved. Please [link]click here[end-link] to activate your profile.",
    str_HoldingBay_RegistrationApprovedMessage_USTaxNewsExternal: "Your registration for US Tax Alerts has been approved. Please [link]click here[end-link] to activate your profile.",
    str_HoldingBay_RegistrationApprovedMessage_GTNUInternal: "Your registration for Global Tax News has been approved. Please [link]click here[end-link] to activate your profile.",
    str_HoldingBay_RegistrationApprovedMessage_GTNUExternal: "Your registration for Global Tax News has been approved. Please [link]click here[end-link] to activate your profile.",

    str_HoldingBay_RegistrationDecline: ["Registration Decline", "Registration decline"],
    str_HoldingBay_RegistrationDeclineButton: ["Decline Registration", "Decline registration"],

    str_HoldingBay_RegistrationDeclinedMessage_: "Your registration has been declined.",
    str_HoldingBay_RegistrationDeclinedMessage_AUSTaxExchange: "Your registration for Tax Oceania Navigator has been declined.",
    str_HoldingBay_RegistrationDeclinedMessage_USTaxNewsInternal: "Your request to be registered to receive EY’s Tax Alerts has been declined based on your company affiliation. If you believe this has been done in error, please send an email to ustaxalertshelp@ey.com with the name of your EY contact who may provide an exception on your behalf. Thank you.",
    str_HoldingBay_RegistrationDeclinedMessage_USTaxNewsExternal: "Your request to be registered to receive EY’s Tax Alerts has been declined based on your company affiliation. If you believe this has been done in error, please send an email to ustaxalertshelp@ey.com with the name of your EY contact who may provide an exception on your behalf. Thank you.",
    str_HoldingBay_RegistrationDeclinedMessage_GTNUInternal: "Your request to be registered to receive EY’s Tax Alerts has been declined based on your company affiliation. If you believe this has been done in error, please send an email to globaltaxnewsupdatehelp@ey.com with the name of your EY contact who may provide an exception on your behalf. Thank you.",
    str_HoldingBay_RegistrationDeclinedMessage_GTNUExternal: "Your request to be registered to receive EY’s Tax Alerts has been declined based on your company affiliation. If you believe this has been done in error, please send an email to globaltaxnewsupdatehelp@ey.com with the name of your EY contact who may provide an exception on your behalf. Thank you.",

    str_HoldingBay_RegistrationHistory: ["History", "History"],
    str_HoldingBay_RegistrationHistoryButton: ["View Follow-up Email History", "View Follow-up Email History"],

    str_HoldingBay_RegistrationFollowUp: ["Registration Follow-up", "Registration follow-up"],
    str_HoldingBay_RegistrationFollowUpButton: ["Send Follow-up Email", "Send follow-up email"],
    //END OF HOLDING BAY STRINGS

    //START LOGOUT PAGE STRINGS
    str_Logout_SuccessfulLogout: "You have successfully logged out.",
    str_Logout_SuccessfulAccountDeletion: "Your account and all associated information has been deleted.",
    str_AccountDeleted: "Account Deleted",
    str_LogOut: "Log Out",
    str_CloseWindow: "Close Window",
    //END OF LOGOUT PAGE STRINGS

    //START PROFILE PAGES STRINGS
    str_Profile_FirstName: "First Name",
    str_Profile_LastName: "Last Name",
    str_Profile_Password: "Password",
    str_Profile_Email: "Email",
    str_Profile_Title: "Title",
    str_Profile_UserID: "User ID",
    str_Profile_CpaNum: "CPA Canada Number",
    str_Profile_CpaMemberType: "Member Type",
    str_Profile_CpaMemberStatus: "Member Status",
    str_Profile_GenerateLoginCode: "Generate Login Code",
    str_Profile_EnterEmailAddress: "Enter email address",
    str_Profile_PersonalInformation: "Personal information",
    str_Profile_CompanyInformation: "Company information",
    str_Profile_ErrorRequest: "Attention required",
    str_Profile_UserEmailAlreadyExist: "Another user with the same email address already exists.",
    str_Profile_UserCouldNotBeFound: "User could not be found.",
    str_Profile_PasswordDidNotPassComplexityValidation: "Your password cannot be changed. Password did not meet complexity requirements.",
    str_Profile_CouldNotAuthenticateUser: "Your password cannot be changed. Old password provided does not match our records.",
    str_Profile_NewPasswordSameAsOld: "Your password cannot be changed. Old password cannot be reused.",

    str_Profile_MoveUser: "Move User",
    str_Profile_MoveUsers: "Move Users",
    str_Profile_MoveSingleUser_SelectedUsersStatement: "<userName> will be moved to another company.",
    str_Profile_MoveMultipleUsers_SelectedUsersStatement: "The following users will be moved to another company",
    str_Profile_MoveUser_CompanySelectionStatement: "Please select a destination company from the list below",
    str_Profile_MoveUser_FilterCompany: "Filter company",
    str_Profile_MoveUser_PleaseSelectDestinationCompany: "Please Select Destination Company",
    str_Profile_MoveUser_DestinationCompanyName: "Destination company name",
    str_Profile_MoveUser_PleaseEnterADestinationCompanyName: "Please enter a destination company name",
    str_Profile_MoveUser_DestinationCompanyResultAlertMessage: "Too many results, please type more to get the destination company.",
    str_Profile_MoveUser_NoCompanyFound: "No company found.",
    //END OF PROFILE PAGES STRINGS

    //START OF USER PACKAGE STRINGS
    str_Packages_AssignPackageTitle: "Assign User Package(s)",
    str_Packages_AssignPackageInstruction: "Assign package(s) by checking the appropriate box(es) below.",
    str_Packages_AssignPackageNote: "Note: If you're assigning more than package, the user can switch between assigned packages through the \"Switch Package\" link at the top right corner.",
    str_Packages_AssignPackageButton: "Assign Package(s)",
    str_Packages_AssignPackageOnSuccessMessage: "Package changes applied!",
    str_Packages_MustAssignAtLeastOne: "You must select at least one package.",
    str_Packages_PackageUserListReportTitle: "Package User List Report",
    str_Packages_PackageUserListInstructionStart: "Generate a user report by selecting a package from the drop down or you may click ",
    str_Packages_PackageUserListInstructionEnd: " to export users from all packages into a CSV.",
    str_Packages_DownloadUsersFromAllPackages: "Download users from all packages",
    str_Packages_SelectPackageLabel: "Please select a package:",
    str_Packages_NoUsersAssigned: "No user assigned to this package",
    str_Packages_DownloadAsCSV: "Download as CSV",
    //END OF USER PACKAGE STRINGS

    //START REACT COMPONENTS DEFAULT STRINGS
    str_Component_defaultTextInput: "Text Input",
    str_Component_defaultPasswordInput: "Password",
    str_Component_defaultTextArea: "Text Area",
    str_Component_defaultPhoneInput: "Phone Number",
    str_Component_placeholderPhoneInput: "Ph. #",
    str_Component_defaultPhoneAreaCode: "Area Code",
    str_Component_defaultPhoneExtension: "Ext",

    str_Component_errorRequired: "Required",
    str_Component_errorNumericValuesOnly: "Please enter numeric values only",
    //minlength is appending at the end of this text NOTE: can add functionality to specify where to place that
    //OR just remove that, and manually override this text with the length value manually specified
    str_Component_errorMinLengthText: "Min length is: ",
    str_Component_errorMaxLengthText: "Max length reached",
    str_Component_errorNotFoundText: "No results found",
    str_Component_errorRequestTimeout: "Fetch request took too long",

    str_Component_defaultCheckboxList: "Checkbox List",
    str_Component_defaultRadioButtonList: "Radio Button List",
    str_Component_defaultFilterableSelect: "Filterable Select",
    str_Component_placeholderFilterableSelect: "Select...",
    str_Component_defaultAlertBox: "Default: This is a generic alert",
    str_Component_defaultContentBox: "Content Box",
    str_Component_defaultContentBox_inputHTML: "Can place another React/HTML component here",
    str_Component_defaultButton: "Button",
    str_Component_placeholderTable: "Filter the current page results",
    str_Component_placeholderFilterableProductList: "Filter Products",

    str_Component_errorEmailInvalid: "Invalid email address",
    //END OF REACT COMPONENTS DEFAULT STRINGS

    str_Dummy: "",

    str_SiteName_CPA: "CPA Canada",
    str_SiteName_EYTaxNavigator: "Tax Navigator",
    str_SiteName_EYOnlineUS: "Canadian Tax Library",
    str_SiteName_CRAKnotia: "CRA Knotia",
    str_SiteName_Knotia: "Knotia",
    str_SiteName_GTNU: "Global Tax News Update",
    str_SiteName_GTNU_Short: "GTNU",
    str_EY_logo: "EY logo",
    str_GTNU_Tax_Content: "EY GTNU Tax Content",


    str_EYTaxNavigator_Footer_Copyright: "2001-~yearEnd~, Ernst & Young Electronic Publishing Services, Inc. All rights reserved.",
    str_EYTaxNavigator_Footer_HelpDeskHours: "Mon-Fri, 8am-6pm ET",
    str_EYTaxNavigator_Footer_HelpDeskContactInfo: "1-888-352-2228 (in Toronto: 416-943-3999)",
    str_EYTaxNavigator_Footer_Footnote: "Tax Navigator is for the exclusive use of EY Partners and staff only.",

    str_MNP_Footer_Footnote: "This site is for the exclusive use of MNP Partners and Staff.  Keep your password secure.",
    str_MNP_Footer_Copyright: "&copy; 2001&#45;~yearEnd~ Ernst &amp; Young Electronic Publishing Services, Inc. &nbsp; All rights reserved.",
    str_MNP_Footer_HelpDeskHours: "Mon-Fri, 8am-6pm ET",
    str_MNP_Footer_HelpDeskContactInfo: "1-888-352-2228 (Toronto: 416-943-3999)",
    str_MNP_Footer_HelpDesk_Email: "support@knotia.ca",

    str_EYOnlineUS_Footer_HelpDesk_Email:"support@eyo.ca",

    str_TermsOfUse: "Terms of Use",
    str_EYPrivacyPolicy: "EY Privacy Policy",
    str_CPAPrivacyPolicy: "CPA Privacy Policy",
    str_EYWebAccessibility_Statement: "EY Web Accessibility Statement",


    //CRA KNOTIA FOOTER
    str_CRAKnotia_Footer_Screen_Resolution_Tip: "To best view this site, use at least 1280 x 720 screen resolution with web browser zoom kept at 100%",
    str_CRAKnotia_Footer_HelpDesk_Contact: "Excise and GST Systems Helpdesk-LPRAB (CRA)",
    str_CRAKnotia_HelpDesk_ContactUsLink: "mailto:zlpragsthdg@cra-arc.gc.ca",

    str_Knotia_Footer_HelpDesk_Contact: "Help Desk",
    str_Knotia_HelpDesk_ContactUsLink: "mailto:support@knotia.ca",

    str_Footer_ContactUs: "Contact Us",
    str_Footer_ContactUsLink_TaxNav: "mailto:support@taxnavigator.ca",
    str_Footer_HelpDesk: "Help Desk",

    //Header 
    str_Header_SearchFetchBar_PlaceHolderInput: "Enter search query or document ID to fetch",
    str_Header_SearchFetchBar_Multiple: "Multiple",
    str_Header_SearchFetchBar_SelectCategory: "Please select a category to search in",
    str_Header_SearchFetchBar_SelectProduct: "Please select a product to search in",
    str_Header_SearchFetchBar_all: "All",

    str_MyProfile: "My Profile",
    str_UserProfile: "'s Profile",
    str_Preferences: "Preferences",
    str_Logout: "Logout",
    str_Language_Options: "Language options",

    str_WhatsNewQuestion: "What's New?",

    str_HomePageTabs_Research: "Research",
    str_HomePageTabs_News: "News",
    str_HomePageTabs_Learning: "Learning",
    str_HomePageTabs_Interact: "Interact",
    str_HomePageTabs_Tools: "Tools",
    str_HomePageTabs_History: "History",
    str_HomePageTabs_CRAInternalCollection: "CRA Internal Collections",



    //EY Interact links (found in Tax Navigator)
    str_EYInteract_Homepage: "EYI My Documents",
    str_EYInteract_Canada_Guidance_Provisioning: "Canada Guidance for EYI My Documents",
    str_EYInteract_Service_Now_Support_Form: "EYI My Documents Support",
    str_EYInteract_My_Documents_Text_Link: "EYI My Documents - Home",
    str_EYInteract_Canada_Guidance_Text_Link: "Canada Guidance (sharepoint.com)",
    str_EYInteract_Support_Text_Link: "EY Interact Support - EY Technology Service Portal (service-now.com)",

    str_TNUHomePageTabs_TaxContent: "EY Tax Content",
    str_TNUHomePageTabs_TaxResearch: "Tax Research",
    str_TNUHomePageTabs_SubserviceLines: "Subservice Lines",
    str_TNUHomePageTabs_Webcasts: "Webcasts",
    str_TNUHomePageTabs_History: "My History",
    str_TNUHomePageTabs_TaxPortal: "Tax Portal",
    str_TNUHomePageTabs_BestOfTNU: "Best of TNU",
    str_TNUHomePageTabs_Spotlight: "Spotlight",
    str_TNUHomePageTabs_AboutTNU: "About TNU",
    str_TNUHomePageTabs_RecentNews: "Recent News",
    str_TNUHomePageTabs_Library: "Library",
    str_TNUHomePageTabs_EYStore: "EY Store",
    str_TNUHomePageTabs_EYMedia: "EY Media",


    //Page Navigation Tabs
    str_PageNavigationTabs_Home: "Home",
    str_PageNavigationTabs_TaxMaterials: "Tax Materials",
    str_PageNavigationTabs_Subscriptions: "Subscriptions",
    str_PageNavigationTabs_News: "News",
    str_PageNavigationTabs_Research: "Research",
    str_PageNavigationTabs_Tools: "Tools",
    str_PageNavigationTabs_Briefcase: "Briefcase",
    str_PageNavigationTabs_EYDiscover: "EY Discover",
    str_PageNavigationTabs_Learning: "Learning",
    str_PageNavigationTabs_Admin: "Admin",
    str_PageNavigationTabs_Classifier: "Classifiers",
    str_PageNavigationTabs_CaseFinder: "Case Finders",
    str_PageNavigationTabs_Hamburger: "Navigation",

    str_CPE_Tracker: "CPE Tracker",
    str_CPE_Tracker_Description: "Track the time you spend on continuing professional education (CPE) and development activities, and run a report for any time period to support your CPE requirements.",

    str_TaxKnowledgeForum_Description: "Tax knowledge Forum is a monthly webcast featuring an overview of recent cases, legislation, and rulings.",

    str_TaxTechnicalUpdate_Description: "Tax technical Updates are monthly webcasts on emerging tax topics, presented by senior EY tax professionals.",

    str_Briefcase_SavedDocuments: "Saved Documents",
    str_Briefcase_SavedSearches: "Saved Searches",
    str_Briefcase_ViewMyNotesAndHighlights: "View My Notes and Highlights",
    str_Briefcase_MyBriefcase: "My Briefcase",
    str_Briefcase_NoSavedDocuments: "No saved documents",

    // START SEARCH DROPDOWN //
    str_SearchDropdown_PreviousSearches: "Your Previous Searches in ",
    str_SearchDropdown_FetchSuggestions: "Fetch Suggestions for",
    str_SearchDropdown_DocumentSuggestions: "Document Suggestions for",
    str_SearchDropdown_GoToDocument: "Go to document",
    str_SearchDropdown_SearchFor: "Search for",
    str_SearchDropdown_PleaseTypeYourSearchTerm: "Please type your search term",
    str_SearchDropdown_NoPreviousSearchesIn: "No previous searches in",

    // START SEARCH OPTIONS MODAL //
    str_SearchOptionsModal_SearchTools: "Search Tools",
    str_SearchOptionsModal_Settings: "Settings",
    str_SearchOptionsModal_Help: "Help",
    str_SearchOptionsModal_Templates: "Templates",
    str_SearchOptionsModal_TopicalIndexes: "Topical Indexes",
    str_SearchOptionsModal_SearchSyntax: "Search Syntax",
    str_SearchOptionsModal_FetchPrefix: "Fetch Prefix",
    str_SearchOptionsModal_SearchSyntaxHelp: "Search Syntax Help",
    str_SearchOptionsModal_ProductSelection: "Please choose a product",

    // START TOOLBAR // //should be lower case
    str_Toolbar_MostRecent: "Most Recent",
    str_Toolbar_Tag: "Tag",
    str_Toolbar_CreateLink: "Create Link",
    str_Toolbar_Highlight: "Highlight",
    str_Toolbar_Pin: "Pin",
    str_Toolbar_UserViewCounts: "View Counts",
    str_Toolbar_MyPinboard: "Pinboard",
    str_Toolbar_Share: "Share",
    str_Toolbar_Link: "Link",

    str_Toolbar_Tooltip_MostRecent: "Get the most recent news",
    str_Toolbar_Tooltip_Reload: "Reload the page to the default view",
    str_Toolbar_Tooltip_Copy: "Copy selected text with context",
    str_Toolbar_Tooltip_ParagraphTagging_On: "Turn Paragraph Tagging Off",
    str_Toolbar_Tooltip_ParagraphTagging_Off: "Turn Paragraph Tagging On",
    str_Toolbar_Tooltip_DownloadDocument: "Download document to your device",
    str_Toolbar_Tooltip_PrintDocument: "Print document to your device",
    str_Toolbar_Tooltip_IncreaseFont: "Increase the font size",
    str_Toolbar_Tooltip_DecreaseFont: "Decrease the font size",
    str_Toolbar_Tooltip_CreateDocumentLink: "Create link to this document to share with a colleague",
    str_Toolbar_Tooltip_OpenPinboard: "Open the pinboard",
    str_Toolbar_Tooltip_ClosePinboard: "Close the pinboard",
    str_Toolbar_Tooltip_EmailDocument: "Email this document to a colleague",
    str_Toolbar_Tooltip_AddToBriefcase: "Save document(s) to Briefcase",
    str_Toolbar_Tooltip_HighlightDocument: "Add highlights to this document",
    str_Toolbar_Tooltip_PinThisDocument: "Pin this item to your Pinboard",
    str_Toolbar_Tooltip_ViewCount: "Show view counts",
    str_Toolbar_Tooltip_NewsPreference: "Modify your News preferences",
    str_Toolbar_Tooltip_ChooseNewsDate: "Compile all news articles released on selected date",
    str_Toolbar_Tooltip_ChooseNewsRange: "Compile previously released articles within the specified range", 
    str_Toolbar_Tooltip_EmailNews: "Email this News item to a colleague",
    str_Toolbar_Tooltip_Share: "Share this document",
    str_Toolbar_Tooltip_SearchTemplates: "Open Search Templates",

    str_Toolbar_Tooltip_CreateBriefcaseFolder: "Create a folder in your Briefcase",
    str_Toolbar_Tooltip_ModifyBriefcaseFolder: "Rename the selected folder name",
    str_Toolbar_Tooltip_DeleteBriefcaseItems: "Delete selected Briefcase items",
    str_Toolbar_Tooltip_MoveBriefcaseItems: "Move or copy selected documents in your Briefcase",
    str_Toolbar_Tooltip_ManageBriefcaseAccess: "Manage who can access your Briefcase documents",

    str_Toolbar_Tooltip_RenameSavedSearch: "Rename a previously saved search",
    str_Toolbar_Tooltip_DeleteSavedSearch: "Delete a prevously saved search",

    str_Toolbar_FullScreen_Maximize: "Maximize",
    str_Toolbar_FullScreen_Restore: "Restore",
    str_Toolbar_Tooltip_FullScreen_Maximize: "Full screen mode hides the website's header to provide you with a larger document viewing experience. You can also press 'F11' in most web browsers to hide all navigation and show even more of the web page",
    str_Toolbar_Tooltip_FullScreen_Restore: "Restores the website's header so you can search the site, and you can navigate to other parts of the site.",

    // ADMIN //
    str_KnowledgeAdmin: "Knowledge Admin",
    str_Admin_EnableCMT: "Enable CMT",
    str_Admin_CMT_Description: "The CMT(Content Management Tool) allows to make changes to this product.",
    str_Admin_ViewDocumentCounts: "View Document Counts",
    str_Admin_HideDocumentCounts: "Hide Document Counts",
    str_Admin_ViewDocumentCounts_Description: "Shows the number of users who viewed the document/node on the Table of Contents (TOC).",

    // START DOWNLOAD DOCUMENT MODAL //
    str_DownloadDocument: "Download Document",
    str_DownloadDocumentModal_Description: "Please choose your options for downloading your content",
    str_DownloadDocumentModal_CurrentDocument: "Current document",
    str_DownloadDocumentModal_CurrentDocument_Description: "Downloads the document you are currently viewing",
    str_DownloadDocumentModal_CurrentDocument_WordDocument_Description: "Downloads the document as WORD",
    str_DownloadDocumentModal_CurrentDocument_PDFDocument_Description: "Downloads the document as PDF",
    str_DownloadDocumentModal_TOC_Description: "Downloads the selected documents on the table of contents",
    str_DownloadDocumentModal_SearchResultsDocuments: "Search results documents",
    str_DownloadDocumentModal_SearchResultsDocuments_Description: "Downloads the selected documents on the search results",
    str_DownloadDocumentModal_TaggedParagraphs: "Tagged Paragraphs",
    str_DownloadDocumentModal_TaggedParagraphs_Description: "Downloads all tagged paragraphs in the current document you are viewing",
    str_DownloadDocumentModal_DocumentType_Description:"Download your document as:",
    str_DownloadDocumentModal_DocumentType_DOC: "DOC",
    str_DownloadDocumentModal_DocumentType_DOCX: "DOCX",
    str_DownloadDocumentModal_DocumentType_PDF: "PDF",

    // SEARCH SYTNAX HELP MODAL //
    //str_SearchSyntaxHelpModal_OperatorOrScope: "Operator or Scope",
    str_SearchSyntaxHelpModal_Example: "Example",
    //str_SearchSyntaxHelpModal_Examples: "Examples",
    //str_SearchSyntaxHelpModal_Searches_For: ["Searches For", "Searches for"],
    //str_SearchSyntaxHelpModal_WhenToUse: ["When to Use", "When to use"],
    str_SearchSyntaxHelpModal_FetchID: "Fetch ID",

    //HISTORY
    str_History_RecentlyViewedDocuments: "My Recently Viewed Documents",
    str_History_RecentSearches: "My Recent Searches",

    //HOMEPAGE TAX SUBJECT FILE
    str_TaxSubjectFileSubmission: "Tax Subject File Submission",
    str_TaxSubjectFile_QuickSubmission_Outlook: "Quick submission using Outlook",
    str_TaxSubjectFileSubmission_Contribute_Outlook: "Contribute now using Outlook",
    str_TaxSubjectFileSubmission_Email_Description: "Email our team your document, and we will fill out all of the submission details for you.",
    str_TaxSubjectFileSubmission_Form: "Tax Subject File submission form",
    str_TaxSubjectFileSubmission_Form_Description: "Help us by filling out the Tax Subject File submission form.",
    str_TaxSubjectFileSubmission_Contribute_Form: "Contribute now using the TSF form",

    //HOMEPAGE COMMON LINKS
    str_CommonLinks: "Common Links",
    str_QuickLinks: "Quick Links",
    str_OtherResources: "Other Resources",
    str_SignUpClientsForCTL: "Sign up clients for Canadian Tax Library",
    str_SignUpForCTL: "Sign up for Canadian Tax Library",
    str_SignUpClientsForCTLLink: "https://eycanada.sharepoint.com/sites/ConnectourclientstotheCanadianTaxLibrary/SitePages/CollabHome.aspx",
    str_ChangeNewPreferences: "Change my email notification preferences",
    str_DownloadAnEbook: "Download an eBook",
    str_TrainingVideosAndUserGuides: "Training Videos and User Guides",

    //PRODUCT SELECTION DROPDOWN
    str_ProductSelectionDropdown_Notes: "Notes",
    str_ProductSelectionDropdown_Briefcase_SavedDocuments: "Briefcase - Saved Documents",
    str_ProductSelectionDropdown_Briefcase_SavedSearches: "Briefcase - Saved Searches",
    str_ProductSelectionDropdown_PleaseSelectAProductToSearchIn: "Please select a product to search in",
    str_ProductSelectionDropdown_PleaseSelectACategoryToSearchIn: "Please select a category to search in",

    //KEYBOARD NAVIGATION
    str_Nav_SkipToDocument: "Skip to Document",
    str_Nav_SkipToTOC: "Skip to Table of Contents",
    str_Nav_SkipToPinboard: "Skip to Pinboard",
    str_Nav_MainContent: "Skip to Main Content",

    //HISTORY
    str_History_NoDocumentViews: "We did not find any document views. Click on the Research tab to navigate to our content!",
    str_History_NoRecentSearches: "We did not find any recent searches. Click on the search bar above to get started!",
    str_History_ViewedOn: "Viewed on",
    str_History_SearchedOn: "Searched on",
    str_History_SavedOn: "Saved on",

    //HOME - NEWS Panel
    str_Home_News_CommodityTax: "Your best way to keep up-to-date with the latest important developments in GST/HST, as well as provincial sales taxes, and customs and trade.",
    str_Home_News_TaxMatters: "TaxMatters@EY is a monthly bulletin that provides a summary of recent income tax news, case developments, publications and upcoming presentations.",
    str_Home_News_TaxNewsroom: "Contains the archives for Tax Bulletin, Tax News Emails and Learning with EY.",
    str_Home_News_TaxDevelopments: "Provides  the latest in income tax developments that may affect your quarterly or annual tax provision.",
    str_Home_News_GlobalDailyTaxUpdates: "Access to the Global Daily Tax Update site.",
    str_Home_News_News: "Stay up-to-date on all the latest tax developments with customized email alerts that bring you the critical information you need, when you need it — insights and commentary from EY tax professionals, as well as relevant releases from Canada Border Services Agency, Canada Revenue Agency, the Department of Finance, and the courts. Includes 90-day searchable archive.",

    str_Home_WhatsNew_EmptyState: "Nothing new for today",

    str_Learning_TechnicalLearning: "Learning",
    str_Learning_Administrative: "Administrative",
    str_Learning_GlobalCEPolicy: "Global CE Policy",
    str_Learning_GetCECredits: "How to get CE credits",
    str_Learning_SubmitCECredits: "How to submit SuccessFactors Learning requests",
    str_Learning_LearningWithEY: "Learning with EY",
    str_Learning_CPE: "CPE",
    str_Learning_CPE_Full: "Continuing Professional Education",
    str_Learning_TKF: "Tax Knowledge Forum",
    str_Learning_TTU: "Tax Technical Updates",
    str_Learning_TaxNavigatorTraining: "Tax Navigator training",

    str_Tools_ToolsNavigator: "Reference tools navigator (internal only)",
    str_Tools_TaxTechnologyTools: "GCR legacy tools library (internal only)",
    str_Tools_Calculators: "Calculators and rate cards",
    str_Tools_TaxRatesAndTools: "Tax rates and tools (research collection)",
    str_Tools_TaxRatesAtEY: "TaxRates@EY (PDF reference book)",

    str_Feedback_Title: "We'd love to hear from you.",
    str_Feedback_HowWasYourExperience: "How was your experience today?",
    str_Feedback_PleaseShareYourThoughts: "Please share your thoughts.",
    str_Feedback_ResponseRequired: "Check this box, if you want to hear back from us.",
    str_Feedback_Tab: "Feedback",
    str_Feedback_FormSubmitted: "We appreciate your valuable feedback.",
    str_Feedback_ThankYou: "Thank You",

    str_SwitchbackToOldUI: "Switchback to Old Look",
    str_SwitchbackToNewUI: "Switch to New Look",

    str_UnsupportedBrowser_Title: "Unsupported Browser",
    str_UnsupportedBrowser_Message: "We have detected that you are using Internet Explorer. Some functionality may not work as expected. For best viewing results, please use Chrome or Microsoft Edge.",

    str_SomethingWentWrong: "Something went wrong",
    str_SomethingWentWrongMessage: "You can browse our site or look for something specific",
    str_VisitOurHomepage: "Visit our homepage",

    str_CustomizeMySubscriptionList: "Customize my Subscription List",
    str_ShowCustomizedList: "Show Customized List",
    str_CustomizeMySubscriptionList_Description: "Select the products that you would like to see on the homepage and Tax Materials Dropdown",
    str_NoChanges: "No changes",
    str_changes: "change(s)",
    str_Apply: ["Apply", "apply"],

    //IGAA - Operational Fact Sheet
    str_BaselineModalErrorMessage: "Please select baselines.",
    str_QuestionModalErrorMessage: "Please select at least one question for each baseline.",
    str_CountryModalErrorMessage: "Please select countries.",
    str_AnswerTableHeader_Baselines: "Baselines",
    str_AnswerTableHeader_Questions: "Questions",
    str_AnswerTableHeader_Countries: "Countries",
    str_AnswerTableHeader_Answers: "Answers",
    //End of IGAA - Operational Fact Sheet

    //IGAA - Operational Fact Sheet Admin Page
    str_QuestionText: "Question Text",
    str_QuestionNumber: "Question Number",
    str_ShortQuestionText: "Short Question Text",
    str_LongQuestionText: "Long Question Text",
    str_AnswerText: "Answer Text",
    str_ShortQuestionTextPlaceholder: "Enter short question text",
    str_QuestionNumberPlaceholder: "Enter question number",
    str_CreateQuestionErrorMessage: "There was an error creating the question.",
    str_SaveQuestionErrorMessage: "There was an error saving the question.",
    str_PublishQuestionErrorMessage: "There was an error publishing the question.",
    str_DiscardQuestionErrorMessage: "There was an error discarding the question.",
    str_CreateAnswerErrorMessage: "There was an error creating answer.",
    str_SaveAnswerErrorMessage: "There was an error saving answer.",
    str_PublishAnswerErrorMessage: "There was an error publishing the answer.",
    str_DiscardAnswerErrorMessage: "There was an error discarding the answer.",
    str_DiscardDraft: "Discard Draft",
    str_PublishDraft: "Publish Draft",
    str_Edit: "Edit",
    str_LiveVersion: "Live Version",
    str_DraftLabel: "Draft",
    str_NewLabel: "New",
    str_NoQuestions: "No Question",
    str_NoPublishedQuestions: "No Published Question",
    //End of IGAA - Operational Fact Sheet Admin Page

    //CCRA - Internal Collection
    //is this where i should be putting this?
    str_InternalCollection_Text: `The following are the titles of the INTERNAL collections created, for Canada Revenue Agency (CRA) only, to work in concert with the external or public collections of the CRA Electronic Library. These collections are only available from the network version of the CRA Electronic Library. These are:
Appeals Reference Material (Information issued by the Appeals Branch, this infobase contains information such as Commodity Taxes, Court Decisions Bulletins, Communiqués, GST Appeals Directives.)
Compliance Programs Branch Reference Material (Information issued by the Compliance Programs Branch, formerly the Domestic Compliance Programs Branch / International, Large Business and Investigations Branch. This infobase contains information such as Communiqués, Directives, Memoranda, and various Operations Manuals, such as Audit Manuals, Corporations Tax Act Manual (Ontario), Criminal Investigations Manual, and Tax Avoidance Manual. Other information includes reference materials such as Sector Profiles.)
Excise and GST/HST Reference Material (Information issued by the Excise and GST/HST Rulings Directorate, this infobase contains information such as Direct Sellers Lists; Government Entities List; List of Barter Exchange Network Designations; HQ Unsevered Rulings and Interpretations Letters; Internal Memoranda to the field; etc.)
To access:
Select START > Programs > CRA Electronic Library (CTP-PTC) > CRA Electronic Library - EN
CRA Electronic Library will launch using the Folio Views application. A list of available collections will appear. From the top red navigation bar:

Click on the entry "Internal Collections"
Click on one of the three internal collections available
Example click on the second heading "Domestic Compliance Programs Branch Reference Material" to open this infobase
Please note that Folio provides users with various views which can be changed by clicking on one of the tabs found at the bottom of this window (ALL, Search, Browse, Document, Contents, Hit Lists, Objects).

Click on the Browse tab found at the bottom of the window or the Content tab.
You will see several headings on the left side of your screen, preceded by a plus (+) sign.
Click on the + sign beside the heading "Reference Materials" to view the sub-headings.
Double clicking on one of these headings will bring you to the text of this document.
For more information about this service consult the CRA Electronic Library – Electronic Reference Tool InfoZone page.`,

    // START OF CCRA - REGISTRATION FORM 
    str_CCRARegForm_LanguageLink: "Passer au français",
    str_CCRARegForm_Header: "Create my CRA Knotia account",
    str_CCRARegForm_Prename: "Prefix:",
    str_CCRARegForm_FirstName: "First name:",
    str_CCRARegForm_LastName: "Last name:",
    str_CCRARegForm_JobTitle: "Job title:",
    str_CCRARegForm_HQRegion: "HQ/Region:",
    str_CCRARegForm_Branch: "Branch:",
    str_CCRARegForm_PhoneNumber: "Phone number:",
    str_CCRARegForm_AreaCode: "(area code)",
    str_CCRARegForm_Number: "(number)",
    str_CCRARegForm_Extension: "(ext.)",
    str_CCRARegForm_EmailAddress: "Email:",
    str_CCRARegForm_EmailNote: "<p>To verify your email address, follow these steps:</p><p> Go to Outlook, select the Home tab, and click on the Address Book icon in the top right hand corner. Your email address will appear in the Address Book at the top of the drop down menu.</p><p> <strong>Reminder:</strong> Do not use any accents in your email address or password.</p>",
    str_CCRARegForm_Password: "Password:",
    str_CCRARegForm_ConfirmPassword: "Confirm password:",
    str_CCRARegForm_DefaultSearchProduct: "Default search product:",
    str_CCRARegForm_DefaultSearchProductDescription: "By default, this site will search within this product.",
    str_CCRARegForm_EnterProductTitle: "Enter a product title",
    str_CCRARegForm_NewsNotification: "Receive daily notification for:",
    str_CCRARegForm_GoBack: "Go back to Login page",
    str_CCRARegForm_Reset: "Clear form",
    str_CCRARegForm_Submit: "Create my account",

    str_CCRARegForm_ContactHelpDesk: "If you're still having trouble, please contact the Help Desk: Excise and GST Systems Helpdesk-LPRAB (CRA) zlpragsthdg@cra-arc.gc.ca",
    str_CCRARegForm_ReturnToLogin: "Return to Login",
    str_CCRARegForm_Error: "error: ",

    str_CCRARegForm_SuccessfulTitle: "Success!",
    str_CCRARegForm_Success_Message1: "Your account has been successfully created! An email will be sent shortly for you to verify your email address.",
    str_CCRARegForm_Success_Message2: "Didn't get the email? Please check your spam or junk folder.",

    str_CCRARegForm_EmailInUse_Title: "Email address already in use",
    str_CCRARegForm_EmailInUse_Message: "An account with the same email address already exists. Are you a returning user?",
    str_CCRARegForm_EmailInUse_ForgotMyPassword: "Forgot my password",

    str_CCRARegForm_ErrorTitle: "Something went wrong",
    str_CCRARegForm_ErrorMessage: "Sorry, an unexpected error occurred. Please try again later.",

    str_CCRARegFormError_LanguagePreference: "Please select a language",
    str_CCRARegFormError_FirstName: "Please enter first name",
    str_CCRARegFormError_LastName: "Please enter last name",
    str_CCRARegFormError_HQRegion: "Please select a HQ / REGION",
    str_CCRARegFormError_Branch: "Please select a Branch",
    str_CCRARegFormError_PhoneNumber: "Please enter numeric values only",
    str_CCRARegFormError_AreaCode: "Please enter area code",
    str_CCRARegFormError_Number: "Please enter phone number",
    str_CCRARegFormError_Extension: "Please enter extension",
    str_CCRARegFormError_EmailAddress: "Please enter email address",
    str_CCRARegFromError_EmailAccents: "Please do not use accents",
    str_CCRARegFormError_Password: "Please enter password",
    str_CCRARegFormError_ConfirmPassword: "Please re-enter your password",
    str_CCRARegFormError_ValuesMustMatch: "Password values must match",
    str_CCRARegFormError_DefaultSearchProduct: "Please select a Default Search Product",
    str_CCRARegFormError_Password_Complexity: "Password complexity does not match requirements:",
    str_CCRARegFormError_Password_MinLength: "Please enter a minumum of xx characters",
    str_CCRARegFormError_Password_UpperCase: "Please enter at least one UPPER case letter",
    str_CCRARegFormError_Password_LowerCase: "Please enter at least one lower case letter",
    str_CCRARegFormError_Password_Digit: "Please enter at least one digit",
    str_CCRARegFormError_Password_Symbol: "Please enter at least one symbol - # ? ! @ $ % ^ & * -",

    // END OF CCRA REGISTRATION FORM

    // START OF KNOTIA - REGISTRATION FORM 
    str_RegForm_LanguageLink: "Passer au français",
    str_RegForm_Header: "Create my Knotia account",
    str_RegForm_CompanyName: "Company name: ",
    str_RegForm_FirstName: "First name:",
    str_RegForm_LastName: "Last name:",
    str_RegForm_PhoneNumber: "Phone number:",
    str_RegForm_AreaCode: "(area code)",
    str_RegForm_Number: "(number)",
    str_RegForm_Extension: "(ext.)",
    str_RegForm_BusinessAddress: "Business address: ",
    str_RegForm_City: "City: ",
    str_RegForm_Province: "Province/State: ",
    str_RegForm_Country: "Country: ",
    str_RegForm_PostalCode: "Postal code: ",
    str_RegForm_CPACanadaNumber: "CPA Canada number: ",
    str_RegForm_EmailAddress: "Email:",
    str_RegForm_Password: "Password:",
    str_RegForm_ConfirmPassword: "Confirm password:",
    str_RegForm_GoBack: "Go back to Login page",
    str_RegForm_Reset: "Clear form",
    str_RegForm_Submit: "Create my account",

    str_RegForm_ContactHelpDesk: "If you're still having trouble, please contact the Help Desk: support@knotia.ca",
    str_RegForm_ReturnToLogin: "Return to Login",
    str_RegForm_Error: "error: ",

    str_RegForm_SuccessfulTitle: "Success!",
    str_RegForm_Success_Message1: "Your account has been successfully created! An email will be sent shortly for you to verify your email address.",
    str_RegForm_Success_Message2: "Didn't get the email? Please check your spam or junk folder.",

    str_RegForm_EmailInUse_Title: "Email address already in use",
    str_RegForm_EmailInUse_Message: "An account with the same email address already exists. Are you a returning user?",
    str_RegForm_EmailInUse_ForgotMyPassword: "Forgot my password",

    str_RegForm_ErrorTitle: "Something went wrong",
    str_RegForm_ErrorMessage: "Sorry, an unexpected error occurred. Please try again later.",

    str_RegFormError_CompanyName: "Please enter company name",
    str_RegFormError_FirstName: "Please enter first name",
    str_RegFormError_LastName: "Please enter last name",
    str_RegFormError_PhoneNumber: "Please enter numeric values only",
    str_RegFormError_AreaCode: "Please enter area code",
    str_RegFormError_Number: "Please enter phone number",
    str_RegFormError_Extension: "Please enter extension",
    str_RegFormError_EmailAddress: "Please enter email address",
    str_RegFormError_Password: "Please enter password",
    str_RegFormError_ConfirmPassword: "Please re-enter your password",
    str_RegFormError_ValuesMustMatch: "Password values must match",
    str_RegFormError_Password_Complexity: "Password complexity does not match requirements:",
    str_RegFormError_Password_MinLength: "Please enter a minumum of xx characters",
    str_RegFormError_Password_UpperCase: "Please enter at least one UPPER case letter",
    str_RegFormError_Password_LowerCase: "Please enter at least one lower case letter",
    str_RegFormError_Password_Digit: "Please enter at least one digit",
    str_RegFormError_Password_Symbol: "Please enter at least one symbol - # ? ! @ $ % ^ & * -",
    str_RegFormError_Country: "Please select a Country",
    str_RegFormError_Province: "Please select a Province/State",
    str_RegFormError_BusinessAddress: "Please enter business address",
    str_RegFormError_City: "Please enter city",
    str_RegFormError_PostalCode: "Please enter postal code",
    str_RegFormError_PostalCode_CAN: "Please enter a Canadian postal code",
    str_RegFormError_PostalCode_US: "Please enter a US postal code",
    str_RegFormError_CPANumber: "Please enter a CPA Canada customer number.",
    //END OF KNOTIA REGISTRATION FORM

    str_ForgotPassword_ForgotYourPassword: "Forgot your password?",
    str_ForgotPassword_EnterEmailAddress: "Please enter your email address to begin the password reset process.",
    str_ForgotPassword_ContactHelpDesk: "Contact help desk",
    str_ForgotPassword_Continue: "Continue",
    str_ForgotPassword_PasswordEmailSent_Title: "Password reset email sent!",
    str_ForgotPassword_PasswordEmailSent_Message: "A password reset email has been sent. Please check your inbox to reset your CRA Knotia.",
    str_ForgotPassword_ReturnToLogin: "Return to Login",
    str_ForgotPassword_ResendEmail: "Re-send password reset email",
    str_ForgotPassword_ResendEmail_Message: "Your password reset link has expired. Please enter your email address to request a new password reset link.",
    str_ForgotPassword_RequestResendEmail: "Request a new password reset link",

    str_ChangePassword_PasswordReset: "Reset your password",
    str_ChangePassword_EnterNewPassword: "Enter a new password for your CRA Knotia Account.",
    str_ChangePassword_OldPassword: "Old password:",
    str_ChangePassword_NewPassword: "New password:",
    str_ChangePassword_ConfirmNewPassword: "Confirm new password:",
    str_ChangePassword_PasswordChanged_Title: "Password changed",
    str_ChangePassword_PasswordChanged_Message: "You have successfully changed your password.",
    str_ChangePassword_ChangePassword: "Change my password",
    str_ChangePassword_Login: "Login to my account",
    str_ContactHelpDesk_Message: "If you're having trouble, please contact the Help Desk:",

    str_VerifyEmail_Title: "Email address verified!",
    str_VerifyEmail_Message: "Thank you for verifying your email address.",
    str_VerifyEmail_ResendTitle: "Re-send email verification link",
    str_VerifyEmail_ResendMessage: "Your email verification link has expired.Please enter your email address to request a new email verification link.",
    str_VerifyEmail_RequestNewLink: "Request a new verification link",
    str_VerifyEmail_SentTitle: "Email verification link sent",
    str_VerifyEmail_SentMessage: "A new email verification link has been sent. Please check your inbox to verify your email address.",
    str_VerifyEmail_ReturnToLogin: "Return to Login",
    str_VerifyEmail_ContactHelpDesk: "Contact help desk",

    str_Login_Message: "Do not use any accents in your email address. Use a unique password that is different from your RCNET or CRA passwords.",
    str_Login_EmailAdress: "Email address:",
    str_Login_CreateProfile: "Create a profile",
    str_Login_InvalidMessage: "Invalid email address and password. Please try again.",
    str_Login_UnverifiedEmail: "Unverifed email address",
    str_Login_UnverifiedEmailMessage: "Your email address has not yet been verified. Please check your inbox for an email verification link that was recently sent to you.",
    str_Login_ResendVerifyLink: "Request a new email verification link",
    str_Login_RememberMyEmail: "Remember my email",

    str_UserProfile_InAdminMode: "(in admin mode)",
    str_UserProfile_UseWorkEmail: "Please enter work email address",
    str_UserProfile_InvalidEmail: "Invalid email address",
    str_UserProfile_NotProvided: "(not provided)",
    str_UserProfile_Edit: "Edit",
    str_UserProfile_DeleteUser: "Delete this user",
    str_UserProfile_DeleteUserConfirmation: "Are you sure you want to delete ~targetUser~? This cannot be undone.",
    str_UserProfile_ResetPassword: "Reset user's password",
    str_UserProfile_ResetPasswordConfirmation: "Are you sure you want to reset the password for ~targetUser~?",
    str_UserProfile_ConfirmActionModalTitle: "Confirm action",
    str_UserProfile_MoveUserToAnotherCompany: "Move user to another company",

    str_NewUser_CreateNewUser: "Create a new user",

    str_ProfilePreferences_Preferences: "Preferences",
    str_ProfilePreferences_GeneralPreferences: "General",
    str_ProfilePreferences_SearchPreferences: "Search preferences",
    str_ProfilePreferences_EmailNewsPreferences: "Email news preferences",
    // END OF CCRA - REGISTRATION FORM

    // START OF MNP KNOTIA 
    str_ForgotPassword_PasswordEmailSent_Message_MNP: "A password reset email has been sent. Please check your inbox to reset your MNP Knotia.",

    str_MNPProfile_FirstName: "First name:",
    str_MNPProfile_LastName: "Last name:",
    str_MNPProfile_JobTitle: "Job title:",
    str_MNPProfile_Email: "Email:",
    str_MNPProfile_PhoneNumber: "Phone number:",
    str_MNPProfile_NewsNotification: "Receive daily notification for:",

    str_MNPProfileError_LanguagePreference: "Please select a language",
    str_MNPProfileError_FirstName: "Please enter first name",
    str_MNPProfileError_LastName: "Please enter last name",
    str_MNPProfileError_PhoneNumber: "Please enter numeric values only",
    str_MNPProfileError_Number: "Please enter phone number",
    str_MNPProfileError_EmailAddress: "Please enter email address",
    str_MNPProfileError_EmailAccents: "Please do not use accents",
    str_MNPProfileError_DefaultSearchProduct: "Please select a Default Search Product",
    str_ChangePassword_EnterNewPassword_MNP: "Enter a new password for your MNP Knotia Account.",
    // END OF MNP KNOTIA

    //START OF CPA KNOTIA
    str_KnotiaHomePage_NoSubscriptionsNote: "No subscriptions found. Visit CPA store to purchase a subscription.",
    str_KnotiaHomePage_GoToCPAStore: "Go to CPA Store",

    str_KnotiaAgreement_Agree: "I Agree",
    str_KnotiaAgreement_Disagree: "I Do Not Agree",
    str_KnotiaAgreement_DisagreeAlertMessage: "To gain access to knotia.ca, you must accept the license agreement.",

    str_Knotia_Footer_HelpDeskHours: "Help desk: Mon-Fri, 9am-5pm ET",
    str_Knotia_Footer_HelpDeskContactInfo: "1-866-256-6842",
    str_Knotia_Footer_Copyright: "2001-~yearEnd~, EYEP and/or E&Y LLP and/or CPA Canada. All rights reserved.",

    str_KnotiaProfile_CPACanadaNumber: "CPA Canada number",
    str_KnotiaProfile_CPAMemberType: "Member type",
    str_KnotiaProfile_CPAMemberStatus: "Member status",
    str_KnotiaProfile_BusinessAddress: "Business address",
    str_KnotiaProfile_City: "City",
    str_KnotiaProfile_PostalCode: "Postal/zip code",
    str_KnotiaProfile_Note: "The following information comprises your CPA Canada profile, which allows you to securely navigate across the following sites without having to maintain separate profile and login credentials at each site:<ul><li>CPAstore</li><li>knotia.ca</li></ul>",
    str_KnotiaProfile_ViewDetails: "view details",
    str_KnotiaProfile_AddressDetail: "Address Detail",
    str_KnotiaProfile_NoSelectedAddress: "You haven't chosen an address.",
    str_KnotiaProfile_CPACanadaNumberAlreadyExisted: "CPA Canada number is already associated with a profile.",
    str_KnotiaProfile_BillingInformation: "Billing information",
    str_KnotiaProfile_ShippingInformation: "Shipping information",
    str_KnotiaProfile_OtherInformation: "Other information",
    str_KnotiaProfile_AddANewAddress: "Add a new address",
    str_KnotiaProfile_Address: "Address",
    str_KnotiaProfile_DeleteAddress: "Delete Address",
    str_KnotiaProfile_DeleteAddressConfirmMessage: "Are you sure you want to delete this address?",

    str_KnotiaNewUserForm_Subscriptions: "Subscriptions",
    str_KnotiaNewUserForm_Subscriptions_GiveSubscriptions: "Upon creating this profile, give the user access to all company subscriptions (you can manually remove access afterwards).",
    str_KnotiaNewUserForm_Subscriptions_DoNotGiveSubscriptions: "Upon creating this profile, do not give the user access to any subscriptions (you can manually give access afterwards).",

    str_KnotiaProfileError_Company: "Please enter the company name",
    str_KnotiaProfileError_CountryID: "Please select the country",
    str_KnotiaProfileError_BusinessAddress: "Please enter the business address",
    str_KnotiaProfileError_Address: "Please enter the address",
    str_KnotiaProfileError_PostalCode: "Please enter the postal code",
    str_KnotiaProfileError_City: "Please enter the city",
    str_KnotiaProfileError_ProvinceID: "Please select the province",
    str_KnotiaProfileError_AddressSelection: "Please select the address",
    str_KnotiaCollectionServices_Test_Products_Title: "Test Products",
    str_KnotiaCollectionServices_Schedule_Date: "Schedule to go live:",
    str_KnotiaCollectionServices_Create_Ibox: "Create iBox",
    str_KnotiaCollectionServices_Publish: "Publish",
    str_KnotiaCollectionServices_Select_All_Books: "Select all books",
    str_KnotiaCollectionServices_Test: "Test",
    str_KnotiaCollectionServices_Index: "Index",
    str_KnotiaCollectionServices_Delete_Book: "Delete Book",
    str_KnotiaCollectionServices_Book_ID_Label: "Book ID:",
    str_KnotiaCollectionServices_Book: "Book(s)",
    str_KnotiaCollectionServices_Publish_Note: "Note:",
    str_KnotiaCollectionServices_Publish_Note_Info: "Setting this date to today or earlier will immediately make this book live, but may wreak havoc with the products containing it.",
    str_KnotiaCollectionServices_Publish_Following_Book: "The following book(s) will be made live:",
    str_KnotiaCollectionServices_Publish_Continue_Blurb: "Are you sure you want to continue? Making books live cannot be reversed.",






    //END OF CPA KNOTIA

    //USERS SEARCH
    str_UsersSearch_Heading_AllUsers: "Users Search (All Users)",
    str_UsersSearch_Heading_UsersAtCompany: "Users Search (Users at <companyName>)",

    str_UsersSearch_ExpandSearchForm: "Expand search form",
    str_UsersSearch_CollapseSearchForm: "Collapse search form",

    str_UsersSearch_SearchField_CPACanadaNumber: "CPA Canada number",
    str_UsersSearch_SearchField_FirstName: "First name",
    str_UsersSearch_SearchField_LastName: "Last name",
    str_UsersSearch_SearchField_Email: "Email",
    str_UsersSearch_SearchField_PhoneNumber: "Phone number",
    str_UsersSearch_SearchField_CompanyName: "Company name",

    str_UsersSearch_SearchResults: "Search Results",

    str_UsersSearch_Action_MoveUsersToAnotherCompany: "Move users to another company",
    str_UsersSearch_Action_GetCSV: "Get CSV",
    str_UsersSearch_CreateANewUser: "Create a new user",

    str_UsersSearch_TableHeader_CompanyName: "Company Name",
    str_UsersSearch_TableHeader_UserName: "User Name",
    str_UsersSearch_TableHeader_EmailAddress: "Email Address",
    str_UsersSearch_TableHeader_LastLoginTime: "Last Login Time",
    str_UsersSearch_TableHeader_CPACanadaNumber: "CPA Canada Number",
    str_UsersSearch_TableHeader_MyEYCompanyName: "MY EY Company Name",
    str_UsersSearch_TableHeader_Branch: "Branch",
    str_UsersSearch_TableHeader_LoggedInLastNinetyDays: "Logged-in in the last 90 days",

    str_UsersSearch_ResultCount: "Display <startIndex> to <endIndex> users of <totalNumber>",
    //END OF USERS SEARCH

    //LEFT NAVIGATION
    str_LeftNavigation_PreviousDay: "Previous Day",
    str_LeftNavigation_NextDay: "Next Day",
    str_LeftNavigation_DateRange: "Date Range",
    //END OF LEFT NAVIGATION

    //COMMING SOON MODAL
    str_CommingSoon: "Comming Soon",
    //END OF COMMING SOON MODAL

    //TNU/GTNU MANAGE METADATA ADMIN MODULE
    str_ManageMetadata_Metadata: "Alert Metadata",
    str_ManageMetadata_Taxonomy: "Taxonomy Metadata",
    str_ManageMetadata_ChooseField: "Please choose a metadata type",
    str_ManageMetadata_MetadataFieldType_LargeText: "Large text",
    str_ManageMetadata_MetadataFieldType_Checkbox: "Checkbox",
    str_ManageMetadata_MetadataFieldType_Dropdown: "Dropdown",
    str_ManageMetadata_MetadataFieldType_MultiSelectDropdown: "Multiple select dropdown",
    str_ManageMetadata_MetadataFieldType_CheckboxConditionalOnCheckbox: "Checkbox conditional on checkbox",
    str_ManageMetadata_AddMetadataField: "Add a new metadata field",
    str_ManageMetadata_EditMetadataField: "Edit an existing metadata field",
    str_ManageMetadata_LargeTextMetadataField: "Large Text Metadata Field",
    str_ManageMetadata_CheckboxMetadataField: "Checkbox Metadata Field",
    str_ManageMetadata_DropdownMetadataField: "Dropdown Metadata Field",
    str_ManageMetadata_MultiSelectDropdownMetadataField: "Multiple Select Dropdown Metadata Field",
    str_ManageMetadata_CheckboxConditionalOnCheckboxMetadataField: "Checkbox Conditional on Checkbox Metadata Field",
    str_ManageMetadata_MetadataField_InputFieldLabel_AppliesTo: "Applies to",
    str_ManageMetadata_MetadataField_InputFieldLabel_Category: "Category",
    str_ManageMetadata_MetadataField_InputFieldLabel_ContentType: "Content type(s)",
    str_ManageMetadata_MetadataField_InputFieldLabel_Name: "Metadata field name",
    str_ManageMetadata_MetadataField_InputFieldLabel_Required: "Required field",
    str_ManageMetadata_MetadataField_InputFieldLabel_DefaultOption: "Default option",
    str_ManageMetadata_MetadataField_InputFieldLabel_DefaultTextValue: "Default text value",
    str_ManageMetadata_MetadataField_InputFieldLabel_Options: "Options",
    str_ManageMetadata_MetadataField_InputFieldLabel_ConditionalOnCheckbox: "Conditional on checkbox",
    str_ManageMetadata_MetadataField_InputField_Category: "applied category",
    str_ManageMetadata_MetadataField_InputField_Name: "metadata field name",
    str_ManageMetadata_MetadataField_InputField_ContentType: "content type",
    str_ManageMetadata_MetadataField_InputField_Options: "options",
    str_ManageMetadata_MetadataField_InputField_Checkbox: "checkbox",
    str_ManageMetadata_FilterContentType: "Filter content type",
    str_ManageMetadata_FilterCheckbox: "Filter checkbox",
    str_ManageMetadata_PleaseSelectCheckbox: "Please select checkbox",
    str_ManageMetadata_SetAsDefaultValue: "Set as default value",
    str_ManageMetadata_AddOption: "Add an option",
    str_ManageMetadata_DeleteOption: "Delete option",
    str_ManageMetadata_DuplicateOption: "Duplicate option value",
    str_ManageMetadata_InvalidOption: "Invalid option value",
    str_ManageMetadata_Option: "Option",
    str_ManageMetadata_DeleteOptionAlertMessage: "Are you sure you want to remove this option?",
    str_ManageMetadata_AddOptionErrorMessage: "Please fill in metadata field name before adding a new option",
    str_AdminPage: "Admin Page",
    str_ManageMetadata_AddCategoryContentType: "Add category & content type(s)",
    str_ManageMetadata_PleaseSelectCategory: "Please select category",
    str_ManageMetadata_PleaseSelectContentType: "Please select content type(s)",
    str_ManageMetadata_DeleteAppliesToOptionAlertMessage: "Are you sure you want to remove this category & content type(s) selection?",
    str_ManageMetadata_AddFilter: "Add a new taxonomy",
    str_ManageMetadata_BackToPreviousFilterLevel: "Back to <filterName>",
    str_ManageMetadata_AddANewFilter: "Add a New Taxonomy",
    str_ManageMetadata_EditFilter: "Edit Taxonomy",
    str_ManageMetadata_FilterStep_FilterDetails: "Taxonomy Details",
    str_ManageMetadata_FilterStep_FilterSortGroup: "Taxonomy Sort Group",
    str_ManageMetadata_FilterStep_EmailSettings: "Email Settings",
    str_ManageMetadata_FilterStep_EmailSortGroup: "Email Sort Group",
    str_ManageMetadata_FilterField_FilterName: "Taxonomy Name",
    str_ManageMetadata_FilterField_FilterType: "Taxonomy Type",
    str_ManageMetadata_FilterField_SortGroup: "Sort Group",
    str_ManageMetadata_FilterField_DefaultEmailFormat: "Default email format",
    str_ManageMetadata_FilterField_UseHeadingInEmailField: "Use \"Heading In Email\" field",
    str_ManageMetadata_FilterField_IsSpecialAlert: "Is special alert",
    str_ManageMetadata_FilterField_IsAlwaysFullTextAlert: "Is always full-text alert",
    str_ManageMetadata_FilterField_HideOptOutFromUser: "Hide opt-out from user",
    str_ManageMetadata_FilterField_SendEvenIfFrequencyIsNever: "Send even if frequency is never",
    str_ManageMetadata_FilterField_WhenEnabledEnableByDefault: "When enable, enable by default",
    str_ManageMetadata_FilterField_InputField_Name: "taxonomy name",
    //END OF TNU/GTNU MANAGE METADATA ADMIN MODULE

    str_TaxNav_Product_IBFD: "IBFD tax research platform (You must be connected to the EY network)",
    str_TaxNav_Product_Atlas: "EY Atlas (formerly GAAIT)"
};
;
// required to set up page
function callStateManagerFunctionIfExists(fn) {
	if (document.k5) {
		if (document.k5[fn]) {
			var returnVal = document.k5[fn].apply(document.k5, [].slice.call(arguments, 1));
			if (typeof returnVal != "undefined") {
				return returnVal;
			}
		}
	}

	return null;
}

function callKNextStateManagerFunctionIfExists(BLLName, FunctionName) {

    if (!Globals.Utilities.isUndefinedOrNull(window.currentPage) && !Globals.Utilities.isUndefinedOrNull(window.currentPage[BLLName]) && typeof window.currentPage[BLLName][FunctionName] === "function") {
        currentPage[BLLName][FunctionName].apply(null, [].slice.call(arguments, 2));
    }
}

function doesKNextStateManagerFunctionExist(BLLName, FunctionName) {
    if (!Globals.Utilities.isUndefinedOrNull(window.currentPage) && !Globals.Utilities.isUndefinedOrNull(window.currentPage[BLLName]) && typeof window.currentPage[BLLName][FunctionName] === "function") {
        return true;
    }
    return false;
}

var KnotiaKnowledge5 = {};
var glb_StateManager_RequestTimeout = 495000;
// end required

KnotiaKnowledge5.StateManager = function () {
	// when the document body is set to the wait icon, a failure timer is set; when it is set to anything else, the timer needs to be cancelled
	this.displayProcessingTimer = 0;
	if (navigator.userAgent.indexOf('Safari') !== -1 || navigator.userAgent.indexOf('iPhone') !== -1) {
		this.documentContextHeight = 19;
	}
	else {
		this.documentContextHeight = 22;
	}
};

KnotiaKnowledge5.StateManager.prototype.updateDocumentBodyToWait = function () {
	if (this.searchManager && this.searchManager.isDailyViewOfNews()) {
		return;
	}

	this.cancelProcessingTimer();
	this.displayProcessingTimer = window.setTimeout("document.k5.displayProcessing()", 1500); // wait 1.5 second, then show spinning ball
};

KnotiaKnowledge5.StateManager.prototype.displayProcessing = function () {
	this.updateDocumentBody("<table cellpadding=0 cellspacing=0 border=0 align=center><tr><td align=center><p><img src=\"Images/WaitAnimated.gif\"></p></td></tr></table>");
	//this.displayProcessingTimer = window.setTimeout("document.k5.displayProcessingFailed()", 45500); // already waited 1.5 second, wait 45.5 more seconds, then show failure message
    this.displayProcessingTimer = window.setTimeout("document.k5.displayProcessingFailed()", glb_StateManager_RequestTimeout); 
};

KnotiaKnowledge5.StateManager.prototype.displayProcessingFailed = function () {
	this.updateDocumentBody("<table cellpadding=0 cellspacing=0 border=0 align=center><tr><td align=center><p><img src=\"Images/WaitAnimated.gif\"></p></td></tr><tr><td>&nbsp;</td></tr><tr><td><fieldset>" + GetString("str_Error_WaitTimedOut") + "</fieldset></td></tr></table>");
};

KnotiaKnowledge5.StateManager.prototype.cancelProcessingTimer = function (bForce) {
	if (this.displayProcessingTimer > 0) {
		window.clearTimeout(this.displayProcessingTimer);
		this.displayProcessingTimer = 0;
	}
	else if (bForce) {
		// Matt Stinson: how do I do this?
		// window.history.go(-1);
	}
};

KnotiaKnowledge5.StateManager.prototype.initializeDocumentBody = function () {

    var nodeID = Globals.Utilities.getURLQueryParameter("NodeID");

    //generally all the other initial info is set on the aspx page
    //
    //look into if this is the best spot to place this... we can't use the aspx page because the communication happens through cookies...unless 
    //the aspx page reads the cookie and sets document.<object> on the aspx page... but that seems unecessary
    let initialSearchInfoState = null;

    if (!Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) && glb_EnableKnotiaNext === 1 && !Globals.Utilities.isUndefinedOrNull(window.currentPage)) {
        initialSearchInfoState = currentPage.SiteDAL.getInitialSearchInformationState();
    }

	if (document.initWithBookDocumentID != null) {
		// this is before checking ShowCMTToolbar, because we want to jump into the CMT in the document we are in (if applicable)
		var bookIDAndDocumentID = document.initWithBookDocumentID.split("_");
		this.documentManager.loadDocumentByBookDocumentID(this.productID, bookIDAndDocumentID[0], bookIDAndDocumentID[1]);
	}
	else if (document.initWithFetchID != null) {
		// this is before checking ShowCMTToolbar, so that links to this document still work
		this.documentManager.loadDocumentByGotoString(this.productID, document.initWithFetchID);
	}
	else if (Globals.Cookies.readCookie("ShowCMTToolbar") && nodeID.length == 0 && this.collectionType == KnotiaKnowledge5.CollectionType.Collection) {
		document.CMT.ShowWorkbench();
	}
	else if (document.initWithSearchID != null) {
		this.executeNewSearch(KnotiaKnowledge5.SearchType.NotSpecified, false, "SavedSearchID=" + document.initWithSearchID.toString());
		this.searchManager.setSearchID(document.initWithSearchID);
	}
	else if (document.initWithSearchType != null) {
		this.executeNewSearch(document.initWithSearchType, false, document.initWithSearchParameters.split("|"));
    }
    //not sure where we should put this in the order but keeping it here for now
    else if (!Globals.Utilities.isUndefinedOrNull(initialSearchInfoState) && initialSearchInfoState.executeSearch) {

        callKNextStateManagerFunctionIfExists('BLL', 'onInitialPageLoadExecuteSearch');

        //let searchProductIDs = initialSearchInfoState.searchProductIDs;
        //let searchProductIDsLength = searchProductIDs.length;

        ////page should also be search all
        //if (searchProductIDsLength > 1) {
        //    //check the nodes of the products to search in 
        //    for (let i = 0; i < searchProductIDsLength; i++) {
        //        //multiply by 10000000000 ... need to see how this is set so it isn't a magic number
        //        let productID = searchProductIDs[i] * 10000000000;
        //        document.k5tree.checkNode(productID);
        //    }
        //}

        ////add callback to redux that should put the search query in the searchbar and clear the cookies 
        //callKNextStateManagerFunctionIfExists("SiteBLL", "clearInitialSearchInfo");

        ////add search query to searchbar
        //callKNextStateManagerFunctionIfExists("PageHeaderBLL", "onSearchBarTextChange", initialSearchInfoState.searchQuery);

        ////execute search, doing the same thing clicking on search
        ////callStateManagerFunctionIfExists("executeNewSearch", KnotiaKnowledge5.SearchType.NotSpecified, true, "Keywords=" + $("#txtSearchBarKeywords").val());
        //this.executeNewSearch(KnotiaKnowledge5.SearchType.NotSpecified, true, "Keywords=" + initialSearchInfoState.searchQuery);

    }
	else if (document.initWithHotTopicsSubPage != null) {
		this.landingPageManager.getLandingPageSubPage(document.initWithHotTopicsSubPage);
	}
	else if (document.initWithSearchTemplate != null) {
		this.searchManager.showSearchTemplate(this.productID, document.initWithSearchTemplate, true, document.initWithSearchParameters);
	}
	else if (document.initWithAlertID != null) {
		if (document.initAlertIDAsDocument) {
			// drafts preview, don't load as part of search
			//if (document.initWithLanguageID == null) {
			if (Globals.Utilities.isUndefinedOrNull(document.initWithLanguageID)) {
				document.initWithLanguageID = 1;
			}
			this.documentManager.loadAlertByID(document.initWithAlertID, document.initWithLanguageID);
		}
		else {
			this.executeNewSearch(KnotiaKnowledge5.SearchType.ChooseAlertLoadNews, false, "AlertID=" + document.initWithAlertID);
		}
	}
	else if (document.initWithPrintAnnotations != null) {
		this.annotationsBoxManager.showPrintAnnotations(document.initWithPrintAnnotations);
	}
	else if (document.initWithNodeID != null) {
		this.documentManager.loadDocumentByNodeID(this.productID, document.initWithNodeID);
	}
	else if (document.initWithBriefcaseNodeID != null) {
		this.documentManager.loadDocumentFromBriefcase(document.initWithBriefcaseNodeID);
	}
    else if (this.landingPageManager) {

        //new UX
        if (!Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) && glb_EnableKnotiaNext === 1 && !Globals.Utilities.isUndefinedOrNull(window.currentPage) && doesKNextStateManagerFunctionExist('BLL', 'initialPageLoadDefaultSearch')) {
            callKNextStateManagerFunctionIfExists('BLL', 'initialPageLoadDefaultSearch');
        } else {
            this.landingPageManager.getPageBodyDefaultPage();
        }

	}
};

KnotiaKnowledge5.StateManager.prototype.updateDocumentBody = function (documentHtmlContent, contextHtmlContent) {
    this.cancelProcessingTimer();
    
	$(".tooltip").hide();

	$("#elAttachmentsWithHits").remove();

	var divBodyContext = this.documentManager.contextControlJqueryObject;
	if (contextHtmlContent == null || contextHtmlContent.toString().length == 0) {
		divBodyContext.height(0);
		divBodyContext.hide();
		divBodyContext.empty();
	}
	else {
		divBodyContext.height(this.documentContextHeight);
		divBodyContext.show();
		divBodyContext.html(contextHtmlContent);
	}

	var divDocumentBody = $("#divDocumentBody");

	if (!this.isInDocumentOnlyView) {
		if ($("#divTOC").css("display") != "none") { // if we hid the TOC (small screen for news), don't resize
			var documentBodyHeight = $("#divTOC").height();
			divDocumentBody.height(documentBodyHeight - this.documentContextHeight);
		}
	}

	divDocumentBody.css("padding", "10px");
	$("#divCopyright").show();

	var divBodyContent = $("#divBodyContent");
	var divNewDocumentBody = document.createElement("div");
	divNewDocumentBody.innerHTML = documentHtmlContent;
	divBodyContent.empty();
	divBodyContent.off();
    divBodyContent.append(divNewDocumentBody);

    //new UX
    if (!Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) && glb_EnableKnotiaNext === 1 && !Globals.Utilities.isUndefinedOrNull(window.currentPage)) {
        callKNextStateManagerFunctionIfExists('BLL', 'onDocumentLoaded');
	}

	//csp
	//this is here because the content from ES can be CSP clean (no inline styles and events) BUT a site might not have CSP enabled. I.e. for TNU/GTNU they share the same book
	//but we are gradually enabling CSP on sites
	//currently doing it for GTNU which doesnt have React/Redux but ES is enabled
	if (document.kNextPlatform != null && document.kNextPlatform.siteID == 22) {
		//check if inline onmouseup event exists
		var mouseUpExists = $("#divBodyContent div[onmouseup]").length > 0;

		if (!mouseUpExists) {
			$("#divBodyContent div.documentParagraph").on("mousedown", function () {
				MDP(this);
			});
			$("#divBodyContent div.documentParagraph").on("mouseup", function () {
				MUP(this);
			});
		}

		Globals.Utilities.generateInlineStylesFromDataStyles();
    }



	//this is to spawn off the main thread so that it can do so right away and not block the code from executing.
	setTimeout(function () { callStateManagerFunctionIfExists("scrollToTop"); }, 0);

	// Is there a better way to do this?  When statemanager updates the document, treeview needs to unmark the currently marked document
	if (this.treeviewManager) {
		this.treeviewManager.unMarkMarkedDocument();
	}


	$("#divDocumentBody").css("height", $("#divTOC").height() - $("#divDocumentBodyContext").height() + "px"); // this is added to make sure that the height of the documentBobdy is scrollable
    GenerateExpandableSections();

	callStateManagerFunctionIfExists("removeGutterForUserNotes");
};

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name: KnotiaKnowledge5.StateManager.prototype.scrollToTop | callStateManagerFunctionIfExists ("scrollToTop")
// Desc: This method will scroll to the top and left of the document if the divBodyContent exists. This method exists
//		 so that it can be called asynchronously in a setTimeout
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
KnotiaKnowledge5.StateManager.prototype.scrollToTop = function () {

	var divDocumentBody = $("#divBodyContent");

	if (divDocumentBody.length > 0) {
		divDocumentBody.scrollTop(0).scrollLeft(0);
	}

};

KnotiaKnowledge5.StateManager.prototype.removeAllChildNodes = function (objElement) {
	if (Globals.Utilities.isUndefinedOrNull(objElement)) {
		return;
	}

	$(objElement).empty(); //this method is kept in case it is called anywhere else.
};

KnotiaKnowledge5.StateManager.prototype.nullIfNotDefined = function (object) {
	if (object) {
		return object;
	}
	else {
		return null;
	}
};

KnotiaKnowledge5.StateManager.prototype.getDynamicStylesheet = function (cssName) {
	var link = $(".js-link-css" + cssName);
	return link[0];
};

/* ************** */
/* override these */
/* ************** */

// override this to return false if it is not a document only view
KnotiaKnowledge5.StateManager.prototype.isInDocumentOnlyView = function () {
	return true;
};

// initialize page
KnotiaKnowledge5.StateManager.prototype.initializeCollection = function () {
};
;
/*globals KnotiaUserControls*/
// inherit StateManager
KnotiaKnowledge5.StateManagerOnlineViewerOnly = function (collectionType, productID, siteStyle) {
	this.collectionType = collectionType;
	this.productID = productID;
	this.siteStyle = siteStyle;

	// when the document body is set to the wait icon, a failure timer is set; when it is set to anything else, the timer needs to be cancelled
	this.displayProcessingTimer = 0;
};
KnotiaKnowledge5.StateManagerOnlineViewerOnly.prototype = new KnotiaKnowledge5.StateManager();
KnotiaKnowledge5.StateManagerOnlineViewerOnly.prototype.constructor = KnotiaKnowledge5.StateManagerOnlineViewerOnly;

KnotiaKnowledge5.StateManagerOnlineViewerOnly.prototype.initializeStateManager = function (pathToHistoryCachePage, includeSessionTrackerJS, forceLargeStylesheet) {
	this.navigationManager = new KnotiaKnowledge5.NavigationManager(this.documentContextHeight);
	this.navigationManager.initializeContentDivs(this.siteStyle);
	this.navigationManager.initNavigation(this.siteStyle, this.productID, pathToHistoryCachePage, includeSessionTrackerJS, forceLargeStylesheet);

	if (this.collectionType == KnotiaKnowledge5.CollectionType.SavedSearches) {
		this.landingPageManager = new KnotiaKnowledge5.LandingPageManagerSavedSearches($("#divDocumentBody"));
	}
	else if (this.collectionType == KnotiaKnowledge5.CollectionType.MyNotes) {
		this.landingPageManager = new KnotiaKnowledge5.LandingPageManagerMyNotes($("#divDocumentBody"));
		this.briefcaseManager = new KnotiaKnowledge5.BriefcaseManager();
	}

	this.documentManager = new KnotiaKnowledge5.DocumentManager($("#divDocumentBody"), $("#divDocumentBodyContext"), this.collectionType);

	$("#divTOC").hide();
	$("#divSplitterBar").hide();

	if (typeof (KnotiaUserControls) != "undefined") {

	    if (typeof (KnotiaUserControls.Toolbar) != "undefined") {
	        this.toolbar = new KnotiaUserControls.Toolbar();
	    }

	    if (typeof (KnotiaUserControls.SearchBar) != "undefined") {
	        this.searchbar = new KnotiaUserControls.SearchBar();
	    }

	}

    
};

KnotiaKnowledge5.StateManagerOnlineViewerOnly.prototype.initializeCollection = function () {
	this.initializeDocumentBody();
};

KnotiaKnowledge5.StateManagerOnlineViewerOnly.prototype.setTsiClass = function (tsiElement, isMouseOver) {
	this.toolbar.setTsiClass(tsiElement, isMouseOver);
};

/* unique to ViewerOnly */

KnotiaKnowledge5.StateManagerOnlineViewerOnly.prototype.emailNewsDocument = function (documentID, documentTitle) {
	var emailDocumentManager = new KnotiaKnowledge5.EmailDocumentManager();
	emailDocumentManager.showEmailDocumentForm(documentID, documentTitle, null);
};

/*

  * used for downloading news documents*/
KnotiaKnowledge5.StateManagerOnlineViewerOnly.prototype.downloadNewsDocument = function (documentID, documentTitle, documentNumber, documentDate) {
    var documentManager = new KnotiaKnowledge5.DocumentManager();
    //documentManager.downloadNewsDocument_onclick(documentID, documentTitle, documentNumber, documentDate);

    var serviceParams = {
        'alertID': documentID,
        'alertTitle': documentTitle,
        'alertNumber': documentNumber,
        'alertDate': documentDate
    };

    Globals.Ajax.postRequest("/Services/NewsServiceNotLoggedIn.svc/DownloadNewsDocument", serviceParams, this.downloadNewsDocument_success, this.downloadNewsDocument_error, null);
};

KnotiaKnowledge5.StateManagerOnlineViewerOnly.prototype.downloadNewsDocument_success = function (result) {
    //path of the created document
    result = result.d;
    //success
    if (result) {
        //send filepath of created document
        var parametersToPass = {
            filePath: result
        };
        var formObj = $(createPOSTSubmitFormText("/Information/NewsExportNotLoggedIn.aspx", parametersToPass));
        $("body").append(formObj);
        formObj.submit();
        formObj.remove();
    }
}

KnotiaKnowledge5.StateManagerOnlineViewerOnly.prototype.downloadNewsDocument_error = function (result) {
    //alert(result);
}
//* used for downloading news documents*/



/* private method */

KnotiaKnowledge5.StateManagerOnlineViewerOnly.prototype.updateDocumentProductLanguage = function (useLanguage) {
	document.ProductLanguage = useLanguage;
};



;
/*globals paddingFix4Safari, initializePage, glb_bIsInitializingDivs, documentBodyFix4Safari*/
KnotiaKnowledge5.NavigationManager = function (documentContextHeight) {
	this.windowWidth = 640;
	this.windowHeight = 480;

	this.useDocumentContextHeight = documentContextHeight;

	this.jqueryOuterDiv = $("#divOuterDiv");
	this.jqueryContentWrapper = $("#divContentWrapper");
	this.jquerySearchBar = $("#divSearchBar");
	this.jqueryTOC = $("#divTOC");
	this.jquerySplitterBar = $("#divSplitterBar");
	this.jqueryDocumentBody = $("#divDocumentBody");
	this.jqueryDocumentBodyContext = $("#divDocumentBodyContext");
	this.jqueryPageHeader = $("#divPageHeader");
	this.jqueryWindow = $(window);

	document.k5nav = this;
};

KnotiaKnowledge5.NavigationManager.prototype.initializeContentDivs = function (siteStyle, tocPercentageWidth) {
	var winSize = this.getWindowSize();
	this.windowWidth = parseInt(winSize.width, 10);
	this.windowHeight = parseInt(winSize.height, 10);

	if (tocPercentageWidth == null) {
		tocPercentageWidth = 0.30;
	}

	var iHeaderHeight = 166;
	if (siteStyle == "EYO" || siteStyle == "TAXNAV") {
		iHeaderHeight = 217;
	} else {
		// Must be GWTR...
		iHeaderHeight = 164;
	}

	// IF THE NAVIGATION IS HIDDEN, SHRINK THE HEADER HEIGHT APPROPRIATELY
	var bPageHeaderVisible = true;
	if (this.jqueryPageHeader.length === 0) {
		bPageHeaderVisible = false;
	} else if (!this.jqueryPageHeader.is(":visible")) {
		bPageHeaderVisible = false;
	}
	if (!bPageHeaderVisible) {
		iHeaderHeight -= 95;
	}

	// IF THE SEARCH BAR IS HIDDEN, SHRINK THE HEADER HEIGHT APPROPRIATELY
	var bSearchBarVisible = true;
	if (this.jquerySearchBar.length === 0) {
		bSearchBarVisible = false;
	} else if (!this.jquerySearchBar.is(":visible")) {
		bSearchBarVisible = false;
	}
	if (!bSearchBarVisible) {
		if (siteStyle == "KNOTIA") {
			iHeaderHeight -= 34;
		}
		else {
			iHeaderHeight -= 34;
		}
	}

	if (this.windowWidth < 1014 && !callStateManagerFunctionIfExists("isInDocumentOnlyView")) {
		this.windowWidth = 1014;
		this.jqueryOuterDiv.width(this.windowWidth);
	}
	else {
		this.jqueryOuterDiv.width("100%");
	}

	if (this.windowHeight < 300) {
		this.windowHeight = 300;
	}

	var iContentHeight = this.windowHeight - iHeaderHeight;

	// IF THE TOC (AND SPLITTER BAR) ARE NOT HIDDEN, INITIALIZE THEM BOTH
	var tocWidth = 0;
	if (this.jqueryTOC.length > 0) {
		tocWidth = Math.floor(this.windowWidth * tocPercentageWidth);
		this.jqueryTOC.css("width", tocWidth);
		this.jqueryTOC.height(iContentHeight);
		this.jquerySplitterBar.height(iContentHeight);
	}

	var iContextHeight = 0;
	if (this.jqueryDocumentBodyContext.height() === 0) {
		this.jqueryDocumentBodyContext.height(0);
		this.jqueryDocumentBodyContext.hide();
	}
	else {
		iContextHeight = this.useDocumentContextHeight;
		this.jqueryDocumentBodyContext.height(this.useDocumentContextHeight);
		this.jqueryDocumentBodyContext.show();
	}

	this.jqueryDocumentBody.height(iContentHeight - iContextHeight);
	// Make content wrapper div visible
	this.jqueryContentWrapper.css("display", "inline");
	this.jqueryContentWrapper.css("visibility", "visible");

	this.setDocumentBodyWidth(tocWidth);

	glb_bIsInitializingDivs = false;
	documentBodyFix4Safari();
};

KnotiaKnowledge5.NavigationManager.prototype.setDocumentBodyWidth = function (tocWidth) {
	var documentBodyWidth = this.windowWidth - tocWidth;
	if (this.jquerySplitterBar.length > 0) {
		documentBodyWidth -= this.jquerySplitterBar.outerWidth(false);
    }

    //@ CHANGE FOR JQUERY 3.6
	//if (!jQuery.browser.msie) { // who knows why IE doesn't need this?
    if (!Globals.Utilities.isIE()) {
		this.jqueryContentWrapper.width(documentBodyWidth);
	}

	this.jqueryDocumentBodyContext.width(documentBodyWidth);
	this.jqueryDocumentBody.width(documentBodyWidth);

};

KnotiaKnowledge5.NavigationManager.prototype.initNavigation = function (siteStyle, productID, includeSessionTrackerJS, forceLargeStylesheet) {
    //@ CHANGE FOR JQUERY 3.6
    //if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) == 6) {
    if (Globals.Utilities.isIE() && parseInt(Globals.Utilities.browserVersion(), 10) == 6) {
		try {
			document.execCommand("BackgroundImageCache", false, true);
		} catch (err) { }
	}

	callStateManagerFunctionIfExists("initializeSplitterBar");

	this.scrollBodyToCoords();

	if (typeof initializePage == "function") {
		initializePage(true, true, forceLargeStylesheet);
	}
};

KnotiaKnowledge5.NavigationManager.prototype.getWindowSize = function () {
	var w = parseInt(this.jqueryWindow.width(), 10);
	var h = parseInt(this.jqueryWindow.height(), 10);

	return {
		"width": w,
		"height": h
	};
};

KnotiaKnowledge5.NavigationManager.prototype.getAltDocumentBody = function (sFetchID) {
	var content = "<br /><blockquote><img src=\"/Knowledge/Images/CanadianTaxFoundation.png\" alt=\"Canadian Tax Foundation\" /><p>This Canadian Tax Foundation document can be accessed through your Folio Views subscription to TaxFind.</p><p><table><tr><td style=\"vertical-align:middle\">";
	content += "<a target=\"_blank\" href=\"/Knowledge/RenderBatchFile.aspx?fetchID=" + sFetchID + "\"><img border=\"0\" src=\"/Knowledge/Images/FolioViewsButton.png\" alt=\"open document in Folio Views\" /></a></td><td style=\"vertical-align:middle\" class=\"normalTextResizable\"> (Note: when prompted to Run or Save, ";
	content += "choose Run)</td></tr></table></p><p>If you need assistance, please contact our help desk at:<br /><br />support@knotia.ca<br />1-888-352-2228<br >Mon-Fri, 8am-6pm ET</p></blockquote>";
	return content;
};

KnotiaKnowledge5.NavigationManager.prototype.scrollBodyToCoords = function () {
	window.setTimeout(function () { document.k5nav.delayInitialScroll() }, 50);
};

KnotiaKnowledge5.NavigationManager.prototype.delayInitialScroll = function () {
	try {
		var div = document.getElementById("divPageBody");

		if (this.jqueryWindow.width() < 1000) {
			div = document.body;
		}

		var iDeltaY = parseInt(document.getElementById("yCoordHolder").value);
		if (iDeltaY > 0) {
			div.scrollTop = iDeltaY;
		}

		this.captureBodyCoords();
	}
	catch (e) {
		/* this takes care of any script errors in case the element is not found (most pages) */
	}
};

KnotiaKnowledge5.NavigationManager.prototype.captureBodyCoords = function () {
	try {
		var div = document.getElementById("divPageBody");
		if (this.jqueryWindow.width() < 1000) {
			div = document.body;
		}

		document.getElementById("xCoordHolder").value = div.scrollLeft.toString();
		document.getElementById("yCoordHolder").value = div.scrollTop.toString();
		window.setTimeout("document.k5nav.captureBodyCoords()", 200);
	}
	catch (e) { }
};
;
// initialize if not loaded in a statemanager
if (typeof (KnotiaKnowledge5) === "undefined" || KnotiaKnowledge5 === null) {
	KnotiaKnowledge5 = {};
}

KnotiaKnowledge5.CollectionType = {
	Collection: 1,
	SearchAll: 2,
	Briefcase: 3,
	News: 4,
	SavedSearches: 5,
	MyNotes: 6
};

KnotiaKnowledge5.PageType = {
	Document: 10,
    SearchResults: 20,
    SearchTemplate: 30,
	Other: 999
};

KnotiaKnowledge5.SearchType = {
	Simple: 1,
	Advanced: 2,
	SearchAll: 3,
	Rulings: 4,
	TaxSubjectFile: 5,
	ProvincialCase: 6,
	TaxPrecedentLetter: 7,
	Case: 8,
	Annotations: 9,
	SearchBriefcase: 10,
	BrowseBriefcase: 11,
	MostEmailed: 14,
	Content: 15,
	Matrix: 16,
	Alerts: 17,
	Commentary: 18,
	ITATopicalIndex: 19,
    NewsSearch: 20,
    NewsSearchMostRecentDate: 21,
    ChooseDateNews: 22,
    SimpleNews: 23,
    AdvancedNews: 24,
    ChooseAlertLoadNews: 25,
    NewsSearchPastNDays: 26,
    CaseCommentaryTopicalIndex: 27,
    RulingReviewTopicalIndex: 28,
    ITACommentaryTopicalIndex: 29,
    ETATopicalIndex: 30,
    ETACommentaryTopicalIndex: 31,
    NewsSearchDateRange: 32,
    TaxRulesTopicalIndex: 33,
    T1TopicalIndex: 34,
    PurposeNotesTopicalIndex: 35,
	HeuristicAnswerLibrary: 36,
	SearchMyNotes: 37,
	WealthAndEstatePlanning: 38,
	TEXDocumentType: 39,
	TEXMarketSegmentType: 40,
	TEXDocumentTopic: 41,
    TEXCountry: 42,
    TEXTopicalIndex: 43,
    TEXRevenueFocusTopicalIndex: 44,
	TEXTaxPrecendentsTopicalIndex: 45,
	TaxRatesAndTools: 46,
	EnableFilterSearchByDocDate: 47,
	EYNotesAndAnnotationsTool: 48,
	NewsroomArchive: 49,

	NotSpecified: 0
};

KnotiaKnowledge5.TopicalIndexType = {
	IncomeTax: 1,
	TaxKnowledgeLibrary: 2,
	CaseCommentary: 3,
	RulingsReview: 4,
	CaseCommentaryFrench: 5,
	RulingsReviewFrench: 6,
	Excise: 7,
	ExciseCommentary: 8,
	TaxRules: 9,
	T1: 10,
    PurposeNotes: 11,
    TaxExchange: 12,
    TaxExchangeRevenueFocus: 13,
    TaxExchangeTaxPrecedent: 14,

	NotSpecified: 0
};

KnotiaKnowledge5.PinnedItemType = {
    NOT_SET: 0,
    Document: 1,
    Search: 2,
    Notes: 3
};

NodeDataType = {
    Unspecified: 0,
    SearchResults: 1,
    ViewCounts: 2
};

KnotiaKnowledge5.AutomaticEmailNewsType = {
	Disabled: 0,
	PublishNewByDefaultUpdatesOnRequest: 1,
	PublishAllByDefault: 2,
	PublishAllOnRequest: 3
};
;
/*globals Sys, glb_SiteStyle, loadPage, getURLParameter, getAltDocumentBody, delegateSwipeEvent, createCenteredPopupDiv*/
KnotiaKnowledge5.DocumentManager = function (documentControlJqueryObject, documentContextControlJqueryObject, collectionType, productID) {
    this.controlJqueryObject = documentControlJqueryObject;
    this.contextControlJqueryObject = documentContextControlJqueryObject;

    this.collectionType = collectionType;
    this.productID = productID;
    this.bookID;
    this.documentID;
    this.fetchID;
    this.isBilingual;
    this.stylesheet;
    this.pageHTML;
    this.documentFooter;
    this.tocContext = [];
    this.footnotes = {};
    this.resolvedLinks = {};
    this.purposeNoteLinks = {};
    this.canEditDocument;
    this.isMouseDown = false;
    this.mouseDownParagraphID = "";
    this.overrideServerIsSearchDeclare = false;
    this.tryNewsOnFailure = false;
    this.previousDocumentBookID;
    this.previousDocumentID;
    this.previousDocumentTitle;
    this.nextDocumentBookID;
    this.nextDocumentID;
    this.nextDocumentTitle;
    this.documentHitNumber = -1;
    this.specifiedHitParagraphs = [];
    this.specialJumpToInformation;
    this.extraMetadata = {};
    this.documentDate;
    this.alertExtraMetadata = {};

    this.isTaggingEnabled = false;
    this.taggedRecordsList = "";
    this.suppressScrollOfInlineDocument = false;
    this.tryFetchesIfAlertFails = [];
    this.suppressAutoScrollToHitHighlight = false;

    //ELASTIC
    this.SearchPreferenceCookieName = "ElasticsearchSearchPreferenceCookie";

    document.k5doc = this;
};

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    KnotiaKnowledge5.DocumentManager.prototype.loadDocumentByBookDocumentID
//          / this.loadDocumentByBookDocumentID / document.k5doc.loadDocumentByBookDocumentID
//
// Desc:    This method will load the document by book document id
//
// Inputs   iProductID      -- The Product ID
//          iBookID         -- The Book ID
//          iDocumentID     -- The Document ID
//          alternateOnload -- ??
//
// Modified: Has now an Elastic branch
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
KnotiaKnowledge5.DocumentManager.prototype.loadDocumentByBookDocumentID = function (iProductID, iBookID, iDocumentID, alternateOnload) {
    this.productID = iProductID;

    //if bookID = 999 then that means its an alert. loadAlertByID has history processing so no need to use this method's version.
    if (typeof (iBookID) !== "undefined" && iBookID !== null) {
        if (parseInt(iBookID, 10) === 999) {
            this.loadAlertByID(iDocumentID, Globals.Utilities.getCurrentSiteLanguage());
            return false;
        }
    }

    callStateManagerFunctionIfExists("saveHistoryPoint", "document.k5doc.loadDocumentByBookDocumentID", arguments);

    var useOnload;
    if (alternateOnload != null) {
        useOnload = alternateOnload;
    }
    else {
        useOnload = this.processLoadedDocument;
        this.startProcessingImage();
    }

    //@ELASTIC
    if (useElasticsearch()) {
        Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentByBookDocumentIDFromElastic",
            { "iProductID": iProductID, "iBookID": iBookID, "iDocumentID": iDocumentID },
            useOnload,
            null,
            "KnotiaKnowledge5.DocumentManager.loadDocumentByBookDocumentID",
            this);
    }
    else {
        Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentByBookDocumentID",
            { "iProductID": iProductID, "iBookID": iBookID, "iDocumentID": iDocumentID },
            useOnload,
            null,
            "KnotiaKnowledge5.DocumentManager.loadDocumentByBookDocumentID",
            this);
    }
};

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    KnotiaKnowledge5.DocumentManager.prototype.loadDocumentByNodeID
//          / this.loadDocumentByNodeID / document.k5doc.loadDocumentByNodeID
//
// Desc:    This method will load the document by node id
//
// Inputs   iProductID          -- The product id
//          iNodeID             -- The node id
//          bIsSearchDocument   -- Node cliked from search
//          bIsNewsDocument     -- ??
//          doForceNonInline    -- ??
//
// Modified: Has now an Elastic branch
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
KnotiaKnowledge5.DocumentManager.prototype.loadDocumentByNodeID = function (iProductID, iNodeID, bIsSearchDocument, bIsNewsDocument, doForceNonInline) {
    this.productID = iProductID;

    var aiNodeIDs = [];
    aiNodeIDs[0] = iNodeID;

    var isNewsDocument = false;
    if (bIsNewsDocument) {
        isNewsDocument = true;
    }

    callStateManagerFunctionIfExists("saveHistoryPoint", "document.k5doc.loadDocumentByNodeID", arguments);

    this.startProcessingImage();

    if (isNewsDocument) {
        var serviceToCall = "/Services/NewsService.svc/GetKnotiaDocumentByNewsletterTreeviewNodeID";
        var parameterToPass = {
            'NodeID': iNodeID,
            'Language': Globals.Utilities.getCurrentSiteLanguage(),
            'DoForceNonInline': doForceNonInline
        };

        Globals.Ajax.postRequest(serviceToCall, parameterToPass, this.processLoadedDocuments, null, null, this);
    }
    else {
        if (bIsSearchDocument) {
            var loadingDocumentFromSearchTypeAndParameters = callStateManagerFunctionIfExists("getCurrentSearchTypeAndParameters");
            if (loadingDocumentFromSearchTypeAndParameters.searchType == KnotiaKnowledge5.SearchType.SearchMyNotes) {
                this.loadDocumentFromBriefcase(iNodeID);
            }
            else {
                this.loadDocumentsByNodeIDsInSearch(iProductID, aiNodeIDs, loadingDocumentFromSearchTypeAndParameters.searchType, loadingDocumentFromSearchTypeAndParameters.parameters);
            }
        } else {
            //@ELASTIC
            if (useElasticsearch(iNodeID)) {
                Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentsByNodeIDsFromElastic",
                    {
                        "iProductID": iProductID,
                        "nodeIDList": aiNodeIDs
                    },
                    this.processLoadedDocuments,
                    null,
                    "KnotiaKnowledge5.DocumentManager.loadDocumentByNodeID",
                    this);
            }
            else {
                Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentsByNodeIDs",
                    { "iProductID": iProductID, "nodeIDList": aiNodeIDs },
                    this.processLoadedDocuments,
                    null,
                    "KnotiaKnowledge5.DocumentManager.loadDocumentByNodeID",
                    this);
            }
        }
    }
};

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    KnotiaKnowledge5.DocumentManager.prototype.loadDocumentByGotoString
//          / this.loadDocumentByGotoString / document.k5doc.loadDocumentByGotoString
//
// Desc:    This method will load the document by gotostring
//
// Inputs   iProductID                      -- The Product id
//          sGoto                           -- The Gotostring
//          iBookID                         -- The BookID
//          sKeyForBypassingProductCheck    -- ??
//          bTryNewsOnFailure               -- ??
//          fromBookID                      -- ??
//
// Modified: Has now an Elastic branch
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
KnotiaKnowledge5.DocumentManager.prototype.loadDocumentByGotoString = function (iProductID, sGoto, iBookID, sKeyForBypassingProductCheck, bTryNewsOnFailure, fromBookID, isFetchBox) {

    //IF ANY POPUP IS OPENED CLOSE IT
    $(".ui-dialog-content").dialog("close");

    if (Globals.Utilities.isUndefinedOrNull(iProductID) || iProductID.length === 0) {
        iProductID = 0;
    }

    if (Globals.Utilities.isUndefinedOrNull(iBookID) || iBookID.length === 0) {
        iBookID = 0;
    }

    if (Globals.Utilities.isUndefinedOrNull(fromBookID) || fromBookID.length === 0) {
        fromBookID = 0;
    }

    //SAVE TO LOGANYTHINGJSON IF ITS COMING FROM THE FETCHBOX
    if (isFetchBox) {
        document.KnotiaInsightsTracker.SaveClickedItemDetail("FetchBox", sGoto);
    }

    this.tryNewsOnFailure = bTryNewsOnFailure;

    var bMustOpenSpecialViewerWindow = true;
    if (callStateManagerFunctionIfExists("isInDocumentOnlyView")) {
        // already in special window
        bMustOpenSpecialViewerWindow = false;
    }
    else if (this.collectionType == KnotiaKnowledge5.CollectionType.Briefcase || this.collectionType == KnotiaKnowledge5.CollectionType.News) {
        // in briefcase or news, can't fetch within it
        bMustOpenSpecialViewerWindow = true;
    }
    else if (sKeyForBypassingProductCheck == null) {
        // not loading FITAC document in LBL via special link
        bMustOpenSpecialViewerWindow = false;
        var bSearchBarVisible = true;
        if (document.getElementById("divSearchBar") == null) {
            bSearchBarVisible = false;
        } else if (document.getElementById("divSearchBar").style.display == "none") {
            bSearchBarVisible = false;
        }

        if (iBookID > 0 && (document.ProductBooks == null || document.ProductBooks[iBookID] == null)) {
            // fetching to another product
            bMustOpenSpecialViewerWindow = true;
        }
        else if (!bSearchBarVisible) {
            if (Globals.Cookies.readCookie("ShowCMTToolbar") == true) {
                // CMT, no change
            }
            else {
                // LBL product
                bMustOpenSpecialViewerWindow = true;
            }
        }
    }

    this.fetchID = sGoto;

    if (bMustOpenSpecialViewerWindow) {
        var sPage = "/Knowledge/Viewer.aspx?ProductID=" + iProductID.toString() + "&FetchID=" + encodeURIComponent(sGoto) + "&BookID=" + iBookID.toString();
        if (sKeyForBypassingProductCheck != null) {
            sPage = sPage + "&Key=" + sKeyForBypassingProductCheck;
        }
        window.open(sPage, "viewerWindow", "width=800,height=600,toolbars,statusbar,resizable,scrollbars");
    }
    else {
        callStateManagerFunctionIfExists("saveHistoryPoint", "document.k5doc.loadDocumentByGotoString", arguments);

        this.productID = iProductID;

        if (sKeyForBypassingProductCheck == null) {
            if (callStateManagerFunctionIfExists("isInSearch")) {
                this.overrideServerIsSearchDeclare = true;
                var loadingDocumentFromSearchTypeAndParameters = callStateManagerFunctionIfExists("getCurrentSearchTypeAndParameters");
                this.loadDocumentByGotoStringInSearch(iProductID, sGoto, iBookID, loadingDocumentFromSearchTypeAndParameters.searchType, loadingDocumentFromSearchTypeAndParameters.parameters);
            }
            else {
                //@ELASTIC
                if (useElasticsearch()) {
                    Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentByGotoStringFromElastic",
                        { "iProductID": iProductID, "sGotoString": sGoto, "iBookID": iBookID, "fromBookID": fromBookID },
                        this.processLoadedDocument,
                        null,
                        null,
                        this);
                }
                else {
                    Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentByGotoString",
                        { "iProductID": iProductID, "sGotoString": sGoto, "iBookID": iBookID, "fromBookID": fromBookID },
                        this.processLoadedDocument,
                        null,
                        null,
                        this);
                }
            }
        }
        else {
            //@ELASTIC
            if (useElasticsearch()) {
                Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetSpecialDocumentByGotoStringFromElastic",
                    { "iProductID": iProductID, "sGotoString": sGoto, "sKeyForBypassingProductCheck": sKeyForBypassingProductCheck },
                    this.processLoadedDocument,
                    null,
                    null,
                    this);
            }
            else {
                Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetSpecialDocumentByGotoString",
                    { "iProductID": iProductID, "sGotoString": sGoto, "sKeyForBypassingProductCheck": sKeyForBypassingProductCheck },
                    this.processLoadedDocument,
                    null,
                    null,
                    this);
            }
        }
    }
};


/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    KnotiaKnowledge5.DocumentManager.prototype.loadDocumentFromSearch
//          / this.loadDocumentFromSearch / document.k5doc.loadDocumentFromSearch
//
// Desc:    This method will load the document from search
//
// Inputs   iProductID                          -- The Product ID
//          iBookID                             -- The Book ID
//          iDocumentID                         -- The Document ID
//          objSearchType                       -- ??
//          sSearchParameters                   -- ??
//          iHitParagraphID                     -- ??
//          iHitNumber                          -- ??
//          thisDocumentSearchResult            -- ??
//          searchSettingsForHistory            -- ??
//          searchResultsCountForHistory        -- ??
//          doSuppressScrollOfInlineDocument    -- ??
//
// Modified: Has now an Elastic branch
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
KnotiaKnowledge5.DocumentManager.prototype.loadDocumentFromSearch = function (iProductID, iBookID, iDocumentID, objSearchType, sSearchParameters, iHitParagraphID, iHitNumber, thisDocumentSearchResult, searchSettingsForHistory, searchResultsCountForHistory, doSuppressScrollOfInlineDocument) {
    var isNewsDocument = (this.collectionType == KnotiaKnowledge5.CollectionType.News);
    this.specifiedHitParagraphs = [];
    this.documentHitNumber = (iHitNumber == null) ? 1 : iHitNumber;
    this.suppressScrollOfInlineDocument = doSuppressScrollOfInlineDocument;

    // if hit paragraphs are specified in the details, parse them out
    //if (thisDocumentSearchResult != undefined && thisDocumentSearchResult.Details != undefined && thisDocumentSearchResult.Details !== null) {
    if (!Globals.Utilities.isUndefinedOrNull(thisDocumentSearchResult) && !Globals.Utilities.isUndefinedOrNull(thisDocumentSearchResult.Details)) {
        var sThisDocumentSearchDetails = thisDocumentSearchResult.Details;
        if (sThisDocumentSearchDetails.indexOf("ApplyRowNumber") > 0) {
            this.documentHitNumber = 0;
            while (sThisDocumentSearchDetails.length > 0) {
                var i = sThisDocumentSearchDetails.indexOf("ApplyRowNumber"); // find ApplyRowNumber in the details string, right after it is the paragraph number to use as a hit
                if (i > 0) {
                    i += 16; // 16 skips ApplyRowNumber-comma-space
                    var j = sThisDocumentSearchDetails.indexOf(")", i);
                    var iParagraphID = parseInt(sThisDocumentSearchDetails.substring(i, j), 10);
                    // this paragraphID-for-hit is the one we want to jump to (uses the length before inserting to get the last index = length-1)
                    if (iParagraphID == iHitParagraphID) {
                        this.documentHitNumber = this.specifiedHitParagraphs.length;
                    }
                    // add the paragraphID to the array of hits
                    //this.specifiedHitParagraphs.push(iParagraphID);
                    Globals.Utilities.arrayPush(this.specifiedHitParagraphs, iParagraphID);
                    sThisDocumentSearchDetails = sThisDocumentSearchDetails.substring(j);
                }
                else {
                    sThisDocumentSearchDetails = "";
                }
            }
        }
    }

    this.productID = iProductID;

    if (!callStateManagerFunctionIfExists("isInDocumentOnlyView")) {
        callStateManagerFunctionIfExists("saveHistoryPoint", "document.k5doc.loadDocumentFromSearch", arguments, searchSettingsForHistory, searchResultsCountForHistory);
    }

    if (isNewsDocument) {
        var parameterToPass = {
            'AlertID': iDocumentID,
            'SearchParameters': sSearchParameters,
            'Language': Globals.Utilities.getCurrentSiteLanguage()
        };

        Globals.Ajax.postRequest("/Services/NewsService.svc/GetAlertFromSearch",
            parameterToPass,
            this.processLoadedDocuments,
            null,
            null,
            this);
    }
    else {
        // not for news documents since it loads within the list
        this.startProcessingImage();

        //@ELASTIC

        //move to global spot
        //var isNewUX = (!Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) && glb_EnableKnotiaNext === 1 && !Globals.Utilities.isUndefinedOrNull(window.currentPage));
        //
        //removing isNewUX from below condition because there is a site that has the old look but still uses elasticsearch (GTNU)

        if (useElasticsearch()) {

            if (window.glb_EnableNewQueryParser === true && currentPage.SiteDAL.getUserPreferenceAppState(27) === "true") {
                Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentFromNewParserElastic",
                    {
                        "iProductID": iProductID,
                        "iBookID": iBookID,
                        "iDocumentID": iDocumentID,
                        "objSearchType": objSearchType,
                        "sSearchParameters": sSearchParameters //+ extra
                    },
                    this.processLoadedDocument,
                    null,
                    null,
                    this);
            } else {
                Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentFromSearchFromElastic",
                    {
                        "iProductID": iProductID,
                        "iBookID": iBookID,
                        "iDocumentID": iDocumentID,
                        "objSearchType": objSearchType,
                        "sSearchParameters": sSearchParameters //+ extra
                    },
                    this.processLoadedDocument,
                    null,
                    null,
                    this);
            }
        }
        else {

            Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentFromSearch",
                { "iProductID": iProductID, "iBookID": iBookID, "iDocumentID": iDocumentID, "objSearchType": objSearchType, "sSearchParameters": sSearchParameters },
                this.processLoadedDocument,
                null,
                null,
                this);
        }
    }
};


/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    KnotiaKnowledge5.DocumentManager.prototype.loadDocumentByGotoStringInSearch
//          / this.loadDocumentByGotoStringInSearch / document.k5doc.loadDocumentByGotoStringInSearch
//
// Desc:    This method will load the document by gotostring in search
//
// Inputs   productID       -- The Product id
//          fetchID         -- The fetch ID
//          bookID          -- The BookID
//          searchType      -- The search type (news, notes,...)
//          searchParams    -- The search parameters
//          fromBookID      -- ??
//
// Modified: Has now an Elastic branch
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
KnotiaKnowledge5.DocumentManager.prototype.loadDocumentByGotoStringInSearch = function (productID, fetchID, bookID, searchType, searchParams) {
    //@ELASTIC
    if (useElasticsearch()) {
        Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentByGotoStringInSearchFromElastic",
            { "iProductID": productID, "sGotoString": fetchID, "iBookID": bookID, "fromBookID": 0, "objSearchType": searchType, "sSearchParameters": searchParams },
            this.processLoadedDocument,
            null,
            null,
            this);
    }
    else {
        Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentByGotoStringInSearch",
            { "iProductID": productID, "sGotoString": fetchID, "iBookID": bookID, "fromBookID": 0, "objSearchType": searchType, "sSearchParameters": searchParams },
            this.processLoadedDocument,
            null,
            null,
            this);
    }
};

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    KnotiaKnowledge5.DocumentManager.prototype.loadDocumentsByNodeIDsInSearch
//          / this.loadDocumentsByNodeIDsInSearch / document.k5doc.loadDocumentsByNodeIDsInSearch
//
// Desc:    This method will load the document by nodeid in search
//
// Inputs   productID       -- The Product id
//          nodeIDList      -- The list of nodeIDs
//          searchType      -- The search type (news, notes,...)
//          searchParams    -- The search parameters
//
// Modified: Has now an Elastic branch
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
KnotiaKnowledge5.DocumentManager.prototype.loadDocumentsByNodeIDsInSearch = function (productID, nodeIDList, searchType, searchParams) {
    //@ELASTIC
    if (useElasticsearch()) {
        Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentsByNodeIDsInSearchFromElastic",
            { "iProductID": productID, "nodeIDList": nodeIDList, "objSearchType": searchType, "sSearchParameters": searchParams },
            this.processLoadedDocuments,
            null,
            null,
            this);
    }
    else {
        Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentsByNodeIDsInSearch",
            { "iProductID": productID, "nodeIDList": nodeIDList, "objSearchType": searchType, "sSearchParameters": searchParams },
            this.processLoadedDocuments,
            null,
            null,
            this);
    }
};


KnotiaKnowledge5.DocumentManager.prototype.loadDocumentFromBriefcase = function (nodeID) {
    if (!callStateManagerFunctionIfExists("isInDocumentOnlyView")) {
        callStateManagerFunctionIfExists("saveHistoryPoint", "document.k5doc.loadDocumentFromBriefcase", arguments);
    }

    this.startProcessingImage();

    callStateManagerFunctionIfExists("setActiveBriefcaseTreeviewDocumentNodeID", nodeID);

    //@ELASTIC
    if (useElasticsearch()) {
        Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentFromBriefcaseFromElastic",
            { "nodeID": nodeID },
            this.processLoadedDocument,
            null,
            null,
            this);
    }
    else {

        Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDocumentFromBriefcase",
            { "nodeID": nodeID },
            this.processLoadedDocument,
            null,
            null,
            this);
    }
};

KnotiaKnowledge5.DocumentManager.prototype.startProcessingImage = function () {
    callStateManagerFunctionIfExists("updateDocumentBodyToWait");
};

KnotiaKnowledge5.DocumentManager.prototype.processLoadedDocument = function (result) {
    if (result.d) {
        result = result.d;
    }

    if (result == null) {
        // problem, quit
        return;
    }

    //@CHANGED AND @20190307: added this if condition then window.open
    if (result.ProductID > 0 && this.productID > 0 && result.ProductID != this.productID && result.ErrorCode === 0) {
        window.open("Viewer.aspx?ProductID=" + result.ProductID.toString() + "&FetchID=" + escape(result.FetchID));
    }

    //GET THE ID OF THE COUNTRY THE DOCUMENT IS RELATED TO.
    if (typeof (Glb_IGAA_DocumentCountryID) != "undefined") {
        Glb_IGAA_DocumentCountryID = result.CountryID;
    }

    var bIsSearchDoc = result.IsSearchDocument;

    try {
        if (this.overrideServerIsSearchDeclare) {
            this.overrideServerIsSearchDeclare = false;
            bIsSearchDoc = false;
        }
    }
    catch (exc) {
        bIsSearchDoc = false;
    }

    var redirectToFAQ = true;

    if (typeof (glb_SiteType) != "undefined" && glb_SiteType == Globals.SiteType.GWTR) {
        redirectToFAQ = false;
    }

    if (result.ErrorCode !== 0) {
        // for document, only force a refresh for content change if the document can't be loaded
        callStateManagerFunctionIfExists("checkLeftHandTocFreshness", result.WCFServerProductFreshness);

        if (this.tryNewsOnFailure) {
            this.tryNewsOnFailure = false;
            this.loadOldNewsDocument();
            return;
        }

        if (result.ErrorCode == -6) { // needs ssl
            var loadingDocumentFromSearchTypeAndParameters = null;
            if (bIsSearchDoc) { // search
                loadingDocumentFromSearchTypeAndParameters = callStateManagerFunctionIfExists("getCurrentSearchTypeAndParameters");
            }

            if (loadingDocumentFromSearchTypeAndParameters != null) {
                this.loadSecureDocument(result.ProductID, result.BookID, result.DocumentID, loadingDocumentFromSearchTypeAndParameters.searchType, loadingDocumentFromSearchTypeAndParameters.parameters);
            }
            else { // not search
                this.loadSecureDocument(result.ProductID, result.BookID, result.DocumentID, 0, "");
            }
            return;
        }
        else if (result.ErrorCode == -4) { // bad fetch
            if (callStateManagerFunctionIfExists("isInDocumentOnlyView")) {
                var asErrorContext = [];
                asErrorContext[0] = GetString("str_CommonErrorTitle");
                var sErrorMessage = "<p class=medium>" + GetString("str_docDeleted") + "</p>";
                this.displayLoadedDocument(0, 0, 0, false, "", sErrorMessage, "", "",
                    0, "", "", asErrorContext, "", null, null, null,
                    0, 0, "", 0, 0, "", "",
                    true, 1, null, null);
                return;
            }
            else {
                var sFailedGoto = result.PageHTML.substring(9);
                callStateManagerFunctionIfExists("processFetchAssistanceRequestInterface", sFailedGoto);
                return;
            }
        }
        else if ((result.ErrorCode == -2 || result.ErrorCode == -8) && redirectToFAQ) { // not subscribed to document
            var page = "/Information/Bing.aspx?ProductID=" + result.ProductID.toString();
            if (result.FetchID != null && result.FetchID.length > 0) {
                page += "&FetchID=" + encodeURIComponent(result.FetchID);
            }

            var objWin = window.open(page);
            try {
                objWin.focus();
            }
            catch (exc) {
                // sometimes that doesn't work
            }

            return;
        }
    }

    callStateManagerFunctionIfExists("setUserHighlightingPermitted", result.ProductSupportsUserNotes);

    document.cookie = "CurrentProductID=" + result.ProductID.toString();
    this.displayLoadedDocument(result.ProductID, result.BookID, result.DocumentID, bIsSearchDoc, result.Stylesheet, result.PageHTML, result.DocumentLanguageFlipLink, result.DocumentFooter,
        result.JumpToParagraphID, result.JumpToFetchID, result.TOCContext, result.TOCContextDescription, result.FetchID, result.Footnotes, result.ResolvedLinks, result.PurposeNotesForLinks,
        result.PreviousDocumentBookID, result.PreviousDocumentID, result.PreviousDocumentTitle, result.NextDocumentBookID, result.NextDocumentID, result.NextDocumentTitle, result.EditLinks,
        result.DoForceLoadNonInline, result.ProductLanguage, result.ExtraMetadata, result.DocumentDate, result.AlertExtraMetadata);
};

KnotiaKnowledge5.DocumentManager.prototype.processLoadedDocuments = function (result) {
    if (result == null) {
        // problem, quit
        return;
    }

    if (result.d) {
        result = result.d;
    }

    if (result.ErrorCode !== 0 && this.tryFetchesIfAlertFails.length > 0) {
        // document.Newsletter.tryFetchesIfAlertFails = productID1, fetchID1, productID2, fetchID2, ... productIDN, fetchIDN
        var productID = this.tryFetchesIfAlertFails[0];
        var fetchID = this.tryFetchesIfAlertFails[1];

        // remove the 2 parameters we are now trying, if we fail again, we will try again, until we fail
        this.tryFetchesIfAlertFails = this.tryFetchesIfAlertFails.slice(2);

        this.loadDocumentByGotoString(productID, fetchID);
        return;
    }

    if ($.isArray(result)) {
        this.processLoadedDocument(result[0]);
    }
    else {
        this.processLoadedDocument(result);
    }
};

KnotiaKnowledge5.DocumentManager.prototype.createFetchLink = function (objFetchLink, iBookID, sGotoStr, bTryNewsOnFailure) {
    if (this.purposeNoteLinks[sGotoStr]) {
        var plainTextNote = this.purposeNoteLinks[sGotoStr];

        var closeParagraphTag = new RegExp("</p>", "gi");
        var allOtherTags = new RegExp("<[^>]*>", "g");

        plainTextNote = plainTextNote.replace(closeParagraphTag, "\n\n");
        plainTextNote = plainTextNote.replace(allOtherTags, "");
        plainTextNote = $.trim(plainTextNote);

        objFetchLink.title = plainTextNote;
        $(objFetchLink).tooltip();
    }

    // determine the bookID of the destination
    if (parseInt(iBookID, 10) === 0 && this.resolvedLinks) {
        var sResolution = this.resolvedLinks[sGotoStr];
        if (sResolution != null) {
            if (sResolution.indexOf(" ") > 0) {
                // changed destination too (for translated links)
                var sBookID = sResolution.split(" ")[0];
                var sGotoStr = sResolution.substring(sBookID.length).trim();
                iBookID = parseInt(sBookID, 10);
            }
            else {
                // found bookID
                iBookID = parseInt(sResolution, 10);
            }
        }
    }

    var sEscGotoStr = sGotoStr.replace(/'/g, "\\'");

    var bSearchBarVisible = true;
    if (document.getElementById("divSearchBar") == null) {
        bSearchBarVisible = false;
    }
    else if (document.getElementById("divSearchBar").style.display == "none") {
        bSearchBarVisible = false;
    }

    // may be undefined, so don't just use toString()
    bTryNewsOnFailure = (bTryNewsOnFailure ? "true" : "false");

    if (iBookID > 0 && (document.ProductBooks == null || document.ProductBooks[iBookID] == null)) {
        // the book containing the destination isn't in this product
        var sLink = "javascript:document.k5doc.loadDocumentByGotoString(0, '" + sEscGotoStr + "', " + iBookID.toString() + ", null, " + bTryNewsOnFailure + ")";
        objFetchLink.href = sLink;
    }
    else if (!bSearchBarVisible) {
        // presentation mode?
        var sLink = "javascript:document.k5doc.loadDocumentByGotoString(" + this.productID.toString() + ", '" + sEscGotoStr + "', " + iBookID.toString() + ", null, " + bTryNewsOnFailure + ")";
        objFetchLink.href = sLink;
    }
    else {
        //@CHANGED AND @20190307: added thisBookIDIfDefined variable to href
        var thisBookIDIfDefined;
        if (this.bookID == null) {
            thisBookIDIfDefined = "null";
        }
        else {
            thisBookIDIfDefined = this.bookID.toString();
        }
        objFetchLink.href = "javascript:document.k5doc.loadDocumentByGotoString(" + this.productID.toString() + ", '" + sEscGotoStr + "', " + iBookID.toString() + ", null, " + bTryNewsOnFailure + ", " + thisBookIDIfDefined + ")";

        try {
            objFetchLink.addEventListener("contextmenu", function (e) { document.k5doc.displayContextMenu(sEscGotoStr); e.preventDefault(); });
            objFetchLink.removeEventListener("mouseover");
        }
        catch (exc) {
            // not supported in all browsers (especially IE<9)
        }

        //@YAO ADDED THIS. REMOVE ALL TARGET FROM THE URL IN CASE THERE IS ANY.
        //THIS IS SO THAT IT WORKS ON IE
        $(objFetchLink).removeAttr("target");
    }
};

//DISABLE FOR TNU ARCHIVE ON PRD. THIS IS ONLY FOR BETA
function getResearchNewslinksAtTopOfDocument(asTOCContext, sFinalPageHTML, sEditLinks) {
    var alertTitle, alertNumber, alertDate, documentID;
    var lastAlertNumber = asTOCContext[asTOCContext.length - 1].toString();
    alertTitle = lastAlertNumber.replace(/'/g, "\\'").replace(/"/g, "&#x22;");
    alertTitle = alertTitle.substring(alertTitle.indexOf(")") + 2);
    alertNumber = document.k5doc.fetchID;
    alertDate = document.k5doc.documentDate;
    documentID = 99999999;//document.k5doc.documentID; //this is temporary until Elastic can return AlertID - it forces a lookup
    var linksAtTopOfDocument = "";

    var showDownloadDocumentLinks = true;
    var downloadLink = "";

    if (glb_EnableKnotiaNextSandbox) {
        downloadLink = "callKNextStateManagerFunctionIfExists('CommonToolbarBLL', 'onDownloadDocumentClick');";
    } else {
        downloadLink = "javascript:document.k5doc.downloadNewsDocument(" + documentID.toString() + ", '" + alertTitle + "', '" + alertNumber + "', '" + alertDate + "')";
    }

    var showEmailLink = true;
    var emailLink;
    if (document.k5doc.extraMetadata["IsInternalOnlyContent"] == "true" && document.k5doc.extraMetadata["IsExternalAndInternalContent"] != "true") {
        emailLink = null;
    }
    else if (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_alertID] == null) {
        emailLink = null;
        showDownloadDocumentLinks = false;
        showEmailLink = false;
    }
    else {
        var twitterLink = (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_TwitterLink] ? ", '" + document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_TwitterLink] + "'" : ", null");
        var linkedInLink = (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_LinkedInLink] ? ", '" + document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_LinkedInLink] + "'" : ", null");
        var facebookLink = (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_FacebookLink] ? ", '" + document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_FacebookLink] + "'" : ", null");
        emailLink = "javascript:document.k5doc.emailNewsDocument(" + false + ", " + documentID.toString() + ", '" + alertTitle + "', '" + alertNumber + "', '" + alertDate + "'" + twitterLink + linkedInLink + facebookLink + ")";
    }

    var printJSLink;
    //if (isInlineViewOfNewsDocument) {
    //    printJSLink = "document.k5doc.printInlineNewsDocument(" + documentID + ");";

    //}
    //else {
    //}

    if (glb_EnableKnotiaNextSandbox) {
        printJSLink = "callKNextStateManagerFunctionIfExists('BLL', 'onPrintFromTopOfDocumentLinkClick');";
    } else {
        printJSLink = "callStateManagerFunctionIfExists('doPrint', 0);";
    }

    var sIcon, indexOfCloseBracket, sLinkWithIcon, newsDocumentLinks = "";
    //IF-zilla
    //if (Globals.UI.isSiteThemeEnabled()) {
    //    if (isInlineViewOfNewsDocument || callStateManagerFunctionIfExists("useBucketTreeview")) {

    //download document
    //var showDownloadDocumentLinks = ($("#divDownloadButtonFormats").length > 0);

    //var showDownloadDocumentLinks = true; BP: 11/15/2021 - moving this to the top
    //var showEmailLink = (emailLink != null); BP: 11/15/2021 - moving this to the top
    showEmailLink = (emailLink != null);

    var onemailClickFn = "";

    if (typeof (glb_SiteType) != "undefined" && glb_SiteType == Globals.SiteType.GWTR) {
        showDownloadDocumentLinks = false;
        showEmailLink = false;
    }

    //show print this document/email this document for inline news document
    linksAtTopOfDocument += "<span style='white-space:nowrap;'><a href=\"javascript:;\" onclick=\"" + printJSLink + "\"><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Print-Small.png' border='0' class='js--img--pnghover'/></a>&nbsp;<a href=\"javascript:;\" onclick=\"" + printJSLink + "\" style='vertical-align:super;'>" + GetString("str_Print_PrintThisDocument") + "</a></span>";

    //download document
    //var showDownloadDocumentLinks = ($("#divDownloadButtonFormats").length > 0);

    if (showDownloadDocumentLinks) {
        linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'><a href=\"javascript:;\" onclick=\"" + downloadLink + "\"><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Download.png' border='0' class='js--img--pnghover' /></a>&nbsp;<a href=\"javascript:;\" onclick=\"" + downloadLink + "\" style='vertical-align:super;'>" + "Download this document" + "</a></span>";
    }

    //if (showEmailLink) {
    //    //var showSocialMediaLinks = ($("#divSocialMediaButtonFormats").length > 0);
    //    var showSocialMediaLinks = true;
    //    var linkText = (showSocialMediaLinks ? "Share this document" : GetString("str_Email_EmailThisDocument"));
    //    linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'><a href=\"" + emailLink + "\"><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Email-Small.png' border='0' class='js--img--pnghover' /></a>&nbsp;<a href=\"" + emailLink + "\" style='vertical-align:super;'>" + linkText + "</a></span>";
    //}


    //if new UX then open the react modal
    //new UX...
    if (!Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) && glb_EnableKnotiaNext === 1 && !Globals.Utilities.isUndefinedOrNull(window.currentPage)) {
        emailLink = "#";
        onemailClickFn = 'callKNextStateManagerFunctionIfExists("KnowledgeToolbarBLL", "onShareDocumentClick");';
    }

    if (showEmailLink) {
        var showSocialMediaLinks = ($("#divSocialMediaButtonFormats").length > 0);
        var linkText = (showSocialMediaLinks ? "Share this document" : GetString("str_Email_EmailThisDocument"));
        linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'><a id='showEmailLink' href=\"" + emailLink + "\" onclick='" + onemailClickFn + "' ><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Email-Small.png' border='0' class='js--img--pnghover' /></a>&nbsp;<a href=\"" + emailLink + "\"  onclick='" + onemailClickFn + "' style='vertical-align:super;'>" + linkText + "</a></span>";
    }

    //editLinks exist
    //if (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_EditLinks].length > 0) {
    var isAdministratorLinks = false;

    if (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_EditLinks] != null && document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_EditLinks].length > 0) {
        isAdministratorLinks = true;
    }

    var linkInformation = this.getNewsResearchDocumentLinkThisDocumentLinkInformation(isAdministratorLinks);

    if (linkInformation.link != null) {
        linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>";
        
        if (window.glb_EnableFederatedSearch != null && glb_EnableFederatedSearch) {
            linksAtTopOfDocument += "<span style='white-space: nowrap;'><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Link-Small.png' border='0' class='js--img--pnghover' />&nbsp;&nbsp;<a onclick='currentPage.CommonToolbarBLL.onCreateLinkToDocClick()'><span style='vertical-align: super;'>Link to this document</span></a></span>";
        } else {

            if (linkInformation.link2 == null) {
                linksAtTopOfDocument += "<a href='" + linkInformation.link.target + "' class='js-a-doNotChangeHref' target='_blank'><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Link-Small.png' border='0' class='js--img--pnghover' /></a>&nbsp;<a href='" + linkInformation.link.target + "' class='js-a-doNotChangeHref' style='vertical-align:super;' target='_blank'>" + linkInformation.link.text + "</a>";
                if (linkInformation.link.description != null && linkInformation.link.description.length > 0) {
                    linksAtTopOfDocument += "<span style='vertical-align:super;'> (" + linkInformation.link.description + ")</span>";
                }
                linksAtTopOfDocument += "</span>";
            }
            else {
                ``
                if (linkInformation.link.target.includes("loadDocumentByGotoString")) {
                    //linksAtTopOfDocument += "<a href='#' onclick='window.location='" + linkInformation.link.target + "' class='js-a-doNotChangeHref' target='_self'><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Link-Small.png' border='0' class='js--img--pnghover' /></a>&nbsp;<a href='#' onclick='\"window.location=\"" + linkInformation.link.target + "\"' class='js-a-doNotChangeHref' style='vertical-align:super;' target='_self'>" + linkInformation.link.text + "</a>";
                    linksAtTopOfDocument += "<img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Link-Small.png' border='0' class='js--img--pnghover' />&nbsp;<span style='vertical-align:super;'>" + linkInformation.link.text + ": <a href='#' onclick='" + linkInformation.link.target + "' class='js-a-doNotChangeHref' target='_blank'>" + linkInformation.link.description + "</a> | <a href='" + linkInformation.link2.target + "' class='js-a-doNotChangeHref' target='_blank'>" + linkInformation.link2.description + "</a></span>";
                }

                else {
                    linksAtTopOfDocument += "<img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Link-Small.png' border='0' class='js--img--pnghover' />&nbsp;<span style='vertical-align:super;'>" + linkInformation.link.text + ": <a href='" + linkInformation.link.target + "' class='js-a-doNotChangeHref' target='_blank'>" + linkInformation.link.description + "</a> | <a href='" + linkInformation.link2.target + "' class='js-a-doNotChangeHref' target='_blank'>" + linkInformation.link2.description + "</a></span>";
                }
                linksAtTopOfDocument += "</span>";
            }
        }

    }

    if (isAdministratorLinks) {
        linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>";
        linksAtTopOfDocument += document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_EditLinks].replace(/&nbsp;<a /i, "&nbsp;<a style='vertical-align:super;' ") + "</span>";
    }

    //if new UX send link information to redux state so that we can show it in the new toolbar functionality
    //new UX...
    if (!Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) && glb_EnableKnotiaNext === 1 && !Globals.Utilities.isUndefinedOrNull(window.currentPage)) {
        callKNextStateManagerFunctionIfExists('BLL', 'saveDocumentLinkInformation', linkInformation, linksAtTopOfDocument);
    }

    //}

    //UNCOMMENT THIS FOR THE ADMIN LINK**************************************************************************************************************************************************************
    //var isAdministratorLinks = (sEditLinks.length > 0);
    //var linkInformation = getResearchNewsDocumentLinkThisDocumentLinkInformation(isAdministratorLinks, true);

    //if (linkInformation.link != null) {
    //    linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>";

    //    if (linkInformation.link2 == null) {
    //        linksAtTopOfDocument += "<a href='" + linkInformation.link.target + "' class='js-a-doNotChangeHref' target='_blank'><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Link-Small.png' border='0' class='js--img--pnghover' /></a>&nbsp;<a href='" + linkInformation.link.target + "' class='js-a-doNotChangeHref' style='vertical-align:super;' target='_blank'>" + linkInformation.link.text + "</a>";
    //        if (linkInformation.link.description != null && linkInformation.link.description.length > 0) {
    //            linksAtTopOfDocument += "<span style='vertical-align:super;'> (" + linkInformation.link.description + ")</span>";
    //        }
    //        linksAtTopOfDocument += "</span>";
    //    }
    //    else {
    //        linksAtTopOfDocument += "<img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Link-Small.png' border='0' class='js--img--pnghover' />&nbsp;<span style='vertical-align:super;'>" + linkInformation.link.text + ": <a href='" + linkInformation.link.target + "' class='js-a-doNotChangeHref' target='_blank'>" + linkInformation.link.description + "</a> | <a href='" + linkInformation.link2.target + "' class='js-a-doNotChangeHref' target='_blank'>" + linkInformation.link2.description + "</a></span>";
    //        linksAtTopOfDocument += "</span>";
    //    }
    //}
    //    }
    //    ////view this document in en/fr
    //    //if (sDocumentFlipLink.length > 0) {
    //    //    sIcon = "<img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Link-Small.png' border='0' class='js--img--pnghover' />";
    //    //    indexOfCloseBracket = sDocumentFlipLink.indexOf(">");
    //    //    sLinkWithIcon = sDocumentFlipLink.substr(0, indexOfCloseBracket + 1) + sIcon + "</a>&nbsp;";
    //    //    sDocumentFlipLink = sLinkWithIcon + sDocumentFlipLink.substr(0, indexOfCloseBracket) + " style='vertical-align:super;'" + sDocumentFlipLink.substr(indexOfCloseBracket);
    //    //    linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>" + sDocumentFlipLink + "</span>";
    //    //}
    //    ////edit this document
    //    //if (sEditLinks.length > 0) {
    //    //    indexOfCloseBracket = sEditLinks.indexOf(">", sEditLinks.indexOf(">")); //get the second occurrence of the close bracket
    //    //    //sEditLinks = sEditLinks.substr(0, indexOfCloseBracket) + " style='vertical-align:super;'" + sEditLinks.substr(indexOfCloseBracket);
    //    //    linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>" + sEditLinks + "</span>";
    //    //}

    //}
    //else {
    //else-zilla
    //linksAtTopOfDocument = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'><a href=\"javascript:" + printJSLink + "\"><img src='/Images/Icons/Common/Icon_Print.gif' border='0' /></a>&nbsp;<a href=\"javascript:" + printJSLink + "\" style='vertical-align:super;'>" + GetString("str_Print_PrintThisDocument") + "</a></span>";
    //linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'><a href=\"" + emailLink + "\"><img src='/UserControls/Toolbar/Images/KNOTIAROUND/Icons/Envelope.gif' border='0' /></a>&nbsp;<a href=\"" + emailLink + "\" style='vertical-align:super;'>" + GetString("str_Email_EmailThisDocument") + "</a></span>";
    //if (sDocumentFlipLink.length > 0) {
    //    var linkPattern = new RegExp("<a([^>]*)>[^<]*</a>");
    //    var documentFlipImage = sDocumentFlipLink.replace(linkPattern, "<a$1><img src='/UserControls/Toolbar/Images/KNOTIA/Icons/Link.gif' border='0' class='js--img--pnghover' /></a>&nbsp;");
    //    sDocumentFlipLink = sDocumentFlipLink.replace(/>/, " style='vertical-align:super;'>"); // note: not global, just the first one
    //    sDocumentFlipLink = sDocumentFlipLink.replace(/.<\/a>/, "</a>"); // note: not global, just the first one
    //    linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>" + documentFlipImage + sDocumentFlipLink + "</span>";
    //}
    //if (sEditLinks.length > 0) {
    //    linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>" + sEditLinks + "</span>";
    //}
    //}

    sFinalPageHTML = "<div id='linksAtTopOfDocument' class='no-print'>" + linksAtTopOfDocument + "</div></div>" + sFinalPageHTML;
    return sFinalPageHTML;
}
//DISABLE FOR TNU ARCHIVE ON PRD. THIS IS ONLY FOR BETA

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    KnotiaKnowledge5.DocumentManager.prototype.displayLoadedDocument
//          / this.displayLoadedDocument / document.k5doc.displayLoadedDocument
//
// Desc:    This method will display loaded document
//
// Inputs   iProductID       -- The Product id
//          iBookID      -- The list of nodeIDs
//          iDocumentID      -- The search type (news, notes,...)
//          bIsSearchDocument    -- The search parameters
//          sStylesheet
//          sPageHTML
//          ...
//
// Modified: Has now an Elastic branch
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
KnotiaKnowledge5.DocumentManager.prototype.displayLoadedDocument = function (iProductID, iBookID, iDocumentID, bIsSearchDocument, sStylesheet, sPageHTML, sDocumentFlipLink, sDocumentFooter,
    jumpToParagraphID, jumpToFetchID, aiTOCContext, asTOCContext, sFetchID, footnotes, resolvedLinks, purposeNoteLinks,
    iPreviousDocumentBookID, iPreviousDocumentID, sPreviousDocumentTitle, iNextDocumentBookID, iNextDocumentID, sNextDocumentTitle, sEditLinks,
    doForceLoadNonInline, productLanguage, documentExtraMetadata, dDocumentDate, alertExtraMetadata) {

    this.productID = iProductID;
    this.bookID = iBookID;
    this.documentID = iDocumentID;
    this.fetchID = sFetchID;
    this.isBilingual = false;
    this.stylesheet = sStylesheet;
    this.pageHTML = sPageHTML;
    this.documentFooter = sDocumentFooter;
    this.tocContext = asTOCContext;
    this.canEditDocument = false;
    this.previousDocumentBookID = iPreviousDocumentBookID;
    this.previousDocumentID = iPreviousDocumentID;
    this.previousDocumentTitle = sPreviousDocumentTitle;
    this.nextDocumentBookID = iNextDocumentBookID;
    this.nextDocumentID = iNextDocumentID;
    this.nextDocumentTitle = sNextDocumentTitle;
    this.documentDate = dDocumentDate;

    //if new UX make call to clear document state in redux
    //new UX...
    if (!Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) && glb_EnableKnotiaNext === 1 && !Globals.Utilities.isUndefinedOrNull(window.currentPage)) {
        callKNextStateManagerFunctionIfExists('BLL', 'clearDocumentState');
    }

    if (iProductID > 0) {
        // an error document does not pass JSON for these
        this.footnotes = Globals.Json.translateWCFHTToJSHT(footnotes);
        this.resolvedLinks = Globals.Json.translateWCFHTToJSHT(resolvedLinks);
        this.purposeNoteLinks = Globals.Json.translateWCFHTToJSHT(purposeNoteLinks);
    }

    if (documentExtraMetadata != null) {
        this.extraMetadata = Globals.Json.translateWCFHTToJSHT(documentExtraMetadata);
    }

    if (alertExtraMetadata != null) {
        this.alertExtraMetadata = Globals.Json.translateWCFHTToJSHT(alertExtraMetadata)
    }

    if (productLanguage != null) {
        this.productLanguage = productLanguage;
    }

    if (asTOCContext == null && aiTOCContext == null) {
        asTOCContext = [];
        aiTOCContext = [];
    }

    var bIsBrowsingOnly = false;
    if (asTOCContext[0] == "Canadian Tax Foundation Materials" && iProductID == 1189) {
        sPageHTML = getAltDocumentBody(this.fetchID);
        bIsBrowsingOnly = true;
    }

    var isNewsDocument = (this.collectionType == KnotiaKnowledge5.CollectionType.News);
    var documentBodyForAlert = $("#documentBodyForAlert_" + this.documentID.toString());
    var isInlineViewOfNewsDocument = (!doForceLoadNonInline && documentBodyForAlert.length > 0);

    var sFinalPageHTML = sPageHTML;

    var doNotPrintLinks = "";
    try {
        $(sFinalPageHTML).each(function () {
            var element = $(this);
            if (element.attr("id") == "doNotPrintLinksAtDocumentTop") {
                doNotPrintLinks += "<span style='white-space:nowrap;'>" + element.html() + "</span>";
            }
        });
    }
    catch (exc) {
        // ignore, happens for error documents
    }

    var linksAtTopOfDocument = "<div id='doNotPrintLinksAtDocumentTop' class='showScreenHidePrint js--keep-this-one'>" + doNotPrintLinks;

    var statusMessage_line1 = "Please note that EY's International Tax Online Reference Service (ITORS) is no longer being updated. The tool was last updated as of Q4 2020(31 December 2020)."
    var statusMessage_ITORS = "<span id='statusMessageITORS' class='showStatusMessageITORS'>" + statusMessage_line1 + "</span>";

    //ONLY ITORS GETS THIS STATUS MESSAGE
    if (iProductID == 3) {
        linksAtTopOfDocument += statusMessage_ITORS;
    }

    //Links displayed at the beginning of a document.
    if (isNewsDocument) {// NEWS specific document links that are displayed at the top
        var alertTitle, alertNumber, alertDate;
        if (this.extraMetadata["AlertTitle"] && this.extraMetadata["AlertTitle"] && this.extraMetadata["AlertTitle"]) {
            alertTitle = this.extraMetadata["AlertTitle"].replace(/'/g, "\\'").replace(/"/g, "&#x22;");
            alertNumber = this.extraMetadata["AlertNumber"];
            alertDate = this.extraMetadata["AlertDate"];
        }
        else {
            if (asTOCContext.length > 0) {
                alertTitle = asTOCContext[asTOCContext.length - 1].replace(/'/g, "\\'").replace(/"/g, "&#x22;");
            }
        }

        var downloadLink = "javascript:document.k5doc.downloadNewsDocument(" + this.documentID.toString() + ", '" + alertTitle + "', '" + alertNumber + "', '" + alertDate + "')";

        var emailLink;
        if (document.k5doc.extraMetadata["IsInternalOnlyContent"] == "true" && document.k5doc.extraMetadata["IsExternalAndInternalContent"] != "true") {
            emailLink = null;
        }
        else {
            var twitterLink = (this.extraMetadata["TwitterLink"] ? ", '" + this.extraMetadata["TwitterLink"] + "'" : ", null");
            var linkedInLink = (this.extraMetadata["LinkedInLink"] ? ", '" + this.extraMetadata["LinkedInLink"] + "'" : ", null");
            var facebookLink = (this.extraMetadata["FacebookLink"] ? ", '" + this.extraMetadata["FacebookLink"] + "'" : ", null");
            emailLink = "javascript:document.k5doc.emailNewsDocument(" + false + ", " + this.documentID.toString() + ", '" + alertTitle + "', '" + alertNumber + "', '" + alertDate + "'" + twitterLink + linkedInLink + facebookLink + ")";
        }

        var printJSLink;
        if (isInlineViewOfNewsDocument) {
            printJSLink = "document.k5doc.printInlineNewsDocument(" + this.documentID + ");";

        }
        else {
            printJSLink = "callStateManagerFunctionIfExists('doPrint', 0);";
        }

        var sIcon, indexOfCloseBracket, sLinkWithIcon, newsDocumentLinks = "";
        //IF-zilla
        if (Globals.UI.isSiteThemeEnabled()) {
            if (isInlineViewOfNewsDocument || callStateManagerFunctionIfExists("useBucketTreeview")) {

                //download document
                var showDownloadDocumentLinks = ($("#divDownloadButtonFormats").length > 0);
                var showEmailLink = (emailLink != null);

                if (typeof (glb_SiteType) != "undefined" && glb_SiteType == Globals.SiteType.GWTR) {
                    showDownloadDocumentLinks = false;
                    showEmailLink = false;
                }

                //show print this document/email this document for inline news document
                linksAtTopOfDocument += "<span style='white-space:nowrap;'><a href=\"javascript:;\" onclick=\"" + printJSLink + "\"><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Print-Small.png' border='0' class='js--img--pnghover'/></a>&nbsp;<a href=\"javascript:;\" onclick=\"" + printJSLink + "\" style='vertical-align:super;'>" + GetString("str_Print_PrintThisDocument") + "</a></span>";

                //download document
                //var showDownloadDocumentLinks = ($("#divDownloadButtonFormats").length > 0);

                if (showDownloadDocumentLinks) {
                    linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'><a href=\"" + downloadLink + "\"><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Download.png' border='0' class='js--img--pnghover' /></a>&nbsp;<a href=\"" + downloadLink + "\" style='vertical-align:super;'>" + "Download this document" + "</a></span>";
                }

                if (showEmailLink) {
                    var showSocialMediaLinks = ($("#divSocialMediaButtonFormats").length > 0);
                    var linkText = (showSocialMediaLinks ? "Share this document" : GetString("str_Email_EmailThisDocument"));
                    linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'><a href=\"" + emailLink + "\"><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Email-Small.png' border='0' class='js--img--pnghover' /></a>&nbsp;<a href=\"" + emailLink + "\" style='vertical-align:super;'>" + linkText + "</a></span>";
                }

                if (callStateManagerFunctionIfExists("useBucketTreeview")) {
                    var isAdministratorLinks = (sEditLinks.length > 0);
                    var linkInformation = this.getNewsDocumentLinkThisDocumentLinkInformation(isAdministratorLinks);

                    if (linkInformation.link != null) {
                        linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>";

                        if (linkInformation.link2 == null) {
                            linksAtTopOfDocument += "<a href='" + linkInformation.link.target + "' class='js-a-doNotChangeHref' target='_blank'><img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Link-Small.png' border='0' class='js--img--pnghover' /></a>&nbsp;<a href='" + linkInformation.link.target + "' class='js-a-doNotChangeHref' style='vertical-align:super;' target='_blank'>" + linkInformation.link.text + "</a>";
                            if (linkInformation.link.description != null && linkInformation.link.description.length > 0) {
                                linksAtTopOfDocument += "<span style='vertical-align:super;'> (" + linkInformation.link.description + ")</span>";
                            }
                            linksAtTopOfDocument += "</span>";
                        }
                        else {
                            linksAtTopOfDocument += "<img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Link-Small.png' border='0' class='js--img--pnghover' />&nbsp;<span style='vertical-align:super;'>" + linkInformation.link.text + ": <a href='" + linkInformation.link.target + "' class='js-a-doNotChangeHref' target='_blank'>" + linkInformation.link.description + "</a> | <a href='" + linkInformation.link2.target + "' class='js-a-doNotChangeHref' target='_blank'>" + linkInformation.link2.description + "</a></span>";
                            linksAtTopOfDocument += "</span>";
                        }
                    }
                }
            }
            //view this document in en/fr
            if (sDocumentFlipLink.length > 0) {
                sIcon = "<img src='/UserControls/Toolbar/Images/" + window.glb_SiteStyle + "/Icons/Flat-Link-Small.png' border='0' class='js--img--pnghover' />";
                indexOfCloseBracket = sDocumentFlipLink.indexOf(">");
                sLinkWithIcon = sDocumentFlipLink.substr(0, indexOfCloseBracket + 1) + sIcon + "</a>&nbsp;";
                sDocumentFlipLink = sLinkWithIcon + sDocumentFlipLink.substr(0, indexOfCloseBracket) + " style='vertical-align:super;'" + sDocumentFlipLink.substr(indexOfCloseBracket);
                linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>" + sDocumentFlipLink + "</span>";
            }
            //edit this document
            if (sEditLinks.length > 0) {
                indexOfCloseBracket = sEditLinks.indexOf(">", sEditLinks.indexOf(">")); //get the second occurrence of the close bracket
                //sEditLinks = sEditLinks.substr(0, indexOfCloseBracket) + " style='vertical-align:super;'" + sEditLinks.substr(indexOfCloseBracket);
                linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>" + sEditLinks + "</span>";
            }

        }
        else {
            //else-zilla
            linksAtTopOfDocument = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'><a href=\"javascript:;\" onclick=\"" + printJSLink + "\"><img src='/Images/Icons/Common/Icon_Print.gif' border='0' /></a>&nbsp;<a href=\"javascript:;\" onclick=\"" + printJSLink + "\" style='vertical-align:super;'>" + GetString("str_Print_PrintThisDocument") + "</a></span>";
            linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'><a href=\"" + emailLink + "\"><img src='/UserControls/Toolbar/Images/KNOTIAROUND/Icons/Envelope.gif' border='0' /></a>&nbsp;<a href=\"" + emailLink + "\" style='vertical-align:super;'>" + GetString("str_Email_EmailThisDocument") + "</a></span>";
            if (sDocumentFlipLink.length > 0) {
                var linkPattern = new RegExp("<a([^>]*)>[^<]*</a>");
                var documentFlipImage = sDocumentFlipLink.replace(linkPattern, "<a$1><img src='/UserControls/Toolbar/Images/KNOTIA/Icons/Link.gif' border='0' class='js--img--pnghover' /></a>&nbsp;");
                sDocumentFlipLink = sDocumentFlipLink.replace(/>/, " style='vertical-align:super;'>"); // note: not global, just the first one
                sDocumentFlipLink = sDocumentFlipLink.replace(/.<\/a>/, "</a>"); // note: not global, just the first one
                linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>" + documentFlipImage + sDocumentFlipLink + "</span>";
            }
            if (sEditLinks.length > 0) {
                linksAtTopOfDocument += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='white-space:nowrap;'>" + sEditLinks + "</span>";
            }
        }

        sFinalPageHTML = linksAtTopOfDocument + "</div>" + sFinalPageHTML;
    }
    else {

        var turnOnNewsLinks = true;

        //Only TNU + GTNU for now. If we expand, then add this as a siteconfiguration item and return from db whether this site has access to these news links
        if (this.collectionType == KnotiaKnowledge5.CollectionType.Collection && (this.productID == 27 || this.productID == 29 || this.productID == 28 || this.productID == 30) && turnOnNewsLinks) {
            var researchNewslinksAtTopOfDocument = getResearchNewslinksAtTopOfDocument(asTOCContext, sFinalPageHTML, sEditLinks);

            sFinalPageHTML = researchNewslinksAtTopOfDocument;
        }

        else {

            if (this.productID === 645) {
                sFinalPageHTML = sFinalPageHTML.replace(/<P CLASS='Left10[a-z][a-z]'><A HREF=.*?<\/A><\/P>/g, '');
            }
            if (this.productID === 645 && this.fetchID === 'ITA') {
                sFinalPageHTML = sFinalPageHTML.replace(/For more details on each of these proposed amendments, see the.*?table./, '');
            }

            if (this.collectionType == KnotiaKnowledge5.CollectionType.MyNotes && this.productID != 0) {
                var productName = callStateManagerFunctionIfExists("getProductNameForMyNotesDocument");
                if (productName == null) {
                    productName = "";
                    //window.setTimeout("document.k5doc.delayedDisplayProductName();", 500);
                    window.setTimeOut(function () { document.k5doc.delayedDisplayProductName(); }, 500);
                }

                linksAtTopOfDocument += "<p class='small' style='white-space:nowrap;'><a href='Home.aspx?ProductID=" + this.productID.toString() + "&FetchID=" + encodeURIComponent(this.fetchID) + "'><img src='/UserControls/Toolbar/Images/KNOTIAFLAT/Icons/Flat-Link-Small.png' border=0 /></a>&nbsp;&nbsp;<a style='vertical-align:super;' href='Home.aspx?ProductID=" + this.productID.toString() + "&FetchID=" + encodeURIComponent(this.fetchID) + "'>" + GetString("str_GoToThisDocumentIn") + " <span id='productNameForLinkToCollection'>" + productName + "</span></a></p>";
            }
            if (sDocumentFlipLink.length > 0 && this.productID !== 645) {
                linksAtTopOfDocument += "<p class='small' style='white-space:nowrap;'>" + sDocumentFlipLink + "</p>";
            }
            if (sEditLinks.length > 0) {
                linksAtTopOfDocument += "<p class='small' style='white-space:nowrap;'>" + sEditLinks.replace(/&nbsp;<a /i, "&nbsp;<a style='vertical-align:super;' ") + "</p>";
            }
            linksAtTopOfDocument += "</div>";
            sFinalPageHTML = linksAtTopOfDocument + sFinalPageHTML;
        }
        //DISABLE FOR TNU ARCHIVE ON PRD. THIS IS ONLY FOR BETA

        //**

        //ORIGINAL - THIS STAYS ON PRD
        //if (this.collectionType == KnotiaKnowledge5.CollectionType.MyNotes && this.productID != 0) {
        //    var productName = callStateManagerFunctionIfExists("getProductNameForMyNotesDocument");
        //    if (productName == null) {
        //        productName = "";
        //        //window.setTimeout("document.k5doc.delayedDisplayProductName();", 500);
        //        window.setTimeOut(function () { document.k5doc.delayedDisplayProductName(); }, 500);
        //    }

        //    linksAtTopOfDocument += "<p class='small' style='white-space:nowrap;'><a href='Home.aspx?ProductID=" + this.productID.toString() + "&FetchID=" + encodeURIComponent(this.fetchID) + "'><img src='/UserControls/Toolbar/Images/KNOTIAFLAT/Icons/Flat-Link-Small.png' border=0 /></a>&nbsp;&nbsp;<a style='vertical-align:super;' href='Home.aspx?ProductID=" + this.productID.toString() + "&FetchID=" + encodeURIComponent(this.fetchID) + "'>" + GetString("str_GoToThisDocumentIn") + " <span id='productNameForLinkToCollection'>" + productName + "</span></a></p>";
        //}
        //if (sDocumentFlipLink.length > 0) {
        //    linksAtTopOfDocument += "<p class='small' style='white-space:nowrap;'>" + sDocumentFlipLink + "</p>";
        //}
        //if (sEditLinks.length > 0) {
        //    linksAtTopOfDocument += "<p class='small' style='white-space:nowrap;'>" + sEditLinks.replace(/&nbsp;<a /i, "&nbsp;<a style='vertical-align:super;' ") + "</p>";
        //}
        //linksAtTopOfDocument += "</div>";
        //sFinalPageHTML = linksAtTopOfDocument + sFinalPageHTML;
        //ORIGINAL - THIS STAYS ON PRD
    }

    if (sDocumentFooter != null) {
        sFinalPageHTML = sFinalPageHTML + "<p class=medium>&nbsp;</p><p class=medium>" + sDocumentFooter + "</p>";
    }
    var doEnableHighlightingNotes = false;
    if (this.collectionType == KnotiaKnowledge5.CollectionType.News) {
        var isAdministratorLinks = (sEditLinks.length > 0);
        var linkInformation = this.getNewsDocumentLinkThisDocumentLinkInformation(isAdministratorLinks);

        if (linkInformation.doShowFIDOText) {
            var firstOpenParagraph = new RegExp("<p", "i"); // flags doesn't include global, only do once = find first
            sFinalPageHTML = sFinalPageHTML.replace(firstOpenParagraph, "<p class='small noPadding' style='margin-top:0px;'>FOR INTERNAL DISTRIBUTION ONLY</p><p");
        }

        if (!callStateManagerFunctionIfExists("useBucketTreeview")) {
            sFinalPageHTML += "<p class='medium'><a href=\"" + linkInformation.link.target + "\" class='js-a-doNotChangeHref' style=\"text-decoration:none;\" target='_blank'>" + linkInformation.link.text + "</a>" + linkInformation.link.description + "</span></p>";
        }

        if (document.siteConfiguration.isTabularNewsResultsLists) {
            sFinalPageHTML = "<div class='newsDocumentBody'>" + sFinalPageHTML + "</div>";
        }
    }
    else {
        if (callStateManagerFunctionIfExists("isInDocumentOnlyView")) {
            sFinalPageHTML = "<p class='medium' align='right' id='pLinkToNavigation'><a href='/Knowledge/Home.aspx?ProductID=" + this.productID.toString() + "&FetchID=" + encodeURIComponent(this.fetchID) + "'>Show product navigation</a></p>" + sFinalPageHTML;
        }
        else {
            if (this.fetchID != null) {
                sFinalPageHTML += "<p class=medium>&nbsp;</p><p class=medium><span class=graymedium>" + GetString("str_DocumentID") + " <a href=\"/Knowledge/Home.aspx?ProductID=" + this.productID.toString() + "&FetchID=" + encodeURIComponent(this.fetchID) + "\"  style=\"text-decoration:none;\" class=graymedium>" + this.fetchID + "</a></span></p>";
            }
            doEnableHighlightingNotes = true;
        }
    }

    var sTOCContext = "";
    var asTOCContextLength = asTOCContext.length;

    //new UX...
    if (!Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) && glb_EnableKnotiaNext === 1 && !Globals.Utilities.isUndefinedOrNull(window.currentPage)) {
        if (asTOCContext != null && asTOCContext.length > 0) {
            var sTOCContextTitle = "";

            for (var i = 0; i < asTOCContextLength; i++) {
                sTOCContext = sTOCContext + asTOCContext[i] + ' <i class=\"fal fa-angle-double-right\"></i> ';
                sTOCContextTitle = sTOCContextTitle + asTOCContext[i] + " &gt;&gt; ";
            }
            sTOCContext = sTOCContext.substring(0, sTOCContext.length - 42); // remove last icon
            sTOCContextTitle = sTOCContextTitle.substring(0, sTOCContextTitle.length - 10); // remove trailing " &gt;&gt; "
            sTOCContext = "<div class='document-title-wrapper'><span title=\"" + sTOCContextTitle + "\" class=\"DocumentContext\">" + sTOCContext + "</span></div>";
        }
    }
    else {
        if (asTOCContext != null && asTOCContext.length > 0) {
            //for (var i in asTOCContext){
            for (var i = 0; i < asTOCContextLength; i++) {
                sTOCContext = sTOCContext + asTOCContext[i] + " &gt;&gt; ";
            }
            sTOCContext = sTOCContext.substring(0, sTOCContext.length - 10); // remove trailing " &gt;&gt; "
            sTOCContext = "<div class='document-title-wrapper'><span title=\"" + sTOCContext + "\" class=\"DocumentContext\">" + sTOCContext + "</span></div>";
        }
    }


    // STYLESHEETS - Adds any document stylesheets if it does not already exists.  
    // Assumes the sStylesheet contains the full path of the CSS file including the
    // versioning.
    if (sStylesheet && !this.elementExists('link[href="' + sStylesheet + '"]')) {

        var css = callStateManagerFunctionIfExists("getDynamicStylesheet", "DocumentStylesheet");

        if (sStylesheet.length > 0 && sStylesheet != css.href.toString()) {
            css.href = sStylesheet;
        }
    }

    if (!isInlineViewOfNewsDocument) {
        this.contextControlJqueryObject.show();
    }

    callStateManagerFunctionIfExists("setDocumentPageType");

    if (isInlineViewOfNewsDocument) {
        // enable share menu ?? .setDocumentPageType();
        this.displayDocumentAsInlineSearchResult(documentBodyForAlert, sFinalPageHTML, aiTOCContext);
    }
    else {
        callStateManagerFunctionIfExists("updateDocumentBody", sFinalPageHTML, sTOCContext);
        var bSearchBarVisible = true;
        if (document.getElementById("divSearchBar") == null) {
            bSearchBarVisible = false;
        }
        else if (document.getElementById("divSearchBar").style.display == "none") {
            bSearchBarVisible = false;
        }

        if (!bSearchBarVisible) {
            this.removeAnnotationsLinks();
        }
    }
    $("p#doNotPrintLinksAtDocumentTop").remove();

    if (isNewsDocument) {
        var newsLinksThatShouldBeSmarter = $("#divBodyContent").find("a[href*='/news/']");
        newsLinksThatShouldBeSmarter.each(function () {
            if (!$(this).hasClass("js-a-doNotChangeHref")) { // don't change navigation links
                var linkComponents = $(this).attr("href");
                if (linkComponents != null) {
                    linkComponents = linkComponents.split("/");

                    if (linkComponents[2].toLowerCase().indexOf(".ey.com") >= 0) { // only convert ey.com links (hopefully goes to tnu, gtnu, taxnews, globaltaxnews)

                        //barb wants these links to be external instead of loading within the same page in taxnav
                        //now Elena/Nicky want this fix in Knotia. I am considering making this a site-wide fix, leaving it hard-coded to two sites for now while I monitor this issue.
                        if ((linkComponents[2].toLowerCase().indexOf("taxnews.ey.com") >= 0)
                            && (glb_SiteType == 2 || glb_SiteType == 6 || glb_SiteType == 14 || glb_SiteType == 18)) {
                            //do nothing for now
                        }

                        else {
                            var linkAlertNumber = linkComponents[linkComponents.length - 1];

                            var indexOfSecondDash = linkAlertNumber.indexOf("-", linkAlertNumber.indexOf("-") + 1);

                            if (indexOfSecondDash != -1) {
                                linkAlertNumber = linkAlertNumber.substring(0, indexOfSecondDash);
                            }

                            var searchType = "";
                            if (Globals.Utilities.isUndefinedOrNull(document.initAlertIsExternal)) {
                                searchType = "doNewsSearchByNumber";
                            }
                            else {
                                searchType = "doNewsSearchByExternalNumber";

                            }

                            $(this).attr("href", "#");
                            $(this).attr("onClick", "javascript:callStateManagerFunctionIfExists('" + searchType + "', '" + linkAlertNumber + "');");
                            $(this).removeAttr("target");
                        }

                    }
                }
            }
        });
    }

    // Stinson: if a hidden span with this ID is embedded in the document, it contains a javascript function call to call -- implemented for topical index documents in FITAC
    if ($("#nameOfJavascriptFunctionToExecuteAfterDocumentLoad").length > 0) {

        window.setTimeout($("#nameOfJavascriptFunctionToExecuteAfterDocumentLoad").text(), 1); // 1ms, run immediately
        //window.setTimeout(function () { $("#nameOfJavascriptFunctionToExecuteAfterDocumentLoad").text() }, 1); // 1ms, run immediately
    }
    else if ($(".oneOfManyJavascriptFunctionsToExecuteAfterDocumentLoad").length > 0) {
        var anchorPointOfNodeClick = $("a[name=para_" + jumpToParagraphID.toString() + "]");

        var topOfParagraphForClickedNode = $("#divBodyContent").find("a[name=para_" + jumpToParagraphID.toString() + "]").offset().top;

        $(".oneOfManyJavascriptFunctionsToExecuteAfterDocumentLoad").each(function () {
            if ($(this).offset().top >= topOfParagraphForClickedNode) {
                // this is the next fetch after the clicked node, execute the function
                var command = $(this).text();
                window.setTimeout(command, 1); // 1ms, run immediately
                topOfParagraphForClickedNode = 999999999;
                $(this).after("<p>The link was opened in a new browser tab or window (unless it was blocked by a popup blocker).</p>");
            }
        });
    }

    if (!bIsBrowsingOnly) {
        this.createHistoryBlocks();
    }

    if (this.collectionType == KnotiaKnowledge5.CollectionType.Briefcase || this.collectionType == KnotiaKnowledge5.CollectionType.MyNotes) {
        callStateManagerFunctionIfExists("setActiveTreeviewNode");
    }
    else {
        if (aiTOCContext.length > 0) {
            var aiTOCContextNew = [];

            Globals.Utilities.arrayPush(aiTOCContextNew, -1000); // toc context should actually start with the root node
            if (this.collectionType == KnotiaKnowledge5.CollectionType.SearchAll) {
                // search all, toc context should also start with the product node, and the nodes within the product include the productID
                Globals.Utilities.arrayPush(aiTOCContextNew, this.productID * 10000000000);
                var aiTOCContextLength = aiTOCContext.length;
                //for (var i in aiTOCContext) {
                for (var i = 0; i < aiTOCContextLength; i++) {
                    Globals.Utilities.arrayPush(aiTOCContextNew, aiTOCContext[i] + this.productID * 10000000000);
                }

                aiTOCContext = aiTOCContextNew;
            }
            else {
                // regular toc, just put the -1000 node at the beginning
                aiTOCContext = aiTOCContextNew.concat(aiTOCContext);
            }

            callStateManagerFunctionIfExists("setActiveTreeviewNode", aiTOCContext);
        }
    }

    callStateManagerFunctionIfExists("createDisplayedDocumentNavigation");
    if (bIsSearchDocument || isInlineViewOfNewsDocument) {
        //@ELASTIC
        if (useElasticsearch()) {
            //new UX
            if (!Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) && glb_EnableKnotiaNext === 1 && !Globals.Utilities.isUndefinedOrNull(window.currentPage)) {

                //check if we have search results navigation for next page
                document.k5search.checkAndUpdateSearchResultNavigationAndCallNewUX();

            } else {
                this.createDocumentSearchNavigationElastic();
            }
        }
        else {

            //new UX 
            //if searchtype is KnotiaKnowledge5.SearchType.NewsSearchDateRange or KnotiaKnowledge5.SearchType.SimpleNews or KnotiaKnowledge5.SearchType.NewsSearchPastNDays
            if (!Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) && glb_EnableKnotiaNext === 1 && !Globals.Utilities.isUndefinedOrNull(window.currentPage) && (document.k5search.searchType === KnotiaKnowledge5.SearchType.NewsSearchDateRange || document.k5search.searchType === KnotiaKnowledge5.SearchType.SimpleNews || document.k5search.searchType === KnotiaKnowledge5.SearchType.NewsSearchPastNDays || document.k5search.searchType === KnotiaKnowledge5.SearchType.AdvancedNews)) {
                callKNextStateManagerFunctionIfExists('BLL', 'renderSearchHitsNavigation');
            } else {
                this.createDocumentSearchNavigation();
            }
        }

        callStateManagerFunctionIfExists("addToViewedSearchResults", this.bookID, this.documentID);
    }
    else if (this.collectionType == KnotiaKnowledge5.CollectionType.MyNotes) {
        var documentNavigation;
        if (callStateManagerFunctionIfExists("isInSearch")) {
            //@ELASTIC
            if (useElasticsearch()) {
                documentNavigation = callStateManagerFunctionIfExists("createMyNotesSearchNavigationElastic", this.bookID, this.documentID, this.specifiedHitParagraphs);
            }
            else {
                documentNavigation = callStateManagerFunctionIfExists("createMyNotesSearchNavigation", this.bookID, this.documentID, this.specifiedHitParagraphs);
            }

            
        }
        else {
            documentNavigation = this.createMyNotesDocumentNavigation();
        }

        callStateManagerFunctionIfExists("updateDocumentBodyNavigation", documentNavigation);
        delegateSwipeEvent(this.controlJqueryObject.attr("id"), 'prevDocument', 'nextDocument');
    }
    else if (this.collectionType == KnotiaKnowledge5.CollectionType.Briefcase) {
        this.createBriefcaseNavigation();
    }
    else {
        this.createDocumentNavigation();
    }

    if (isInlineViewOfNewsDocument) {
        this.scrollToTopOfInlineSearchResult();
    }
    else if (jumpToParagraphID > 1) {

        this.jumpAfterImagesLoaded(jumpToParagraphID, jumpToFetchID);
    }
    else if (this.specifiedHitParagraphs.length > 0) {
        this.jumpAfterImagesLoaded();
    }
    else if (document.getElementById("hh_1") != null && !this.suppressAutoScrollToHitHighlight) {
        this.jumpAfterImagesLoaded();
    }
    else {
        this.jumpAfterImagesLoaded(1);
    }
    this.displayExistingTagsForActiveDocument();

    //@ CHANGE FOR JQUERY 3.6
    //if (!$.browser.msie) {
    if (!Globals.Utilities.isIE()) {
        $('.hoverMetadata').css('display', 'inline-block');
    }
    else {
        $('.hoverMetadata').css('display', 'inline');
    }
    this.hideInaccessibleLinks();

    var existsPurposeNoteLinks = false;

    for (var key in this.purposeNoteLinks) {
        existsPurposeNoteLinks = true;
        //set that it exists since if we have something that has a lot of purpose note link it will loop
        //the array for no reason and setting the existsPurposeNoteLinks variable to true a few times too many.
        break;
    }

    if (existsPurposeNoteLinks) {
        $("#divBodyContent").find("a[onmouseover^='CreateFetchLink']").tooltip();
    }

    this.controlJqueryObject.show();

    callStateManagerFunctionIfExists("annotationsBoxInit", false);

    $(window).resize(function () {
        callStateManagerFunctionIfExists("annotationsBoxInit", true);
    });

    if (doEnableHighlightingNotes) {
        callStateManagerFunctionIfExists("enableHighlightingNotes", this.productID, this.bookID, this.documentID, this.specialJumpToInformation);
    }

    if (this.collectionType == KnotiaKnowledge5.CollectionType.News) {
        var isMobileNewsBehaviour = callStateManagerFunctionIfExists("isMobileNewsBehaviour");
        if (isMobileNewsBehaviour) {
            $(".newsResultHeader").hide();
            $(".newsResultSystemLevelHeaderTitle").hide();
            $(".newsResultSubCategoryHeaderTitle").hide();

            var newsResultDocTitle = $(".newsResultDocTitle");
            newsResultDocTitle.find("img").remove();
            newsResultDocTitle.off("mouseover");
            newsResultDocTitle.off("mouseout");
            newsResultDocTitle.css("text-indent", "0px");
            newsResultDocTitle.find("span").css("cursor", "auto");
            var clickableNewsResultDocTitle = newsResultDocTitle.find(".clickableNewsResultDocTitle");
            clickableNewsResultDocTitle.removeAttr("onclick");
            clickableNewsResultDocTitle.removeClass("clickableNewsResultDocTitle");
        }

        this.controlJqueryObject.find("a[href^='/news/']").each(function () { // ^= is starts with
            if (!$(this).hasClass("js-a-doNotChangeHref")) { // don't change navigation links
                var linkHref = $(this).attr("href").substr(6); // remove /news/
                var numberComponents = linkHref.split("-");
                if (numberComponents.length >= 2) {
                    $(this).attr("href", "javascript:callStateManagerFunctionIfExists('doNewsSearchByNumber', '" + numberComponents[0] + "-" + numberComponents[1] + "');");
                }
            }
        })
    }

    var icon = $(".JS-IMG-Icon");
    if (icon.length > 0) {
        icon.attr("title", GetString("str_DocNav_seeFutureApplication"));
        icon.tooltip();

        if (icon.parent()[0].tagName.toLowerCase() == "a") {
            var paragraphID = parseInt(icon.parent().parent().parent().attr("id").substr(4), 10); // icon > a > p > div; remove el_P
            icon.parent().attr("href", "javascript:;");
            icon.parent().on("click", function (event) {
                document.k5doc.scrollToNextFutureApplication(event, paragraphID);
            });
        }
    }

    //window.setTimeout("document.k5doc.balanceFixedTdWidths();", 100);
    window.setTimeout(function () { document.k5doc.balanceFixedTdWidths(); }, 100);

    var interactiveFormulas = $(".js--activateInteractiveFormula");
    if (interactiveFormulas.length > 0) {
        activateInteractiveFormulas(interactiveFormulas); // OnlineCalculators.js
    }

    //new UX
    //if (!Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) && glb_EnableKnotiaNext === 1 && !Globals.Utilities.isUndefinedOrNull(window.currentPage)) {
    //    callKNextStateManagerFunctionIfExists('BLL', 'onDocumentLoaded');
    //}

};

KnotiaKnowledge5.DocumentManager.prototype.balanceFixedTdWidths = function () {
    tablesToRebalanceWidthsFor = {};
    var availableWidth;

    var tablesWithWidth100Percent = this.controlJqueryObject.find("table[width='100%']");

    if (tablesWithWidth100Percent.length <= 1) {
        return;
    }

    var addFunction = function (a, b) { return a + b; };

    tablesWithWidth100Percent.each(function () {
        availableWidth = $(this).width();

        var firstRow = $(this).find("tr").filter(":first");

        var specifiedTdWidths = [];

        firstRow.find("td").each(function () {
            var widthAttribute = parseInt($(this).attr("width"), 10);
            specifiedTdWidths.push(widthAttribute);
        });

        var sumOfTdWidths = specifiedTdWidths.reduce(addFunction);

        if (sumOfTdWidths != NaN) {
            if (sumOfTdWidths > availableWidth) {
                // all widths are specified, and exceeds available width, need to rebalance if others exist with same specs
                var key = specifiedTdWidths.join("_");
                if (!tablesToRebalanceWidthsFor[key]) {
                    tablesToRebalanceWidthsFor[key] = [];
                }
                tablesToRebalanceWidthsFor[key].push($(this));
            }
            else if (sumOfTdWidths < availableWidth) {
                var cellpadding = parseInt($(this).attr("cellpadding"), 10);
                if (cellpadding == NaN) {
                    cellpadding = 0;
                }

                var border = parseInt($(this).attr("border"), 10);
                if (border == NaN) {
                    border = 0;
                }

                sumOfTdWidths = sumOfTdWidths + (cellpadding * specifiedTdWidths.length * 2) + (border * specifiedTdWidths.length * 2);
                // don't do this, as most tables that get migrated have table-width 100%, and fixed column widths
                //$(this).attr("width", sumOfTdWidths.toString() + "px");
            }
        }
    });

    for (var key in tablesToRebalanceWidthsFor) {
        var specifiedTdWidths = key.split("_");
        for (var i = 0; i < specifiedTdWidths.length; i++) {
            specifiedTdWidths[i] = parseInt(specifiedTdWidths[i], 10);
        }

        var tablesToFix = tablesToRebalanceWidthsFor[key];
        if (tablesToFix.length > 1) {
            // multiple tables with the same specs, but they don't fit, so they might be balanced differently, rebalance so they all match
            var sumOfTdWidths = specifiedTdWidths.reduce(addFunction);

            for (var i = 0; i < specifiedTdWidths.length; i++) {
                var thisTdWidth = 100 * specifiedTdWidths[i] / sumOfTdWidths;

                for (var j = 0; j < tablesToFix.length; j++) {
                    tablesToFix[j].find("tr td:nth-child(" + (i + 1).toString() + ")").width(thisTdWidth.toString() + "%");
                }
            }

        }
    }

};

KnotiaKnowledge5.DocumentManager.prototype.scrollToNextFutureApplication = function (event, paragraphID) {
    var jumpToParagraphID = paragraphID + 1;

    while ($("#el_P" + jumpToParagraphID.toString()).length > 0) {
        var jumpToParagraph = $("#js-p-showHide1Paragraph-" + jumpToParagraphID.toString());
        if (jumpToParagraph.length > 0) {
            var scrollBy = jumpToParagraph.offset().top - $("#el_P" + paragraphID.toString()).offset().top;
            this.controlJqueryObject.scrollTop(this.controlJqueryObject.scrollTop() + scrollBy);
            return;
        }

        jumpToParagraphID += 1;
    }
};

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    elementExists
//
// Description: 
//          Checks if any element exists that matches the jQuery selector. 
//
// Parameters: 
//          selector - jQuery selector.
//
// Returns: True there is an element that matches the selector, else false.
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
KnotiaKnowledge5.DocumentManager.prototype.elementExists = function (selector) {
    return $(selector).length > 1;
};
var productName = callStateManagerFunctionIfExists("getProductNameForMyNotesDocument");
if (productName == null) {

    KnotiaKnowledge5.DocumentManager.prototype.delayedDisplayProductName = function () {
        //window.setTimeout("document.k5doc.delayedDisplayProductName();", 500);
        window.setTimeout(function () { document.k5doc.delayedDisplayProductName(); }, 500);
        return;
    }

    //$("#productNameForLinkToCollection").text(productName);

};

KnotiaKnowledge5.DocumentManager.prototype.downloadNewsDocument = function (newsDocumentID, newsDocumentTitle, newsDocumentNumber, newsDocumentDate) {
    callStateManagerFunctionIfExists("downloadNewsDocument", newsDocumentID, newsDocumentTitle, newsDocumentNumber, newsDocumentDate);
};

KnotiaKnowledge5.DocumentManager.prototype.emailNewsDocument = function (doForceEmailOnly, newsDocumentID, newsDocumentTitle, newsDocumentNumber, newsDocumentDate, overrideTwitterLink, overrideLinkedInLink, overrideFacebookLink) {
    callStateManagerFunctionIfExists("emailNewsDocument", doForceEmailOnly, newsDocumentID, newsDocumentTitle, newsDocumentNumber, newsDocumentDate, overrideTwitterLink, overrideLinkedInLink, overrideFacebookLink);
};

//Function to jump to desired position after all images have loaded.
KnotiaKnowledge5.DocumentManager.prototype.jumpAfterImagesLoaded = function (paragraphID, fetchID) {
    var that = this;
    $("#divBodyContent").waitForImages(function () {
        that.pauseBeforeJumping(paragraphID, fetchID);
    });
};

KnotiaKnowledge5.DocumentManager.prototype.pauseBeforeJumping = function (paragraphID, fetchID) {
    // pause before jumping, otherwise it happens too fast and isn't properly aligned

    if (paragraphID == null) {
        this.jumpToFirstHit();
        return;
    }

    // if we can fetch the fetch ID, just do that, no need to worry about paragraphID
    var didJumpToAnchor = false;
    if (fetchID != null) {
        var didJumpToAnchor = this.jumpToAnchor(fetchID);
    }

    if (!didJumpToAnchor) {
        if (paragraphID == 1) {
            this.controlJqueryObject.scrollTop(0).scrollLeft(0);
        }
        else {
            this.jumpToAnchor("el_P" + paragraphID.toString());
        }
    }

    // this was added because it was breaking when a popup came up.
    var historyCursorScrollPosition = callStateManagerFunctionIfExists("getHistoryCursorScrollPosition");
    if (historyCursorScrollPosition != null) {
        this.controlJqueryObject.scrollTop(historyCursorScrollPosition);
    }
};



KnotiaKnowledge5.DocumentManager.prototype.jumpToAnchor = function (anchorName) {
    var me = document.k5doc;

    if (Globals.Utilities.isUndefinedOrNull(anchorName)) {
        return false;
    }

    var anchorTag;
    if (anchorName.indexOf("el_P") === 0) { // starts with
        anchorTag = $("#" + anchorName);
    }
    else {
        anchorTag = $("a[name='" + anchorName.replace(new RegExp("'", "g"), "\\'") + "']").last(); // last one on the page -- sometimes there are 2, one added at the start of the paragraph, and one embedded in the paragraph, we want the embedded (2nd) one
        if (anchorTag.length === 0) {
            return false;
        }
    }

    me.controlJqueryObject.scrollTop(0);
    me.controlJqueryObject.scrollLeft(0);

    setTimeout(function () {
        try {
            document.k5doc.controlJqueryObject.scrollTop(anchorTag.position().top);
        }
        catch (e) {

        }
    }, 500);
    window.scrollTo(0, 0);
    return true;
};

KnotiaKnowledge5.DocumentManager.prototype.jumpToFirstHit = function () {
    this.jumpToNextHit(0);
    this.controlJqueryObject.scrollLeft(0);
    window.scrollTo(0, 0);
};

KnotiaKnowledge5.DocumentManager.prototype.jumpToNextHit = function (iDirection) {
    // first, clear previous HitHighlightOn if applicable
    if (this.documentHitNumber > 0) {
        var objUnHitHighlight = document.getElementById("hh_" + this.documentHitNumber.toString());
        if (objUnHitHighlight != null) {
            objUnHitHighlight.className = "HitHighlight";
        }
    }

    // determine the current hit number
    if (parseInt(iDirection, 10) === 0) {
        // jump to first hit, this.documentHitNumber was set in loadDocumentFromSearch
    }
    else if (iDirection > 0) {
        if (this.documentHitNumber == -1) {
            this.documentHitNumber = 1;
        } else {
            this.documentHitNumber += 1;
        }
    }
    else {
        this.documentHitNumber -= 1;
    }

    // jump to the current hit number
    if (this.specifiedHitParagraphs.length > 0) {
        if (this.documentHitNumber < this.specifiedHitParagraphs.length) {
            var iHitParagraphID = this.specifiedHitParagraphs[this.documentHitNumber];
            var objHitParagraph = document.getElementById("el_P" + iHitParagraphID.toString());
            if (objHitParagraph != null) {
                objHitParagraph.scrollIntoView();

                this.disableNextHitLink(false, (parseInt(this.documentHitNumber, 10) === 0));
                this.disableNextHitLink(true, (this.documentHitNumber == this.specifiedHitParagraphs.length - 1));

                return;
            }
        }
    }
    else {
        var objHitHighlight = $("#hh_" + this.documentHitNumber.toString());
        if (objHitHighlight.length > 0) {
            var containerDiv = objHitHighlight.closest("div").attr("id"); // "closest" traverses ancestors until matching the selector
            if (containerDiv && containerDiv.indexOf("documentFootnote_") == 0) { // starts with
                // highlight is in a footnote
                var footnoteID = containerDiv.split("_")[1];

                var footnoteLink = $("a.pLink").filter("[href $= '," + footnoteID + ")']");
                if (footnoteLink.length > 0) {
                    footnoteLink[0].scrollIntoView();
                }

                this.displayFootnote(footnoteID);
            }
            else {
                objHitHighlight[0].scrollIntoView();
                objHitHighlight[0].className = "HitHighlightOn";
            }

            this.disableNextHitLink(false, this.documentHitNumber == 1);
            this.disableNextHitLink(true, document.getElementById("hh_" + (this.documentHitNumber + 1).toString()) == null);
            return;
        }
    }

    // couldn't find the hit, jump to the next/previous document
    var linkToSearchDocument;
    if (iDirection > 0) {
        linkToSearchDocument = $("#linkNextSearchDocument");
    }
    else if (iDirection < 0) {
        linkToSearchDocument = $("#linkPrevSearchDocument");
    }
    else {
        return;
    }

    if (linkToSearchDocument != null) {
        linkToSearchDocument.trigger("click");
    }
};

KnotiaKnowledge5.DocumentManager.prototype.createHistoryBlocks = function () {
    var addHistoricalActsLinkText = null;
    var addHistoricalActsLinkDestination = null;
    var alternateHistoryLabel = null;

    var iBookID3 = this.bookID % 1000;
    if (iBookID3 >= 102 && iBookID3 <= 104) {
        // ITA, ITR, ITAR
        addHistoricalActsLinkText = "Click here to view point-in-time legislation.";
        addHistoricalActsLinkDestination = "/Knowledge/Home.aspx?ProductID=1133";
    }
    else if (iBookID3 >= 152 && iBookID3 <= 154) {
        // french ITA, ITR, ITAR
        addHistoricalActsLinkText = "Cliquez ici pour visualiser la l&eacute;gislation telle qu'elle se lisait &agrave; divers moments dans le pass&eacute;.";
        addHistoricalActsLinkDestination = "/Knowledge/Home.aspx?ProductID=1139";
    }
    else if (iBookID3 == 198 || iBookID3 == 250) { } // ita exam reference
    else if (iBookID3 == 243 || iBookID3 == 384) { }
    else if (iBookID3 == 527 || iBookID3 == 556 || iBookID3 == 558 || iBookID3 == 566 || iBookID3 == 568) { } // historical acts (eng + fre)
    else if (iBookID3 == 648 || iBookID3 == 645 || iBookID3 == 646 || iBookID3 == 647 || iBookID3 == 649 || iBookID3 == 653 || iBookID3 == 655 || iBookID3 == 650 || iBookID3 == 651 || iBookID3 == 652) { } // historical acts (year-by-year, productID 645)    else if (iBookID3 == 111 || iBookID3 == 199) { } // income tax cases
    else if (iBookID3 == 111 || iBookID3 == 199) { } // income tax cases
    //@CHANGED @20190307, added 311 and 368
    else if (iBookID3 == 301 || iBookID3 == 302 || iBookID3 == 303 || iBookID3 == 351 || iBookID3 == 352 || iBookID3 == 353 || iBookID3 == 245 || iBookID3 == 247 || iBookID3 == 287 || iBookID3 == 288 || iBookID3 == 311 || iBookID3 == 368 || iBookID3 == 306 || iBookID3 == 307 || iBookID3 == 356 || iBookID3 == 357) { } // customs act and tariff, english and french
    else if (iBookID3 == 201 || iBookID3 == 202 || iBookID3 == 207 || iBookID3 == 251 || iBookID3 == 252 || iBookID3 == 252 || iBookID3 == 256 || iBookID3 == 531 || iBookID3 == 532 || iBookID3 == 751 || iBookID3 == 752 || iBookID3 == 753 || iBookID3 == 755 || iBookID3 == 756 || iBookID3 == 757 || iBookID3 == 758 || iBookID3 == 759) { } // ETA, english and french
    else if (iBookID3 == 570 || iBookID3 == 571 || iBookID3 == 572 || iBookID3 == 573) { }
    else if (iBookID3 >= 403 && iBookID3 <= 415) { } // provinces in PERL
    else if (iBookID3 >= 456 && iBookID3 <= 457) { } // ITQ
    else if (iBookID3 == 183 || iBookID3 == 570) { // treaties in cif
        alternateHistoryLabel = "History and Technical explanation";
    }
    else if (iBookID3 == 189) { // treaties in fitac
        alternateHistoryLabel = "Historique et Explication technique";
    }
    else {
        // otherwise quit
        return;
    }

    var iParagraphID = 1;
    var objParagraph, objPrevParagraph;
    var iHistoryBlockStart = -1, bContainsHit = false;
    var reHistoryHeaderParagraphPattern = /P class=['\"]?Generatedbold['\"]>Jurisprudence|P class=['\"]?Generatedbold['\"]>Cases cit/i;
    var reHistoryParagraphPattern = /P class=['\"]?History/i;
    var reConcordanceParagraphPattern = /P class=['\"]?(MLIConcordance)/i;
    var reCommentaryParagraphPattern = /P class=['\"]?(MLICommentary)/i;
    var reOriginParagraphPattern = /P class=['\"]?Origin/i;
    var reOriginHeadingParagraphPattern = /P class=['\"]?Originheading/i;
    var reFutureParagraphPattern = /P class=['\"]?Future/i;
    var anyHeaderMatch = false;
    var isHeaderMatch = false;
    var isHistoryMatch = false;
    var isFutureMatch = false;
    var wasFutureMatch = -1;
    var isOriginMatch = false;
    var wasOriginMatch = -1;

    while ((objParagraph = document.getElementById("el_P" + iParagraphID.toString())) != null) {
        isHeaderMatch = reHistoryHeaderParagraphPattern.test(objParagraph.innerHTML);
        isHistoryMatch = reHistoryParagraphPattern.test(objParagraph.innerHTML);
        isFutureMatch = reFutureParagraphPattern.test(objParagraph.innerHTML);
        isOriginMatch = reOriginParagraphPattern.test(objParagraph.innerHTML);
        isConcordanceMatch = reConcordanceParagraphPattern.test(objParagraph.innerHTML);
        isCommentaryMatch = reCommentaryParagraphPattern.test(objParagraph.innerHTML);
        if (isFutureMatch || isOriginMatch) {
            isHistoryMatch = true;
        }

        // anyHeaderMatch is true once any is found (assumes document doesn't contain both ITA-style history and cases-cited-style history
        anyHeaderMatch = (isHeaderMatch || anyHeaderMatch);

        var needToCloseLastBlock = false;

        if (isOriginMatch) {
            if (reOriginHeadingParagraphPattern.test(objParagraph.innerHTML) && iHistoryBlockStart > 0) {
                // this.updateParagraphHTML(objPrevParagraph, objPrevParagraph.innerHTML + "<br /><hr width='40%' size='1' color='black' /><br />");
                // iHistoryBlockStart = -1;
                needToCloseLastBlock = true;
                anyHeaderMatch = false;
            }
        }

        if ((isHeaderMatch || !isHistoryMatch) && iHistoryBlockStart > 0) {
            // if there is an open history block, and this is a history header (start a new block) or not history at all, close the block
            // this would be consecutive cases cited blocks in cases
            needToCloseLastBlock = true;
        }
        else if (
            isHistoryMatch
            &&
            (
                (isFutureMatch && wasFutureMatch == 0) || (!isFutureMatch && wasFutureMatch == 1)
                || (isOriginMatch && wasOriginMatch == 0) || (!isOriginMatch && wasOriginMatch == 1)
            )
        ) {
            // in legislation, a history block can immediately follow a future/origin block, or vice versa, so close the previous block
            needToCloseLastBlock = true;
        }

        if (needToCloseLastBlock) {
            if (!anyHeaderMatch) {
                this.updateParagraphHTML(objPrevParagraph, objPrevParagraph.innerHTML + "<br /><hr width='40%' size='1' color='black' /><br />");
            }
            if (!bContainsHit) {
                var iBoxRemovedFromHistorySection = this.showHistoryBlock(iHistoryBlockStart, false, anyHeaderMatch);
                if (!Globals.Utilities.isUndefinedOrNull(iBoxRemovedFromHistorySection)) {
                    $("#el_P" + iParagraphID.toString()).find("p:first").prepend(iBoxRemovedFromHistorySection);
                }
            }
            iHistoryBlockStart = -1;
            bContainsHit = false;
        }

        if (isHeaderMatch || (isHistoryMatch && iHistoryBlockStart < 0) || isConcordanceMatch || isCommentaryMatch) {
            // if this is a history header, or the first in a sequence of regular history, start a new history block
            var linkClass = "";
            if (isHeaderMatch) {
                linkClass = "class='black'";
            }

            var sLink = "<a " + linkClass + " id='js-a-showHide1Link-" + iParagraphID.toString() + "' href='javascript:document.k5doc.showHistoryBlock(" + iParagraphID.toString() + ", false, " + anyHeaderMatch.toString() + ");'>";
            if (isHeaderMatch) {
                // special: use the existing text as the history header instead of the current paragraph
                objParagraph.innerHTML = "<p class='ShowHide2Shown'>" + sLink + "<span class='MinusIcon'> </span></a>" + " " + sLink + "<b>" + (document.all ? objParagraph.innerText : objParagraph.textContent) + "</b></a></p>";
            }
            else {
                var textToUse;
                // add the word "History" as the history header after the previous paragraph
                var useLanguage = (this.productLanguage ? this.productLanguage : (document.ProductLanguage ? document.ProductLanguage : 1));

                if (isFutureMatch) {
                    textToUse = (useLanguage == 2 ? "Application future" : "Future application");
                }
                else if (isOriginMatch) {
                    textToUse = objParagraph.innerText;
                    objParagraph.innerHTML = "<div style='display:none;'>" + objParagraph.innerHTML + "</div>";
                }
                else if (alternateHistoryLabel != null) {
                    textToUse = alternateHistoryLabel;
                }
                else if (isConcordanceMatch) {
                    textToUse = "Concordance";
                }
                else if (isCommentaryMatch) {
                    textToUse = "Commentary";
                }
                else {
                    textToUse = (useLanguage == 2 ? "Historique" : "History");
                }


                var thisParagraph = $("#el_P" + iParagraphID.toString());

                thisParagraph.before("<p class='ShowHide1Shown' id='js-p-showHide1Paragraph-" + iParagraphID.toString() + "'>" + sLink + "<span class='MinusIcon' id='js-span-showHide1Icon-" + iParagraphID.toString() + "'> </span> <b>" + textToUse + "</b></a></p>");

                if (thisParagraph.text() == textToUse) {
                    var regex = new RegExp(textToUse, "gi");
                    thisParagraph.html(thisParagraph.html().replace(regex, ""));
                }

                if (addHistoricalActsLinkText != null && !isFutureMatch && !isOriginMatch && this.productID !== 645) {
                    thisParagraph.prepend("<p class='Historyleft'><a href='" + addHistoricalActsLinkDestination + "' target='_blank'><img src='/UserControls/Toolbar/Images/KNOTIAFLAT/Icons/Flat-Arrow-History.png' class='js--img--pnghover' style='vertical-align:middle;' /></a> <a href='" + addHistoricalActsLinkDestination + "' target='_blank'>" + addHistoricalActsLinkText + "</a></p>");
                }

                if (isConcordanceMatch || isCommentaryMatch) {
                    thisParagraph.prepend("<p class='Historyleft'></p>");
                }

            }
            iHistoryBlockStart = iParagraphID;
        }

        if (isHistoryMatch || isConcordanceMatch || isCommentaryMatch) {
            $("#el_P" + iParagraphID.toString()).find("span.Arialbold9pt:first").remove();
            $("#el_P" + iParagraphID.toString()).find("span.Arialbold:first").remove();
        }

        if (!bContainsHit && iHistoryBlockStart > 0) {
            // if in a history block, and there is a hit, don't hide the block
            if (objParagraph.innerHTML.indexOf('class=HitHighlight') >= 0 || objParagraph.innerHTML.indexOf('class="HitHighlight') >= 0) {
                bContainsHit = true;
            }
            else if (objParagraph.innerHTML.indexOf("userHighlightNoteID_") >= 0) {
                bContainsHit = true;
            }
        }

        iParagraphID++;
        objPrevParagraph = objParagraph;

        if (isHistoryMatch) {
            wasFutureMatch = (isFutureMatch ? 1 : 0);
            wasOriginMatch = (isOriginMatch ? 1 : 0);
        }
        else {
            wasFutureMatch = -1;
            wasOriginMatch = -1;
        }
    }

    if (iHistoryBlockStart > 0) {
        if (!anyHeaderMatch) {
            this.updateParagraphHTML(objPrevParagraph, objPrevParagraph.innerHTML + "<br /><hr width='40%' size='1' color='black' /><br />");
        }
        if (!bContainsHit) {
            this.showHistoryBlock(iHistoryBlockStart, false, anyHeaderMatch);
        }
    }
};

KnotiaKnowledge5.DocumentManager.prototype.updateParagraphHTML = function (objParagraph, sHTML) {
    try {
        objParagraph.innerHTML = sHTML;
    }
    catch (exc) {
        return;
    }
};

KnotiaKnowledge5.DocumentManager.prototype.showHistoryBlock = function (iStartParagraphID, bIsShow, documentContainsCasesCitedStyleHistory) {
    var reHistoryParagraphPattern = /P class=['\"]?History/i;
    var reOriginParagraphPattern = /P class=['\"]?Origin/i;
    var reOriginHeadingParagraphPattern = /P class=['\"]?Originheading/i;
    var reFutureParagraphPattern = /P class=['\"]?Future/i;
    var reHistoryNextHeaderParagraphPattern = /P class=['\"]?History-CasesCitedHead/i;
    var reHistoryThisHeaderParagraphPattern = /P class=['\"]?ShowHide2/i;

    var returnRemovedIBox; //undefined, returned value is used mostly within an anchor's href; if initialized to null, different browsers handles it differently.

    if (documentContainsCasesCitedStyleHistory) {
        var objParagraph;

        // loop from the current paragraph until it isn't a history paragraph anymore
        var iParagraphID = iStartParagraphID;
        while ((objParagraph = document.getElementById("el_P" + iParagraphID.toString())) != null) {
            if (reHistoryThisHeaderParagraphPattern.test(objParagraph.innerHTML)) {
                // the header for the section being created
                try {
                    var sText = document.all ? objParagraph.innerText : objParagraph.textContent;
                    var sLink = "<a class='black' href='javascript:document.k5doc.showHistoryBlock(" + iParagraphID.toString() + ", " + (!bIsShow).toString() + ", true);'>";
                    objParagraph.innerHTML = "<p class='ShowHide2" + (bIsShow ? "Shown" : "Hidden") + "'>" + sLink + "<span class='" + (bIsShow ? "Minus" : "Plus") + "Icon'> </span></a>" + " " + sLink + "<b>" + sText + "</b></a></p>";
                }
                catch (exc) {
                    return returnRemovedIBox;
                }
            }
            else if (reHistoryNextHeaderParagraphPattern.test(objParagraph.innerHTML)) {
                // the header for the next section
                return returnRemovedIBox;
            }
            else if (reHistoryParagraphPattern.test(objParagraph.innerHTML)) {
                // history, hide (or show)
                objParagraph.style.display = (bIsShow ? "" : "none");
            }
            else {
                // not history at all
                return returnRemovedIBox;
            }

            iParagraphID++;
        }
    }
    else {
        // edit the previous paragraph so that the link is collapsed
        var obj = $("#js-p-showHide1Paragraph-" + iStartParagraphID.toString());
        obj.removeClass("ShowHide1Shown");
        obj.removeClass("ShowHide1Hidden");
        obj.addClass("ShowHide1" + (bIsShow ? "Shown" : "Hidden"));

        obj = $("#js-span-showHide1Icon-" + iStartParagraphID.toString());
        obj.removeClass("MinusIcon");
        obj.removeClass("PlusIcon");
        obj.addClass((bIsShow ? "Minus" : "Plus") + "Icon");

        obj = $("#js-a-showHide1Link-" + iStartParagraphID.toString());
        obj.attr("href", "javascript:document.k5doc.showHistoryBlock(" + iStartParagraphID.toString() + ", " + (!bIsShow).toString() + ", false);");

        // loop from the current paragraph until it isn't a history paragraph anymore, and hide it
        var iParagraphID = iStartParagraphID;
        var wasFutureMatch = -1;
        var wasOriginMatch = -1;
        var isOriginMatchHeading = false;
        while ((objParagraph = document.getElementById("el_P" + iParagraphID.toString())) != null) {
            var isHistoryMatch = reHistoryParagraphPattern.test(objParagraph.innerHTML);
            var isFutureMatch = reFutureParagraphPattern.test(objParagraph.innerHTML);
            var isOriginMatch = reOriginParagraphPattern.test(objParagraph.innerHTML);
            if (isFutureMatch || isOriginMatch) {
                isHistoryMatch = true;
            }

            if (isOriginMatch) {
                isOriginMatchHeading = reOriginHeadingParagraphPattern.test(objParagraph.innerHTML);
            }

            if (
                (isFutureMatch && wasFutureMatch == 0) || (!isFutureMatch && wasFutureMatch == 1)
                || (isOriginMatch && wasOriginMatch == 0) || (!isOriginMatch && wasOriginMatch == 1)
                || (isOriginMatch && wasOriginMatch == 1 && isOriginMatchHeading) // back-to-back origin sections, return as this is the start of the 2nd
            ) {
                return returnRemovedIBox;
            }

            if (isHistoryMatch) {
                objParagraph.style.display = (bIsShow ? "" : "none");

                if (isFutureMatch) {
                    var iBox = $("#el_P" + iParagraphID.toString()).find("span.insightLinkContainer");
                    if (iBox.length > 0) {
                        returnRemovedIBox = iBox.detach();
                    }
                }
            }
            else {
                return returnRemovedIBox;
            }

            iParagraphID++;

            if (isHistoryMatch) {
                wasFutureMatch = (isFutureMatch ? 1 : 0);
                wasOriginMatch = (isOriginMatch ? 1 : 0);
                wasHistoryMatch = (isOriginMatch ? 1 : 0);
            }
            else {
                wasFutureMatch = -1;
                wasOriginMatch = -1;
                wasHistoryMatch = -1;
            }
        }

        return returnRemovedIBox;
    }
};

KnotiaKnowledge5.DocumentManager.prototype.displayExistingTagsForActiveDocument = function () {
    var sThisDocumentPK = this.bookID.toString() + "_" + this.documentID.toString();
    var objTaggingLink = document.getElementById("elTaggingLinkText");
    var asTaggedRecordsData = this.taggedRecordsList.split("|");

    if (!this.isTaggingEnabled) {
        return;
    }

    // need to mark any paragraphs in the document that have already been tagged
    var asTaggedRecordsDataLength = asTaggedRecordsData.length;
    //for (var i in asTaggedRecordsData) {	
    for (var i = 0; i < asTaggedRecordsDataLength; i++) {
        var sTaggedParagraph = asTaggedRecordsData[i];

        if (sTaggedParagraph.indexOf(sThisDocumentPK + "_") == 0) {
            // tag is in this document
            sTaggedParagraph = sTaggedParagraph.substring(sThisDocumentPK.length + 1, sTaggedParagraph.length);
            this.showTaggingIndicator($("#el_P" + sTaggedParagraph));
        }
    }

    document.body.onmousedown = document.k5doc.registerMouseDown;
    document.body.onmouseup = document.k5doc.registerMouseUp;
};

KnotiaKnowledge5.DocumentManager.prototype.enableTagging = function () {
    this.isTaggingEnabled = true;
    this.taggedRecordsList = "";
};

KnotiaKnowledge5.DocumentManager.prototype.disableTagging = function () {
    this.isTaggingEnabled = false;

    var asTaggedParagraphs = this.taggedRecordsList.split("|");
    this.taggedRecordsList = "";

    // need to unset paragraph-tag indicator for any tagged paragraphs
    var sThisDocumentPK = this.bookID.toString() + "_" + this.documentID.toString();
    var asTaggedParagraphsLength = asTaggedParagraphs.length;
    //for (var i in asTaggedParagraphs) {
    for (var i = 0; i < asTaggedParagraphsLength; i++) {
        var sTaggedParagraph = asTaggedParagraphs[i];
        if (sTaggedParagraph.indexOf(sThisDocumentPK + "_") == 0) {
            // tag is in this document
            sTaggedParagraph = sTaggedParagraph.substring(sThisDocumentPK.length + 1, sTaggedParagraph.length);
            this.hideTaggingIndicator($("#el_P" + sTaggedParagraph));
        }
    }
};

KnotiaKnowledge5.DocumentManager.prototype.isParagraphTagged = function (objParagraphSpan) {
    var sThisRecord = objParagraphSpan.id;
    sThisRecord = sThisRecord.substr(4, sThisRecord.length - 4); // remove "el_P" from the beginning
    sThisRecord = this.bookID.toString() + "_" + this.documentID.toString() + "_" + sThisRecord;

    var lsTaggedRecords = "|" + this.taggedRecordsList + "|";
    return (lsTaggedRecords.indexOf("|" + sThisRecord + "|") >= 0);
};

KnotiaKnowledge5.DocumentManager.prototype.mouseDownParagraph = function (objParagraphSpan, iMouseButton) {
    if (callStateManagerFunctionIfExists("isInDocumentOnlyView")) {
        return;
    }

    if (this.isTaggingEnabled) {
        if (iMouseButton == 1) {
            this.mouseDownParagraphID = objParagraphSpan.id;
            this.isMouseDown = true;
        }
    }
};

KnotiaKnowledge5.DocumentManager.prototype.mouseUpParagraph = function (objParagraphSpan, iMouseButton) {
    if (callStateManagerFunctionIfExists("isInDocumentOnlyView")) {
        return;
    }

    if (this.isTaggingEnabled) {
        if (iMouseButton == 1) {
            if (objParagraphSpan.id == this.mouseDownParagraphID) {
                // if the mouse goes down and up in the same paragraph, toggle its tagging status
                this.tagParagraph(objParagraphSpan);
            }
            else {
                // if it goes down and up in different paragraphs, toggle the entire range
                var iStart = parseInt(objParagraphSpan.id.replace(/el_P/i, ""), 10);
                var iEnd = parseInt(this.mouseDownParagraphID.replace(/el_P/i, ""), 10);
                if (iStart > iEnd) {
                    var iTemp = iStart;
                    iStart = iEnd;
                    iEnd = iTemp;
                }

                for (var i = iStart; i <= iEnd; i++) {
                    this.tagParagraph(document.getElementById("el_P" + i.toString()));
                }
            }

            this.mouseDownParagraphID = "";
            this.isMouseDown = false;
        }

        if (document.selection) {
            document.selection.empty();
        }
        else {
            window.getSelection().removeAllRanges();
        }
    }
};

KnotiaKnowledge5.DocumentManager.prototype.registerMouseDown = function () {
    this.mouseDown = true;
};

KnotiaKnowledge5.DocumentManager.prototype.registerMouseUp = function () {
    this.mouseDownParagraphID = "";
    this.mouseDown = false;
};

KnotiaKnowledge5.DocumentManager.prototype.tagParagraph = function (objParagraphSpan) {
    if (this.isTaggingEnabled) {
        var sTaggedRecordsData = this.taggedRecordsList + "|";
        if (sTaggedRecordsData.length > 1) {
            sTaggedRecordsData = "|" + sTaggedRecordsData;
        }

        var sThisRecord = objParagraphSpan.id;
        sThisRecord = sThisRecord.substr(4, sThisRecord.length - 4); // remove "el_P" from the beginning
        sThisRecord = this.bookID.toString() + "_" + this.documentID.toString() + "_" + sThisRecord;

        var i = sTaggedRecordsData.indexOf("|" + sThisRecord + "|");
        if (i >= 0) {
            // this record already exists in the tagged records set, remove it
            this.hideTaggingIndicator($("#" + objParagraphSpan.id));
            var j = sThisRecord.length + 1;
            sTaggedRecordsData = sTaggedRecordsData.substr(0, i) + sTaggedRecordsData.substr(i + j, sTaggedRecordsData.length - i - j); // remove untagged paragraph
            sTaggedRecordsData = sTaggedRecordsData.substr(1, sTaggedRecordsData.length - 2); // remove pipe from beginning and end
            this.taggedRecordsList = sTaggedRecordsData;
        }
        else {
            // this record does not exist in the tagged records set, add it
            this.showTaggingIndicator($("#" + objParagraphSpan.id));
            sTaggedRecordsData = sTaggedRecordsData.substring(1) + sThisRecord; // remove first pipe from sTaggedRecordsData (which is |data|data|) and add record to the end (resulting in data|data|data)
            this.taggedRecordsList = sTaggedRecordsData;
        }
    }
};

KnotiaKnowledge5.DocumentManager.prototype.showTaggingIndicator = function (jqueryParagraphSpan) {
    jqueryParagraphSpan.css("background-image", "url(View/_IncludeFiles/Images/TaggedParagraphOn.gif)");
    jqueryParagraphSpan.css("background-repeat", "repeat-y");
};

KnotiaKnowledge5.DocumentManager.prototype.hideTaggingIndicator = function (jqueryParagraphSpan) {
    jqueryParagraphSpan.css("background-image", "");
};

KnotiaKnowledge5.DocumentManager.prototype.hideInaccessibleLinks = function () {
    var that = this;

    $("a.fitaLink").each(function () {
        $(this).trigger("mouseover");

        if (typeof $(this).attr("href") != "undefined") {
            var linkParts = $(this).attr("href").split(","); // javascript:document.k5doc.loadDocumentByGotoString(95, 'PA 2012/06/08', 0, null, false)
            var fetchID = $.trim(linkParts[1]);
            fetchID = fetchID.substring(1, fetchID.length - 1);
            var bookID = parseInt($.trim(linkParts[2]), 10);

            if (that.resolvedLinks[fetchID]) {
                // if the fetchID is stored in ResolvedLinks lookup table, the link goes to another product; disable it
                var textOnly = $(this).text();
                $(this).replaceWith(textOnly);
            }
        }
    });
};

KnotiaKnowledge5.DocumentManager.prototype.createDocumentNavigation = function () {
    var sNextPrevDocumentNavigation = "";

    // IF-ZILLA
    if (Globals.UI.isSiteThemeEnabled()) {
        sNextPrevDocumentNavigation = "<div style='padding-top:4px; padding-right:8px;'><table cellpadding=0 cellspacing=0 border=0><tr>";
        sNextPrevDocumentNavigation += "<td>";
        if (this.previousDocumentBookID > 0) {
            sNextPrevDocumentNavigation += "<a id=\"prevDocument\" href='javascript:;' onclick='document.k5doc.loadDocumentByBookDocumentID(" + this.productID.toString() + ", " + this.previousDocumentBookID.toString() + ", " + this.previousDocumentID.toString() + ")' title='" + this.previousDocumentTitle.replace(/'/g, "&#x27;") + "'><img class='js--img--pnghover' src='/UserControls/Toolbar/Images/" + glb_SiteStyle + "/Icons/Flat-Arrow-Thin-Left.png' border=0></a>";
        }
        else {
            sNextPrevDocumentNavigation += "<img class='disabledIcon' src='/UserControls/Toolbar/Images/" + glb_SiteStyle + "/Icons/Flat-Arrow-Thin-Left.png' border=0>";
        }
        sNextPrevDocumentNavigation += "</td><td class='navBarSectionLabel'>&nbsp; Document &nbsp;</td><td>";
        if (this.nextDocumentBookID > 0) {
            sNextPrevDocumentNavigation += "<a id=\"nextDocument\" href='javascript:;' onclick='document.k5doc.loadDocumentByBookDocumentID(" + this.productID.toString() + ", " + this.nextDocumentBookID.toString() + ", " + this.nextDocumentID.toString() + ")' title='" + this.nextDocumentTitle.replace(/'/g, "&#x27;") + "'><img class='js--img--pnghover' src='/UserControls/Toolbar/Images/" + glb_SiteStyle + "/Icons/Flat-Arrow-Thin-Right.png' border=0></a>";
        }
        else {
            sNextPrevDocumentNavigation += "<img class='disabledIcon' src='/UserControls/Toolbar/Images/" + glb_SiteStyle + "/Icons/Flat-Arrow-Thin-Right.png' border=0>";
        }
        sNextPrevDocumentNavigation += "</td></tr></table></div>";
    }

    else {
        sNextPrevDocumentNavigation = "<table cellpadding=0 cellspacing=0 border=0><tr><td colspan=2 style='height:10px;'></td></tr><tr>";
        sNextPrevDocumentNavigation += "<td>";
        if (this.previousDocumentBookID > 0) {
            sNextPrevDocumentNavigation += "<a id=\"prevDocument\" href='javascript:;' onclick='document.k5doc.loadDocumentByBookDocumentID(" + this.productID.toString() + ", " + this.previousDocumentBookID.toString() + ", " + this.previousDocumentID.toString() + ")' title='" + this.previousDocumentTitle.replace(/'/g, "&#x27;") + "'><img src='Images/Button_LeftArrowBlue.gif' border=0></a>";
        }
        else {
            sNextPrevDocumentNavigation += "<img src='Images/Button_LeftArrowGreyedOut.gif' border=0>";
        }
        sNextPrevDocumentNavigation += "</td><td class='navBarSectionLabel'>&nbsp; Document &nbsp;</td><td>";
        if (this.nextDocumentBookID > 0) {
            sNextPrevDocumentNavigation += "<a id=\"nextDocument\" href='javascript:;' onclick='document.k5doc.loadDocumentByBookDocumentID(" + this.productID.toString() + ", " + this.nextDocumentBookID.toString() + ", " + this.nextDocumentID.toString() + ")' title='" + this.nextDocumentTitle.replace(/'/g, "&#x27;") + "'><img src='Images/Button_RightArrowBlue.gif' border=0></a>";
        }
        else {
            sNextPrevDocumentNavigation += "<img src='Images/Button_RightArrowGreyedOut.gif' border=0>";
        }
        sNextPrevDocumentNavigation += "</td><td>&nbsp; &nbsp;</td></tr></table>";
    }

    callStateManagerFunctionIfExists("updateDocumentBodyNavigation", sNextPrevDocumentNavigation);

    delegateSwipeEvent(this.controlJqueryObject.attr("id"), 'prevDocument', 'nextDocument');
};

KnotiaKnowledge5.DocumentManager.prototype.createMyNotesDocumentNavigation = function () {
    var nextAndPreviousDocumentsFromTreeview = callStateManagerFunctionIfExists("getNextAndPreviousDocumentsFromTreeview");

    var sNextPrevDocumentNavigation = "<div style='padding-top:4px; padding-right:8px;'><table cellpadding=0 cellspacing=0 border=0><tr>";
    sNextPrevDocumentNavigation += "<td>";

    if (Globals.Utilities.isUndefinedOrNull(nextAndPreviousDocumentsFromTreeview["previousDocument"])) {
        sNextPrevDocumentNavigation += "<img class='disabledIcon' src='/UserControls/Toolbar/Images/KNOTIAFLAT/Icons/Flat-Arrow-Thin-Left.png' border=0>";
    }
    else {
        sNextPrevDocumentNavigation += "<a id=\"prevDocument\" href='javascript:;' onclick=\"callStateManagerFunctionIfExists('fireTreeviewTextClick', " + nextAndPreviousDocumentsFromTreeview["previousDocument"]["nodeID"] + ")\" title='" + nextAndPreviousDocumentsFromTreeview["previousDocument"]["documentTitle"] + "'><img class='js--img--pnghover' src='/UserControls/Toolbar/Images/KNOTIAFLAT/Icons/Flat-Arrow-Thin-Left.png' border=0></a>";
    }
    sNextPrevDocumentNavigation += "</td><td class='navBarSectionLabel'>&nbsp; Document &nbsp;</td><td>";

    if (Globals.Utilities.isUndefinedOrNull(nextAndPreviousDocumentsFromTreeview["nextDocument"])) {
        sNextPrevDocumentNavigation += "<img class='disabledIcon' src='/UserControls/Toolbar/Images/KNOTIAFLAT/Icons/Flat-Arrow-Thin-Right.png' border=0>";
    }
    else {
        sNextPrevDocumentNavigation += "<a id=\"nextDocument\" href='javascript:;' onclick=\"callStateManagerFunctionIfExists('fireTreeviewTextClick', " + nextAndPreviousDocumentsFromTreeview["nextDocument"]["nodeID"] + ")\" title='" + nextAndPreviousDocumentsFromTreeview["nextDocument"]["documentTitle"] + "'><img class='js--img--pnghover' src='/UserControls/Toolbar/Images/KNOTIAFLAT/Icons/Flat-Arrow-Thin-Right.png' border=0></a>";
    }
    sNextPrevDocumentNavigation += "</td></tr></table></div>";

    return sNextPrevDocumentNavigation;
};

KnotiaKnowledge5.DocumentManager.prototype.createBriefcaseNavigation = function () {
    var iPreviousNodeID = callStateManagerFunctionIfExists("getNeighbouringBriefcaseTreeviewNodeID", -1);
    var iNextNodeID = callStateManagerFunctionIfExists("getNeighbouringBriefcaseTreeviewNodeID", 1);
    var sNextPrevDocumentNavigation = "";

    // IF-ZILLA
    //if (glb_SiteStyle != null && glb_SiteStyle == "KNOTIAFLAT") {
    if (glb_SiteStyle != null) {
        sNextPrevDocumentNavigation = "<div style='padding-top:4px; padding-right:8px;'><table cellpadding=0 cellspacing=0 border=0><tr><td>";
        if (iPreviousNodeID > 0) {
            sNextPrevDocumentNavigation += "<a id=\"prevDocument\" href='javascript:;' onclick='document.k5doc.loadDocumentFromBriefcase(" + iPreviousNodeID.toString() + ")'><img class='js--img--pnghover' src='/UserControls/Toolbar/Images/" + glb_SiteStyle + "/Icons/Flat-Arrow-Thin-Left.png' border=0></a>";
        }
        else {
            sNextPrevDocumentNavigation += "<img class='disabledIcon' src='/UserControls/Toolbar/Images/" + glb_SiteStyle + "/Icons/Flat-Arrow-Thin-Left.png' border=0>";
        }
        sNextPrevDocumentNavigation += "</td><td class='navBarSectionLabel'>&nbsp; " + GetString("str_DocNav_BriefcaseDocuments") + " &nbsp;</td><td>";
        if (iNextNodeID > 0) {
            sNextPrevDocumentNavigation += "<a id=\"nextDocument\" href='javascript:;' onclick='document.k5doc.loadDocumentFromBriefcase(" + iNextNodeID.toString() + ")'><img class='js--img--pnghover' src='/UserControls/Toolbar/Images/" + glb_SiteStyle + "/Icons/Flat-Arrow-Thin-Right.png' border=0></a>";
        }
        else {
            sNextPrevDocumentNavigation += "<img class='disabledIcon' src='/UserControls/Toolbar/Images/" + glb_SiteStyle + "/Icons/Flat-Arrow-Thin-Right.png' border=0>";
        }
        sNextPrevDocumentNavigation += "</td></tr></table></div>";
    }
    else {
        sNextPrevDocumentNavigation = "<table cellpadding=0 cellspacing=0 border=0><tr><td colspan=2 style='height:10px;'></td></tr><tr><td>";
        if (iPreviousNodeID > 0) {
            sNextPrevDocumentNavigation += "<a id=\"prevDocument\" href='javascript:;' onclick='document.k5doc.loadDocumentFromBriefcase(" + iPreviousNodeID.toString() + ")'><img src='Images/Button_LeftArrowBlue.gif' border=0></a>";
        }
        else {
            sNextPrevDocumentNavigation += "<img src='Images/Button_LeftArrowGreyedOut.gif' border=0>";
        }
        sNextPrevDocumentNavigation += "</td><td class='navBarSectionLabel'>&nbsp; " + GetString("str_DocNav_BriefcaseDocuments") + " &nbsp;</td><td>";
        if (iNextNodeID > 0) {
            sNextPrevDocumentNavigation += "<a id=\"nextDocument\" href='javascript:;' onclick='document.k5doc.loadDocumentFromBriefcase(" + iNextNodeID.toString() + ")'><img src='Images/Button_RightArrowBlue.gif' border=0></a>";
        }
        else {
            sNextPrevDocumentNavigation += "<img src='Images/Button_RightArrowGreyedOut.gif' border=0>";
        }
        sNextPrevDocumentNavigation += "</td><td>&nbsp; &nbsp;</td></tr></table>";

    }
    callStateManagerFunctionIfExists("updateDocumentBodyNavigation", sNextPrevDocumentNavigation);

    delegateSwipeEvent(this.controlJqueryObject.attr("id"), 'prevDocument', 'nextDocument');
};

KnotiaKnowledge5.DocumentManager.prototype.createDocumentSearchNavigation = function () {
    var sNextPrevDocumentNavigation = callStateManagerFunctionIfExists("createDocumentSearchNavigation", this.bookID, this.documentID, this.specifiedHitParagraphs);

    callStateManagerFunctionIfExists("updateDocumentBodyNavigation", sNextPrevDocumentNavigation);

    var isDailyViewOfNews = callStateManagerFunctionIfExists("isDailyViewOfNews");
    if (isDailyViewOfNews) {
        var collapseButton = $("#tsi_docs_collapse").parent().parent().parent().parent().clone();
        $("#collapseAllInlineDocumentsLink").append(collapseButton);
    }
    else {
        delegateSwipeEvent(this.controlJqueryObject.attr("id"), 'linkPrevSearchDocument', 'linkNextSearchDocument');
    }
};

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    KnotiaKnowledge5.DocumentManager.prototype.createDocumentSearchNavigationElastic
//          / this.createDocumentSearchNavigationElastic / document.k5doc.createDocumentSearchNavigationElastic
//
// Desc:    This method will create the document navigation for elastic
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
KnotiaKnowledge5.DocumentManager.prototype.createDocumentSearchNavigationElastic = function () {
    var sNextPrevDocumentNavigation = callStateManagerFunctionIfExists("createDocumentSearchNavigationElastic", this.bookID, this.documentID, this.specifiedHitParagraphs);

    callStateManagerFunctionIfExists("updateDocumentBodyNavigation", sNextPrevDocumentNavigation);

    var isDailyViewOfNews = callStateManagerFunctionIfExists("isDailyViewOfNews");
    if (isDailyViewOfNews) {
        var collapseButton = $("#tsi_docs_collapse").parent().parent().parent().parent().clone();
        $("#collapseAllInlineDocumentsLink").append(collapseButton);
    }
    else {
        delegateSwipeEvent(this.controlJqueryObject.attr("id"), 'linkPrevSearchDocument', 'linkNextSearchDocument');
    }
};

KnotiaKnowledge5.DocumentManager.prototype.scrollToTopOfInlineSearchResult = function () {
    if (!this.suppressScrollOfInlineDocument) {
        this.controlJqueryObject.scrollTop(this.controlJqueryObject.scrollTop() + $("#RL" + this.documentID.toString()).position().top);
    }
};

//Rendered this innert since its not doing anything now that the old annotation is not actually migrated.
KnotiaKnowledge5.DocumentManager.prototype.removeAnnotationsLinks = function () {
    //if (document.getElementsByTagName) {
    //	var aoLinks = document.getElementsByTagName("a");
    //	var aoLinksLength = aoLinks.length;
    //	var sLinked = "";
    //	for (var i = 0; i < aoLinksLength; i++) {
    //		sLinked = aoLinks[i].innerHTML;			
    //		if (sLinked.indexOf("Annotations.gif") > 0) {
    //			aoLinks[i].style.display = "none";
    //		}
    //	}
    //}
};

/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Name     :   printInlineNewsDocument
/// Desc     :   Prints the specified inline news document. 
///              Inline document means that the document was loaded from news search type pages - not within the TOC node.
/// Inputs   :   documentID - ID of the inline news document to be printed.
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
KnotiaKnowledge5.DocumentManager.prototype.printInlineNewsDocument = function (documentID) {
    $("#documentBodyForAlert_" + documentID.toString()).addClass("thisIsTheDivToPrint");
    callStateManagerFunctionIfExists("doPrint", -999);
};

KnotiaKnowledge5.DocumentManager.prototype.disableNextHitLink = function (bIsNextLink, bIsLastHitInDocument) {
    var objNextHitImage, objNextDocImage, sNewImageFile;
    if (bIsNextLink) {
        objNextHitImage = $("#imgNextHitLink");
        objNextDocImage = $("#imgNextDocLink");
    }
    else {
        objNextHitImage = $("#imgPrevHitLink");
        objNextDocImage = $("#imgPrevDocLink");
    }

    if (objNextHitImage.length === 0 || objNextDocImage.length === 0) {
        // shouldn't be possible, but why else would it cause errors?
        return;
    }

    var sImagePath = objNextHitImage.attr("src");
    var sImageFile = sImagePath.substring(sImagePath.lastIndexOf("/"));
    sImagePath = sImagePath.substring(0, sImagePath.lastIndexOf("/"));

    if (bIsLastHitInDocument && objNextDocImage.attr("src").indexOf("Grey") > 0) {
        sNewImageFile = sImageFile.replace(/Blue/, "GreyedOut");
    }
    else {
        sNewImageFile = sImageFile.replace(/GreyedOut/, "Blue");
    }

    if (sNewImageFile != sImageFile) {
        var imgTemp = new Image();
        imgTemp.src = sImagePath + sNewImageFile;
        objNextHitImage.attr("src", imgTemp.src);
    }
};

KnotiaKnowledge5.DocumentManager.prototype.loadSecureTaggedRecords = function (taggedRecordList) {
    this.loadSecureData("taggedRecords=" + taggedRecordList);
};

KnotiaKnowledge5.DocumentManager.prototype.loadSecureDocument = function (productID, bookID, documentID, objSearchType, sSearchParameters) {
    this.startProcessingImage();
    var productBookDocumentTrio = { "productID": productID, "bookID": bookID, "documentID": documentID };
    this.loadSecureDocuments([productBookDocumentTrio], false, objSearchType, sSearchParameters);
};

KnotiaKnowledge5.DocumentManager.prototype.loadSecureDocuments = function (productBookDocumentTrios, isForPrint, objSearchType, sSearchParameters) {
    var urlParams = "";
    var productBookDocumentTriosLength = productBookDocumentTrios.length;
    for (var i = 0; i < productBookDocumentTriosLength; i++) {
        urlParams += "productID" + i.toString() + "=" + productBookDocumentTrios[i].productID.toString() + "&bookID" + i.toString() + "=" + productBookDocumentTrios[i].bookID.toString() + "&documentID" + i.toString() + "=" + productBookDocumentTrios[i].documentID.toString() + "&";
    }

    if (!Globals.Utilities.isUndefinedOrNull(isForPrint) && isForPrint) {
        urlParams += "&forPrint=1";
    }

    if (!Globals.Utilities.isUndefinedOrNull(objSearchType) && parseInt(objSearchType, 10) !== 0) {
        urlParams += "&searchType=" + objSearchType.toString() + "&searchParameters=" + encodeURIComponent(sSearchParameters);
    }

    this.loadSecureData(urlParams);
};

KnotiaKnowledge5.DocumentManager.prototype.loadSecureData = function (urlParams) {
    var sslPageURI = "https://" + window.location.toString().split('/')[2] + "/Knowledge/SSLLoader.aspx?" + urlParams;
    var fileref = document.createElement("script");
    fileref.setAttribute("type", "text/javascript");
    fileref.setAttribute("src", sslPageURI);
    document.getElementsByTagName("head")[0].appendChild(fileref);
};

KnotiaKnowledge5.DocumentManager.prototype.buildLinkToCopyForm = function () {
    document.getElementById("tsi_share_copylink_lnk").style.cursor = "wait";
    document.getElementById("tsi_share_copylink_img").style.cursor = "wait";

    Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/BuildLinkToCopyForm",
        { "iProductID": this.productID, "fetchID": this.fetchID, "iDocumentID": this.documentID, "iBookID": this.bookID },
        this.presentLinkToCopy,
        null,
        null,
        this);
};

KnotiaKnowledge5.DocumentManager.prototype.presentLinkToCopy = function (result) {
    if (Globals.Utilities.isUndefinedOrNull(result) || result.length === 0) {
        return;
    }

    var html = "<div id='divLinkToDocument' class='normal-text-resizable'>";
    html += GetString("str_Share_CopyPasteLink") + GetString("str_Colon");
    html += "<input type='text' class='normal-fixed js--textbox--adjust-width js--textbox--round-corners' value='" + result.d + "' />";
    html += "</div>";

    Globals.UI.showjQueryToolbarDialog("tsi_share_copylink", 350, 175, GetString("str_Share_CreateLink"), html);

    var linkToCopyButton = [{
        "id": "btnClose",
        "text": GetString("str_Print_Close"),
        "class": "normal-text-resizable",
        "click": function () {
            Globals.UI.closejQueryToolbarDialog("tsi_share_copylink");
        }
    }];

    Globals.UI.addButtonsTojQueryToolbarDialog("tsi_share_copylink", linkToCopyButton);


};

KnotiaKnowledge5.DocumentManager.prototype.buildEmailDocumentForm = function () {

    if (Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) || glb_EnableKnotiaNext === 0 || Globals.Utilities.isUndefinedOrNull(window.currentPage)) {
        document.getElementById("tsi_share_emaildocument_lnk").style.cursor = "wait";
        document.getElementById("tsi_share_emaildocument_img").style.cursor = "wait";
    }

    Globals.Ajax.postRequest("/Services/ResearchService.svc/Emailer/BuildEmailDocumentForm",
        { "productID": this.productID, "bookID": this.bookID, "documentID": this.documentID, "gotoStr": this.fetchID },
        this.presentEmailDocumentForm,
        null,
        null,
        this);
};

KnotiaKnowledge5.DocumentManager.prototype.presentEmailDocumentForm = function (result) {
    if (Globals.Utilities.isUndefinedOrNull(glb_EnableKnotiaNext) || glb_EnableKnotiaNext === 0 || Globals.Utilities.isUndefinedOrNull(window.currentPage)) {
        document.getElementById("tsi_share_emaildocument_lnk").style.cursor = "pointer";
        document.getElementById("tsi_share_emaildocument_img").style.cursor = "pointer";
    }
    eval(result.d);

};

KnotiaKnowledge5.DocumentManager.prototype.submitEmailDocumentForm = function (emailAddresses, sendMeCopy, emailMessage, subjectTxt) {
    Globals.Ajax.postRequest("/Services/ResearchService.svc/Emailer/SubmitEmailDocumentForm",
        { "emailAddresses": emailAddresses, "sendMeCopy": sendMeCopy, "emailMessage": emailMessage, "productID": this.productID, "bookID": this.bookID, "documentID": this.documentID, "gotoStr": this.fetchID, "subjectTxt": subjectTxt },
        this.onSubmittedEmailDocumentForm,
        null,
        null,
        this);
};

KnotiaKnowledge5.DocumentManager.prototype.onSubmittedEmailDocumentForm = function (result) {
    eval(result.d);
};

KnotiaKnowledge5.DocumentManager.prototype.createFetchLinkForCurrentAlert = function (thisLink, toBookID, fetchID) {
    thisLink.href = "javascript:document.k5doc.loadDocumentByGotoString(0, '" + encodeURIComponent(fetchID) + "', " + toBookID.toString() + ", null, false);";
};

KnotiaKnowledge5.DocumentManager.prototype.loadAlertByID = function (alertID, languageID, suppressProcessingImage) {
    if (!callStateManagerFunctionIfExists("isInDocumentOnlyView")) {
        callStateManagerFunctionIfExists("saveHistoryPoint", "document.k5doc.loadAlertByID", arguments);
    }

    if (!suppressProcessingImage) {
        var documentBodyForAlert = $("#documentBodyForAlert_" + (this.documentID ? this.documentID.toString() : "0"));
        var isInlineViewOfNewsDocument = (documentBodyForAlert.length > 0);
        if (!isInlineViewOfNewsDocument) {
            this.startProcessingImage();
        }
    }

    var params = {
        'AlertID': alertID,
        'Language': languageID
    };

    Globals.Ajax.postRequest("/Services/NewsService.svc/GetAlertByAlertIDAndLanguage",
        params,
        this.processLoadedDocuments,
        null,
        null,
        this);
};

KnotiaKnowledge5.DocumentManager.prototype.displayDocumentAsInlineSearchResult = function (documentBodyForAlert, sFinalPageHTML, tocContext) {
    $("#synopsisForAlertID_" + this.documentID.toString()).hide();

    documentBodyForAlert.empty();
    documentBodyForAlert.html(sFinalPageHTML);
    documentBodyForAlert.show();
    documentBodyForAlert.removeClass("inlineBodyHidden");
    documentBodyForAlert.addClass("inlineBodyShown");

    callStateManagerFunctionIfExists("enableMouseOverActivationOfOpenInlineSearchResults", documentBodyForAlert, tocContext);

    documentBodyForAlert.css("margin", "5px 30px");
    //@ CHANGE FOR JQUERY 3.6
    //if ($.browser.msie && parseFloat($.browser.version) < 10.0) { // IE9, not very css compliant
    if (Globals.Utilities.isIE9OrLess()) { // IE9, not very css compliant
        documentBodyForAlert.width(documentBodyForAlert.width() - 60);
    }

    //if-zilla
    var twistyIcon = "";
    if (Globals.UI.isSiteThemeEnabled()) {
        twistyIcon = "/Resources/Images/minus.gif";
    }
    else {
        twistyIcon = "Images/ArticleTwistyOpen.png";
    }

    $("#articleTwisty_" + this.documentID.toString()).attr("src", twistyIcon);

    var divTitleContainer = $("#newsResultDocTitle_" + this.documentID.toString());
    if (!divTitleContainer.hasClass("newsTitleVisited")) {
        divTitleContainer.addClass("newsTitleVisited");
    }
};

KnotiaKnowledge5.DocumentManager.prototype.createAttachmentLinkForCurrentAlert = function (thisLink, attachmentName) {
    if (attachmentName.charAt(0) == ".") {
        // this can happen for admin materials in What's New, the attachment name is the docID, so the parameter is just the file extension
        attachmentName = this.documentID.toString() + attachmentName;
    }
    else if (attachmentName.indexOf("_1.") == 0 || attachmentName.indexOf("_2.") == 0) { //starts with
        // this can happen for admin materials in What's New, the attachment name is the docID + paragraphID, so the parameter is just the file extension
        attachmentName = this.documentID.toString() + attachmentName;
    }

    if (callStateManagerFunctionIfExists("isInDocumentOnlyView")) {
        var useDocumentID, useEncryptedUserID;
        if (this.documentID && this.EncryptedUserID) {
            useDocumentID = this.documentID;
            useEncryptedUserID = this.EncryptedUserID;
        }
        else {

            if (document.urlAlertID && document.urlAlertID != 0 && document.urlAlertID != null) {
                useDocumentID = document.urlAlertID;
            }
            else {
                useDocumentID = getURLParameter("AlertID");
            }

            useEncryptedUserID = getURLParameter("uAlertID");
            if (useEncryptedUserID == null) {
                useEncryptedUserID = getURLParameter("uID");
            }

            if (useDocumentID == null) { // this is a news document, copied to what's new
                CreateAttachmentLink(thisLink, this.bookID % 1000, attachmentName);
                return;
            }
        }

        thisLink.href = "/Login/ViewNewsAttachment.aspx?AlertID=" + useDocumentID + "&AttachmentName=" + encodeURIComponent(attachmentName) + "&ualertID=" + encodeURIComponent(useEncryptedUserID);
    }
    else {
        if (this.collectionType == KnotiaKnowledge5.CollectionType.News) { // this is the normal case - in the 2-pane news view, looking at a news document
            thisLink.href = "NewsAttachment.aspx?ProductID=" + this.productID.toString() + "&AlertID=" + this.documentID.toString() + "&AttachmentName=" + encodeURIComponent(attachmentName);
        }
        else {
            // news document lives in what's new -- use collection-style link, not newletter-style link
            CreateAttachmentLink(thisLink, this.bookID % 1000, attachmentName);
        }
    }

    return false;
};

KnotiaKnowledge5.DocumentManager.prototype.loadAlertIDElseFetchID = function (alertID) {
    if (callStateManagerFunctionIfExists("isInDocumentOnlyView")) {
        // not logged in, deep link to the alertID through client portal authentication
        window.location = "/Login/DirectToClientPortalLoginWithOIDParam.aspx?newsletterID=" + alertID.toString();
    }
    else {
        // if we are viewing this as a what's new document, don't try to load the alert (just do fetchID)
        if (this.collectionType != KnotiaKnowledge5.CollectionType.News) {
            alertID = -1;
        }

        // all arguments except the first
        this.tryFetchesIfAlertFails = [];
        var argumentsLength = arguments.length;
        for (var i = 1; i < argumentsLength; i++) {
            this.tryFetchesIfAlertFails[i - 1] = arguments[i];
        }
        this.loadAlertByID(alertID, 1, true);
    }
};

KnotiaKnowledge5.DocumentManager.prototype.displayContextMenu = function (sFetchID) {
    var divContext = document.getElementById("divFetchContextMenu");
    if (divContext == null) {
        var divContext = document.createElement("div");
        divContext.id = "divFetchContextMenu";
        divContext.style.position = "absolute";

        divContext.style.zIndex = 9999;
        divContext.style.backgroundColor = "white";
        divContext.style.border = "solid 1px #aca899";
        divContext.style.padding = "4px 16px";
        document.body.appendChild(divContext);
    }
    divContext.style.display = "";
    divContext.style.left = (event.clientX - 24).toString() + "px";
    divContext.style.top = (event.clientY - 10).toString() + "px";

    divContext.onmouseout = document.k5doc.hideContextMenu;

    divContext.innerHTML = "<a target=_blank style=\"color:black;font-size:8pt;\" href=\"Viewer.aspx?ProductID=" + this.productID.toString() + "&FetchID=" + escape(sFetchID) + "\">" + GetString("str_DocNav_OpenInNewWindow") + "</a>";

    return false;
};

KnotiaKnowledge5.DocumentManager.prototype.hideContextMenu = function () {
    var divContext = document.getElementById("divFetchContextMenu");
    divContext.style.display = "none";
};

KnotiaKnowledge5.DocumentManager.prototype.displayFootnote = function (iFootnoteID) {
    if (callStateManagerFunctionIfExists("isTaggingEnabled")) {
        // disable this type of link if tagging is enabled
        return;
    }

    // DRAW THE POPUP WINDOW
    var sFootnote;
    var hiddenFootnote = $("#documentFootnote_" + iFootnoteID.toString());
    if (hiddenFootnote.length > 0) {
        sFootnote = hiddenFootnote.html();
    }
    else {
        sFootnote = this.footnotes[iFootnoteID];
    }

    var innerHTML = "<div id=\"definitionDiv\" style=\"width:460px; padding-top:4px;\">" + sFootnote + "</div>";
    var div = createCenteredPopupDiv(innerHTML, true, "");
};

KnotiaKnowledge5.DocumentManager.prototype.getAllFootnotesForHTML = function (html) {
    var pattern = new RegExp("plink[^\<\>]*javascript:popupFootnote\([^,]+,[^,]+,([^\)]+)\)", "gi");
    var footnoteHTML = "";
    var hasPrintableFootnotes = false;
    var result;

    while ((result = pattern.exec(html)) != null) {
        var sFootnote = this.footnotes[result[2].toString().trim()];
        footnoteHTML = footnoteHTML + "<div style=\"padding:0px 10px 0px 10px;\" >" + sFootnote + "</div>";
        if (sFootnote.indexOf("showScreenHidePrint") === -1) {
            hasPrintableFootnotes = true;
        }
    }

    if (footnoteHTML.length > 0) {
        if (hasPrintableFootnotes) {
            footnoteHTML = "<hr/><h1>" + GetString("str_Print_Footnotes") + "</h1>" + footnoteHTML;
        } else {
            footnoteHTML = "<hr class=\"showScreenHidePrint\"/><h1 class=\"showScreenHidePrint\">" + GetString("str_Print_Footnotes") + "</h1>" + footnoteHTML;
        }
    }

    return footnoteHTML;
};

KnotiaKnowledge5.DocumentManager.prototype.loadDefinition = function (sDefinitionFetchID) {
    var innerHTML = "<div id=\"definitionDiv\" style=\"width:460px; padding-top:4px;\"><img src=\"../Knowledge/Images/WaitAnimated.gif\" border=\"0\"></div>";
    var div = createCenteredPopupDiv(innerHTML, true, sDefinitionFetchID, null, false, { width: 600, maxHeight: 450 });

    Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetDefinition",
        { "iProductId": this.productID, "sGotoStr": sDefinitionFetchID },
        this.displayDefinition,
        null,
        null,
        this);
};

KnotiaKnowledge5.DocumentManager.prototype.displayDefinition = function (result) {
    if (result == null) {
        return;
    }

    var definitionDiv = $("#definitionDiv");
    if (definitionDiv.length > 0) {
        definitionDiv.html(result.d);

        var popupDiv = $("#popUpDivFromButton");
        var positionOptions = {
            "my": "center",
            "at": "center",
            "of": window
        };

        popupDiv.dialog("option", "position", positionOptions);
    }

    callStateManagerFunctionIfExists("showNoteIconsInDefinitions");
};

KnotiaKnowledge5.DocumentManager.prototype.loadPreview = function (productID, bookID, documentID) {
    var previewDiv = $("#searchPreviewDiv");
    if (previewDiv.length === 0) {
        // note, zoom includes the width/height, so 400x600 is really 200x300
        this.controlJqueryObject.append("<div id='searchPreviewDiv' style='position:absolute; width:650px; height:650px; overflow:scroll; background-color:white; z-index:999999; zoom:50%; border:solid 1px black;'></div>");
        previewDiv = $("#searchPreviewDiv");
    }

    var location = $("#previewIcon_" + productID.toString() + "_" + bookID.toString() + "_" + documentID.toString()).offset();

    previewDiv.css("top", location.top - 20 + this.controlJqueryObject.scrollTop() * 2);
    previewDiv.css("left", location.left + 355);
    previewDiv.html("<img src='/Knowledge/Images/WaitAnimated.gif' border='0'>");

    this.loadDocumentByBookDocumentID(productID, bookID, documentID, this.showPreview);
};

KnotiaKnowledge5.DocumentManager.prototype.showPreview = function (result) {
    var previewDiv = $("#searchPreviewDiv");
    previewDiv.html(result.d.PageHTML.replace(/<a[^>]*>/gi, ""));
};

KnotiaKnowledge5.DocumentManager.prototype.loadOldNewsDocument = function () {
    callStateManagerFunctionIfExists("cancelProcessingTimer");

    Globals.Ajax.postRequest("/Services/ResearchService.svc/Document/GetOldNewsDocument",
        { "iProductID": this.productID, "sFetchID": this.fetchID },
        this.onGetOldNewsDocument,
        null,
        null,
        this);
};

KnotiaKnowledge5.DocumentManager.prototype.onGetOldNewsDocument = function (result) {
    if (result == null) {
        // try just fetching in the product
        this.loadDocumentByGotoString(this.productID, this.fetchID);
    }
    else {
        var aiParams = result.d.split("_");
        window.open("/Knowledge/View/Detail.cfm?ProductID=" + aiParams[0] + "&DocID=" + aiParams[1]);
    }
};

KnotiaKnowledge5.DocumentManager.prototype.confirmDeleteThisDocument = function (iBookID, iDocumentID) {
    var bConfirmDelete = confirm("Are you sure you want to permanenly remove this document?\n\nTHIS CANNOT BE UNDONE.");
    if (bConfirmDelete) {
        var sHost = window.location.toString();
        var i = sHost.indexOf("//") + 2;
        var j = sHost.indexOf("/", i);
        sHost = sHost.substr(i, j - i);
        var sAjaxPage = "https://" + sHost + "/KnowledgeAdmin/EditDocument/DeleteDocumentImmediately.aspx?bookID=" + iBookID + "&documentID=" + iDocumentID;
        window.open(sAjaxPage);
    }
};

KnotiaKnowledge5.DocumentManager.prototype.getNewsDocumentLinkThisDocumentLinkInformation = function (isAdministratorLinks) {
    var linkInformation = {};

    linkInformation.link = {};
    linkInformation.link.Text = null;
    linkInformation.link.Target = null;
    linkInformation.link.Description = null;

    linkInformation.link2 = null;

    linkInformation.doShowFIDOText = false;

    if (document.siteConfiguration && document.siteConfiguration.doPublishStaticPageLinkInArchive) {
        if (this.extraMetadata["AlertNumber"]) {
            linkInformation.link.target = "/news/" + this.extraMetadata["AlertNumber"];
        }
        else {
            linkInformation.link.target = "/Login/ViewEmailDocument.aspx?AlertID=" + this.documentID.toString();
        }
    }
    else {
        linkInformation.link.target = "/Knowledge/News.aspx?AlertID=" + this.documentID.toString();
    }

    linkInformation.link.text = GetString("str_LinkToThisDocument");
    linkInformation.link.description = "";
    linkInformation.doShowFIDOText = false;

    if (document.siteConfiguration.externalSiteDomain == null || document.siteConfiguration.externalSiteDomain == "") {
        // external or regular site, just link
    }
    else {
        // internal version of site
        if (this.extraMetadata["IsInternalOnlyContent"] == "true") {
            if (this.extraMetadata["IsMarkFIDOContent"] == "true") {
                linkInformation.doShowFIDOText = true;
            }
        }

        if (isAdministratorLinks) {
            // link to archive (since SSO makes that seamless anyway)
            linkInformation.link.target = "/Knowledge/News.aspx?AlertID=" + this.documentID.toString();

            if (this.extraMetadata["IsInternalOnlyContent"] == "true") {
                if (this.extraMetadata["IsExternalAndInternalContent"] == "true") {
                    // internal only content, external version exists, link both
                    linkInformation.link.description = "internal link";
                    linkInformation.link2 = {};
                    linkInformation.link2.description = "client link";
                    linkInformation.link2.target = "https://" + document.siteConfiguration.externalSiteDomain + "/news/" + this.extraMetadata["AlertNumber"];
                }
                else {
                    linkInformation.link.description = "internal-only";
                }
            }
            else {
                // general link, link to internal and client
                linkInformation.link.description = "internal link";
                linkInformation.link2 = {};
                linkInformation.link2.description = "client link";
                linkInformation.link2.target = "https://" + document.siteConfiguration.externalSiteDomain + "/news/" + this.extraMetadata["AlertNumber"];
            }
        }
        else {
            if (this.extraMetadata["IsInternalOnlyContent"] == "true") {
                if (this.extraMetadata["IsExternalAndInternalContent"] == "true") {
                    // internal version, but external exists, link to external
                    linkInformation.link.target = "https://" + document.siteConfiguration.externalSiteDomain + "/news/" + this.extraMetadata["AlertNumber"];
                }
                else {
                    // internal-only, no link
                    linkInformation.link = null;
                }
            }
            else {
                // general alert, link to external
                linkInformation.link.target = "https://" + document.siteConfiguration.externalSiteDomain + "/news/" + this.extraMetadata["AlertNumber"];
            }
        }
    }

    return linkInformation;
};

//DISABLE FOR TNU PRD
function getNewsResearchDocumentLinkThisDocumentLinkInformation(isAdministratorLinks) {
    var linkInformation = {};

    linkInformation.link = {};
    linkInformation.link.Text = null;
    linkInformation.link.Target = null;
    linkInformation.link.Description = null;

    linkInformation.link2 = null;

    linkInformation.doShowFIDOText = false;

    if (document.siteConfiguration && document.siteConfiguration.doPublishStaticPageLinkInArchive) {
        if (document.k5doc.fetchID) {
            linkInformation.link.target = "/news/" + document.k5doc.fetchID.toString();
        }
        else {
            linkInformation.link.target = "/Login/ViewEmailDocument.aspx?AlertID=" + document.k5doc.fetchID.toString();
        }
    }
    else {
        linkInformation.link.target = "/Knowledge/News.aspx?AlertID=" + document.k5doc.fetchID.toString();
    }

    linkInformation.link.text = GetString("str_LinkToThisDocument");
    linkInformation.link.description = "";
    linkInformation.doShowFIDOText = false;

    if (document.siteConfiguration == null || document.siteConfiguration.externalSiteDomain == null || document.siteConfiguration.externalSiteDomain == "") {
        // external or regular site, just link
    }
    else {
        // internal version of site
        if (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_IsInternalOnlyContent] == "true") { //IsInternalOnlyContent
            if (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_IsMarkFIDOContent] == "true") { //IsMarkFIDOContent
                linkInformation.doShowFIDOText = true;
            }
        }

        if (isAdministratorLinks) {
            // link to archive (since SSO makes that seamless anyway)
            //linkInformation.link.target = "/Knowledge/News.aspx?AlertID=" + document.k5doc.fetchID.toString();
            //            linkInformation.link.target = "javascript:document.k5doc.loadDocumentByGotoString(document.k5doc.productID," + document.k5doc.fetchID.toString() +lket ", null, null, null, 0, true);";
            //linkInformation.link.target = "loadDocumentByGotoString(document.k5doc.productID, \"" + document.k5doc.fetchID.toString() + "\", null, null, null, 0, true);";
            var pageTarget = "/Knowledge/Home.aspx?ProductID=" + document.k5doc.productID.toString() + "&fetchID=" + document.k5doc.fetchID.toString();

            if (window.glb_EnableFederatedSearch != null && glb_EnableFederatedSearch) {
                pageTarget = "/Knowledge/FederatedSearch.aspx?fetchID=" + document.k5doc.fetchID.toString();
            } 

            linkInformation.link.target = pageTarget;

            if (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_IsInternalOnlyContent] == "true") {
                if (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_IsExternalAndInternalContent] == "true") { //IsExternalAndInternalContent
                    // internal only content, external version exists, link both
                    linkInformation.link.description = "internal link";
                    linkInformation.link2 = {};
                    linkInformation.link2.description = "client link";
                    linkInformation.link2.target = "https://" + document.siteConfiguration.externalSiteDomain + "/news/" + document.k5doc.fetchID.toString();
                }
                else {
                    linkInformation.link.description = "internal-only";
                }
            }
            else {
                // general link, link to internal and client
                linkInformation.link.description = "internal link";
                linkInformation.link2 = {};
                linkInformation.link2.description = "client link";
                linkInformation.link2.target = "https://" + document.siteConfiguration.externalSiteDomain + "/news/" + document.k5doc.fetchID.toString();
            }
        }
        else {
            if (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_IsInternalOnlyContent] == "true") {
                if (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_IsExternalAndInternalContent] == "true") {
                    // internal version, but external exists, link to external
                    linkInformation.link.target = "https://" + document.siteConfiguration.externalSiteDomain + "/news/" + document.k5doc.fetchID.toString();
                }
                else {
                    // internal-only, no link
                    linkInformation.link = null;
                }
            }
            else {
                // general alert, link to external
                linkInformation.link.target = "https://" + document.siteConfiguration.externalSiteDomain + "/news/" + document.k5doc.fetchID.toString();
            }
        }
    }

    //old alert manually imported to KC that cannot be linked to
    if (document.k5doc.alertExtraMetadata[Globals.AlertExtraMetadata.Key_alertID] == null) {
        linkInformation.link = null;
    }

    return linkInformation;
};
//DISABLE FOR TNU PRD

//DOWNLOAD DOCUMENT MANAGER//
KnotiaKnowledge5.DocumentManager.prototype.createPOSTSubmitFormText = function (urlToPost, VariablesToSubmit) {
    var formText = "<form method=\"POST\" action=\"" + urlToPost + "\">";
    for (var formVariableName in VariablesToSubmit) {
        formText += "<input type=\"hidden\" name=\"" + formVariableName + "\" value=\"" + VariablesToSubmit[formVariableName] + "\">";
    }

    formText += "</form>";
    return formText;
}

KnotiaKnowledge5.DocumentManager.prototype.downloadNewsDocument_onclick = function (alertID, alertTitle, alertNumber, alertDate) {

    if (alertID == null) {
        alertID = document.k5doc.documentID;
    }
    if (alertTitle == null) {
        alertTitle = document.k5doc.extraMetadata["AlertTitle"];
    }
    if (alertNumber == null) {
        alertNumber = document.k5doc.extraMetadata["AlertNumber"];
    }
    if (alertDate == null) {
        alertDate = document.k5doc.extraMetadata["AlertDate"];
    }

    var serviceParams = {
        'alertID': alertID,
        'alertTitle': alertTitle,
        'alertNumber': alertNumber,
        'alertDate': alertDate
    };

    Globals.Ajax.postRequest("/Services/NewsService.svc/DownloadNewsDocument", serviceParams, this.downloadNewsDocument_success, this.downloadNewsDocument_error, null);
};

KnotiaKnowledge5.DocumentManager.prototype.downloadNewsDocument_success = function (result) {
    //path of the created document
    result = result.d;
    //success
    if (result) {
        //send filepath of created document
        var parametersToPass = {
            filePath: result
        };
        var formObj = $(createPOSTSubmitFormText("/Knowledge/NewsExport.aspx/", parametersToPass));
        $("body").append(formObj);
        formObj.submit();
        formObj.remove();
    }
}

KnotiaKnowledge5.DocumentManager.prototype.downloadNewsDocument_error = function (result) {
}
//DOWNLOAD DOCUMENT MANAGER//

// methods are in content, so shouldn't be part of the DocumentManager

function createPOSTSubmitFormText(urlToPost, VariablesToSubmit) {
    var formText = "<form method=\"POST\" action=\"" + urlToPost + "\">";
    for (var formVariableName in VariablesToSubmit) {
        formText += "<input type=\"hidden\" name=\"" + formVariableName + "\" value=\"" + VariablesToSubmit[formVariableName] + "\">";
    }

    formText += "</form>";
    return formText;
}

function CreateFetchLink(objFetchLink, iBookID, sGotoStr, bTryNewsOnFailure) {
    document.k5doc.createFetchLink(objFetchLink, iBookID, sGotoStr, bTryNewsOnFailure);
}

function CreateDocumentLink(sLinkType, objActiveLink, xIgnore, sSearchString, sDetails) {
    if (sLinkType.toLowerCase() == "defn" || sLinkType.toLowerCase() == "def") {
        objActiveLink.href = "javascript:document.k5doc.loadDefinition('" + encodeURIComponent(sSearchString).replace(/'/g, "\\'") + "');";
    }
    else {
        objActiveLink.href = "javascript:;";
    }
}

function CreateAttachmentLink(objAttachmentLink, iBookID, sFileName) {
    if (!document.k5doc) {
        objAttachmentLink.href = "javascript:;";
        return;
    }
    //replacing escape with encodeURIComponent 
    
    //Encoding Set: escape uses ISO Latin, whereas encodeURIComponent encodes based on UTF-8, making the latter suitable for internationalized content.
    //Use Case: escape is outdated and should not be used for modern web applications, particularly for URL encoding.encodeURIComponent is the recommended function for encoding URL components.
    //Accuracy and Safety: encodeURIComponent is more accurate and safe for encoding URL components, as it encodes almost all characters that could be misinterpreted in a URL.
    //
    //on the server side we are testing another way to decide the attachment name, to revert to previous way add parameter useClassic=1
    objAttachmentLink.href = "/Knowledge/View/Attachment.aspx?&productID=" + document.k5doc.productID + "&bookID=" + iBookID + "&ftID=" + encodeURIComponent(sFileName);
    objAttachmentLink.setAttribute("target", "_blank");
}

function popupFootnote(ignore1, ignore2, footnoteID) {
    document.k5doc.displayFootnote(footnoteID);
}

function MDP(objParagraphSpan) {
    var iMouseButton = ((window.event) ? ((window.event.button) ? (window.event.button) : (window.event.which)) : (arguments.callee.caller.arguments[0].button + 1));
    document.k5doc.mouseDownParagraph(objParagraphSpan, iMouseButton);
}
function MUP(objParagraphSpan) {
    var iMouseButton = ((window.event) ? ((window.event.button) ? (window.event.button) : (window.event.which)) : (arguments.callee.caller.arguments[0].button + 1));
    document.k5doc.mouseUpParagraph(objParagraphSpan, iMouseButton);
}
function MOP(objParagraphSpan) { }
function MPP(objParagraphSpan) { }

/* methods are in strange content (see individual comments), so shouldn't be part of the DocumentManager */

// NOTE this is used in news documents, so it appears in What's New, and Newsletters -- for Newsletters, make sure the version in "/Knowledge/View/_IncludeFiles/Scripts/Document.js"
// also behaves sensibly (so that fetch links in CTL where the user is not logged in will also work)
function doFetch(sFetchID) {
    var thisPage = window.location.toString().toLowerCase();
    var thisPageKtype = 0;

    if (arguments.length == 1) {
        if (thisPage.indexOf("ktype=") >= 0) {
            thisPageKtype = parseInt(thisPage.substring(thisPage.indexOf("ktype=") + 6, thisPage.length), 10);
        }
    }
    else if (arguments.length == 2) {
        thisPageKtype = parseInt(arguments[1], 10);
    }

    if (this.productID == thisPageKtype) {
        this.loadDocumentByGotoString(this.productID, sFetchID);
    }
    else {
        loadPage("/Knowledge/Home.aspx?ProductID=" + thisPageKtype + "&FetchID=" + escape(sFetchID));
    }
}

// backwards compatibility with links in EY commentary
function ShowAttachment(objActiveLink, fileName) {
    CreateAttachmentLink(objActiveLink, 0, unescape(fileName));
}

function loadExternalUrl(sURL) {
    window.open(sURL);
}

function popupFootnoteDB(ignore1, ignore2, ignore3, footnoteID) {
    this.displayFootnote(footnoteID);
}

// news documents are posted with popup links like this -- it is here for News and What's New
function doPopup(windowText) {
    var imgWindow;
    imgWindow = open("", "", "width=420,height=250,scrollbars=yes");
    imgWindow.document.open();
    imgWindow.document.write(windowText + "<p>");
    imgWindow.focus();
}

// helper
function CreateAttachmentLinkSpecialAccess(sAccessCode, objActiveLink, persistentBookIdentifier, fileName) {
    fileName = escape(fileName);

    var iCurrentBookId = persistentBookIdentifier;
    var sRandomValue = "";
    var sHashValue = "";

    objActiveLink.href = "../Login/ViewEmailDocumentAttachment.aspx?productID=" + document.iCurrentProductId + "&bookID=" + iCurrentBookId + "&ftID=" + fileName + "&fnID=" + sAccessCode;
}




/*///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Name:    useElasticsearch()
//
// Desc:    This method will check whether or not to use elasticsearch for the query passed
///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
function useElasticsearch(iNodeID) {

    var searchWithElastic = false;

    var esEnabled = typeof glb_EnableElasticsearch != "undefined" && glb_EnableElasticsearch == 1;

    //THIS NEEDS TO BE CHANGED. PASS AN OBJECT FROM THE TOC INSTEAD OF ADDING DRAFT TO THE NODE TEXT
    //FROM THE DB
    var isDraft = false;
    if (typeof iNodeID != "undefined") {
        isDraft = ($("#K5TreeViewNode_N" + iNodeID).text().trim().indexOf("(Draft)") == 0);
    }

    if (!isDraft) {
        if (glb_ShowSearchProviderToggle) {
            var searchProvider = 0;

            if (Globals.Cookies.exists(document.k5doc.SearchPreferenceCookieName)) {

                var _data = Globals.Cookies.readCookie(document.k5doc.SearchPreferenceCookieName);

                if (!Globals.Utilities.isUndefinedOrNull(_data)) {
                    searchProvider = _data.SearchProvider;
                }
            }

            searchWithElastic = searchProvider > 0;
        }
        else {
            if (esEnabled) {
                searchWithElastic = true;
            }
        }

        if (typeof document.k5search != "undefined") {
            searchWithElastic = searchWithElastic && document.k5search.searchTypeIsHandledByElastic();
        }
    }
    return searchWithElastic;
};
;
KnotiaKnowledge5.EmailDocumentManager = function () {
	this.rememberedUserEmail = null;
	this.rememberdDialogID = null;
	document.k5email = this;
};

//Displays the "email document" pop-up from the News toolbar
//if-zilla ... added JS css classes to textboxes/buttons (actual if-zilla is handled in the Globals.UI.js file)
KnotiaKnowledge5.EmailDocumentManager.prototype.showEmailDocumentForm = function (alertID, docTitle, associatedToolbarButtonID) {
	
	var limitMessage = GetString("str_ReceipientEmailNote");

	var emailAddressCountLimit = this.getForwardEmailToAddressCountLimit();

	if (emailAddressCountLimit != 3) {
		limitMessage = limitMessage.replace(/ 3 /, " " + emailAddressCountLimit.toString() + " ");
	}

	var htmlForm = "<form id=\"emailNewsDocForm\">";
	htmlForm += "<input type=\"hidden\" id=\"hdnAlertID\" value=\"" + alertID.toString() + "\" />";
	htmlForm += "<input type=\"hidden\" id=\"hdnUserEmail\" value=\"\" />";
	htmlForm += "<div id=\"emailNewsDoc\">";
	htmlForm += "<table padding=\"1px\" id=\"emailTable\">";
	htmlForm += "<tr><td class=\"formLabel\" data-style=\"text-align:right; height:25px; width:200px;\">";
	htmlForm += GetString("str_YourEmail") + GetString("str_Colon") + "</td>";
	htmlForm +=	"<td class=\"MostNormal\" id=\"displayUserEmail\"></td></tr>";
	htmlForm +=	"<tr valign=\"top\"><td class=\"formLabel\" data-style=\"text-align:right; height:50px;\">";
	htmlForm += GetString("str_ReceipientEmail") + GetString("str_Colon") + "</td>";
	htmlForm += "<td id=\"tdEmailRecipients\"><textarea id=\"emailRecipients\" data-style=\"width:220px; height:38px;\" class=\"normalFixed js--textbox--adjust-width js--textbox--round-corners\"></textarea>";
	htmlForm += "<br><span class=\"formNote\" data-style=\"width:200px;\">";
	htmlForm += limitMessage + "</span></td></tr>";
	htmlForm += "<tr> <td class=\"formLabel\" data-style=\"text-align:right; height:25px;\">";
	htmlForm += GetString("str_SendCopy") + GetString("str_Colon") + "</td>";
	htmlForm += "<td><input type=\"checkbox\" id=\"sendMeCopy\" /></td></tr>";
	htmlForm += "<tr valign=\"top\"><td class=\"formLabel\" data-style=\"text-align:right;\">";
	htmlForm += GetString("str_Subject") + GetString("str_Colon") + "</td>";
	htmlForm += "<td><textarea id=\"emailSubject\" data-style=\"width:220px; height:38px;\" class=\"normalFixed js--textbox--adjust-width js--textbox--round-corners\">";
	htmlForm += docTitle + "</textarea></td></tr>";
	htmlForm += "<tr valign=\"top\"><td class=\"formLabel\" data-style=\"text-align:right;\">";
	htmlForm += GetString("str_PersonalMsg") + GetString("str_Colon") + "<br/>(";
	htmlForm += GetString("str_Optional") + ")</td><td>";
	htmlForm += "<textarea id=\"emailMessage\" data-style=\"width:220px; height:38px;\" class=\"normalFixed js--textbox--adjust-width js--textbox--round-corners\"></textarea></td></tr>";
	htmlForm += "<tr><td class=\"formLabel js--button--align-wrapper\" data-style=\"text-align:right;\" colspan=\"2\">";
	htmlForm += "<input type=\"button\" id=\"btnSendEmail\" class=\"normalFixed js--button--convert-to-jQuery js--email-document-manager-send-email\" ";
	htmlForm += "data-style=\"width:z75px;margin-top:20px; margin-right:5px;\" value=\"";
	htmlForm += GetString("str_Send") + "\" />";
	htmlForm += "<input type=\"button\" id=\"btnCancelEmail\" class=\"normalFixed js--button--convert-to-jQuery js--email-document-manager-cancel-email\" data-style=\"width:75px;margin-top:20px;\" ";
	htmlForm += "value=\"";
	htmlForm += GetString("str_Cancel") + "\" /></td></tr></table>";
	htmlForm += "<p class=\"formNote\"><b>Note" + GetString("str_Colon") + " </b>" + GetString("str_NoteEmailMsg") + "</p>";
	htmlForm += "</div></form>";

	this.rememberdDialogID = Globals.UI.showSimpleDialog(htmlForm, GetString("str_ucTB_EmailDoc"), 620, 388);
	Globals.UI.knotiaFlatModernizeStandardButtons("#emailNewsDoc");

	Globals.Utilities.generateInlineStylesFromDataStyles();

	$("#dialog_" + this.rememberdDialogID).on("click", ".js--email-document-manager-send-email", function () {
		document.k5email.handleSendEmailClick();
	});

	$("#dialog_" + this.rememberdDialogID).on("click", ".js--email-document-manager-cancel-email", function () {
		document.k5email.handleCancelEmailClick()
	});

	if (this.rememberedUserEmail == null) {
		Globals.Ajax.postRequest("/Services/NewsService.svc/GetUserEmailAddress",
			null,
			this.rememberUserEmail,
			this.displayUserEmailField, // if user is on the not-logged-in page, just ask for their email address
			null,
			this,
			null,
			true);
	}
	else {
		this.displayUserEmail();
	}
};

KnotiaKnowledge5.EmailDocumentManager.prototype.rememberUserEmail = function (result) {
	this.rememberedUserEmail = result.d;
	this.displayUserEmail();
};

KnotiaKnowledge5.EmailDocumentManager.prototype.displayUserEmail = function () {
	$("#hdnUserEmail").val(this.rememberedUserEmail);
	$("#displayUserEmail").text(this.rememberedUserEmail);
};

KnotiaKnowledge5.EmailDocumentManager.prototype.displayUserEmailField = function () {
	var emailField = $("#hdnUserEmail").remove();
	$("#displayUserEmail").html(emailField);
	$("#hdnUserEmail").attr("type", "text");
	$("#hdnUserEmail").width($("#emailRecipients").width());
};

KnotiaKnowledge5.EmailDocumentManager.prototype.showEmailDocumentFormError = function (errorMessage) {
	var errorText = $("#errorText");

	$("#emailRecipients").css({ "border": "1px solid red" });

	if (errorText.length > 0) {
		errorText.html(errorMessage);
	}
	else {
		errorText = $("<p id='errorText' class='formError' data-style='text-align:center;'>" + errorMessage + "</p>");
		$("#tdEmailRecipients").append(errorText);

		Globals.Utilities.generateInlineStylesFromDataStyles();
	}
};


KnotiaKnowledge5.EmailDocumentManager.prototype.handleSendEmailClick = function () {
	var emailRecipients = $("#emailRecipients").val();
	var emailRecipientsArray = emailRecipients.split(',');
	var regExFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var bProceed = true;

    //DISABLE FOR TNU ARCHIVE ON PRD. THIS IS ONLY FOR BETA
    //if (document.k5.productID == 27 || document.k5.productID == 29) {
    //    alert("Email sharing is currently disabled. Please contact an administrator if you can see this message.");
    //    bProceed = false;
    //}
    //DISABLE FOR TNU ARCHIVE ON PRD. THIS IS ONLY FOR BETA

	if (emailRecipients.length === 0) {
		bProceed = false;
	}

	for (var i = 0; i < emailRecipientsArray.length && bProceed === true; i++) {
		//remove spaces from emails
		emailRecipientsArray[i] = emailRecipientsArray[i].replace(' ', '');

		//validate correct email
		if (!regExFilter.test(emailRecipientsArray[i])) {
			this.showEmailDocumentFormError(GetString("str_BadEmailFormatting") + emailRecipientsArray[i]);
			bProceed = false;
		}
	}

	var emailAddressCountLimit = this.getForwardEmailToAddressCountLimit();
	var limitMessage = GetString("str_TooManyEmailAddresses");
	if (emailAddressCountLimit != 3) {
		limitMessage = limitMessage.replace(/ 3 /, " " + emailAddressCountLimit.toString() + " ");
	}
	if (emailRecipientsArray.length > emailAddressCountLimit) {
		this.showEmailDocumentFormError(limitMessage);
		bProceed = false;
	}

	if (bProceed) {
		var alertID = $("#hdnAlertID").val();
		var emailRecipients = $("#emailRecipients").val();
		var emailSubject = $("#emailSubject").val();
		var emailMessage = $("#emailMessage").val();
		var bSendMeACopy = $("#sendMeCopy").is(":checked");

		this.emailNewsDocument(alertID, emailRecipients, emailSubject, emailMessage, bSendMeACopy);
	}
};


KnotiaKnowledge5.EmailDocumentManager.prototype.handleCancelEmailClick = function () {
	if (this.rememberdDialogID != null) {
		Globals.UI.closejQueryToolbarDialog(this.rememberdDialogID);
	}
	else {
		Globals.UI.closejQueryToolbarDialog("tsi_share_emaildocument");
	}
};


KnotiaKnowledge5.EmailDocumentManager.prototype.emailNewsDocument = function (alertID, emailRecipients, emailSubject, emailMessage, bSendMeACopy) {
	$('#btnSendEmail').attr('disabled', 'disabled');
	$('#btnCancelEmail').attr('disabled', 'disabled');

	var passSenderEmail = "";
	var senderInputField = $("input[type=text]#hdnUserEmail");
	if (senderInputField.length > 0) {
		passSenderEmail = senderInputField.val();
	}

	var serviceParams = {
		'alertID': alertID,
		'emailRecipients': emailRecipients,
		'emailSubject': emailSubject,
		'emailMessage': emailMessage,
		'bSendMeACopy': bSendMeACopy,
		'emailSender': passSenderEmail
	};

	Globals.Ajax.postRequest("/Services/NewsServiceNotLoggedIn.svc/EmailNewsDocument", serviceParams, this.emailNewsDocument_success, this.emailNewsDocument_error, "/Services/NewsService.svc/EmailNewsDocument");
};

KnotiaKnowledge5.EmailDocumentManager.prototype.emailNewsDocument_success = function (result) {
	var me = document.k5email;

	var deliveredEmailAddresses = result.d[0];
	var rejectedEmailAddresses = result.d[1];

	var html = "";

	if (deliveredEmailAddresses != null && deliveredEmailAddresses.length > 0) {
		html += "<p class='MostNormal'><b>" + GetString("str_EmailSent") + GetString("str_Colon") + "</b><br/>";
		for (var i = 0; i < deliveredEmailAddresses.length; i++) {
			html += deliveredEmailAddresses[i] + "<br/>";
		}
		html += "</p>";
	}

	if (rejectedEmailAddresses != null && rejectedEmailAddresses.length > 0) {
		//if (html.length > 0) {
		//	html += "<p class='MostNormal bolded' style='padding-bottom:10px;'>&nbsp;</p>";
		//}

		html += "<p class='MostNormal'><b>This internal-only alert could not be delivered to these external addresses:</b><br/>";
		for (var i = 0; i < rejectedEmailAddresses.length; i++) {
			html += rejectedEmailAddresses[i] + "<br/>";
		}
		html += "</p>";
	}

	html += "<p data-style=\"text-align:right;\"><input type=\"button\" id=\"btnOK\" class=\"normalFixed js--button--convert-to-jQuery js--email-document-manager-cancel-email\" data-style=\"width:75px;\" value=\"";
	html += GetString("str_Print_Close") + "\"/></p>";

	$("#emailNewsDoc").html(html);

	$("#dialog_" + this.rememberdDialogID).on("click", ".js--email-document-manager-cancel-email", function () {
		document.k5email.handleCancelEmailClick()
	});

	Globals.Utilities.generateInlineStylesFromDataStyles();
	Globals.UI.knotiaFlatModernizeStandardButtons("#emailNewsDoc");
};

KnotiaKnowledge5.EmailDocumentManager.prototype.emailNewsDocument_error = function (error) {
	//alert("something bad happened...");
	Svc_Global_Error(error, "document.k5toolbar.newsButtons.emailNewsDocument", false);
	Globals.UI.closejQueryToolbarDialog("tsi_share_emaildocument");
};

KnotiaKnowledge5.EmailDocumentManager.prototype.getForwardEmailToAddressCountLimit = function () {
	var doUseBucketTreeview = callStateManagerFunctionIfExists("useBucketTreeview");
	if (doUseBucketTreeview == null) {
		// static page, email link is only available for bucket-type sites
		return 20;
	}

	if (doUseBucketTreeview) {
		return 20;
	}

	return 3;
};;
