if (EMCKickstart === undefined) {
                var EMCKickstart = {};
            }
        EMCKickstart.webhelpLocales = {"en-us": true};
/**
 To add a topic, just add a line like:
 "key" : "url",
 That's the key in quotes, a colon, the url in quotes, followed by a comma.
 You can add comments by prefixing the line with double slash (//).
 **/
EMCKickstart.webhelpMap = {
	// Main Help File
	"main": "index.html",
	"NASServerProp_EventsPublishing": "esd_c_mt_unisph_file_about_events_publishing.html",

    // this is here so you don't have to worry about trailing commas
    "dummy": "/"
};

try {
	/**
	 * If an old URL is given, redirect to the corresponding topic from the WebHelp Responsive
	 */

	let actualLocation = encodeURIComponent(window.location.href);
	let newLocation;

	if (actualLocation.match(/[\w\.\-%]+\.htm(l)?%3F(topic|context)%3D([\w#\-]+)/gi) != null) {
		let linkSearchPosition = actualLocation.lastIndexOf("%3F");
		let linkTopicPosition = actualLocation.lastIndexOf("%2F");

		if (linkSearchPosition !== -1) {
			let linkSearch = actualLocation.substr(linkSearchPosition, actualLocation.length);
			let resourceId = linkSearch.split('%3D')[1];

			if (resourceId != null) {
				resourceId = ValidateAndSanitize(resourceId);
				$.each(EMCKickstart.webhelpMap, function (key, value) {
					if (key === resourceId) {
						newLocation = actualLocation.substr(0, linkTopicPosition) + "/" + encodeURIComponent(value);
						window.location.replace(decodeURIComponent(newLocation));
					}
				});
			}
		}
	}

	if (actualLocation.indexOf('%2F%23') !== -1) {
		newLocation = encodeURIComponent(actualLocation.replace(/%2F%23/g, "/%2F"));
		newLocation = newLocation.replace(/%5B/g, '[').replace(/%5D/g, ']');
		window.location.replace(decodeURIComponent(newLocation));
	}

	if (actualLocation.match(/%2Findex\.(.*)%23/gi)!=null) {
		newLocation = actualLocation.replace(/%2Findex\.(.*)%23/gi, "%2F");
		newLocation = newLocation.replace(/%5B/g, '[').replace(/%5D/g, ']');
		window.location.replace(decodeURIComponent(newLocation));
	}

} catch (err) {
	console.log("error occured : \n");
	console.log(err.message);
}
		