//wkfs-resp_afterbody.js
// 
// TODO:
// - 
// 



$(window).on("load", function () {
	// console.log("Window Loaded.");

		//Get the browser and version. Alert if unsupported.
		// $.getScript("/resources/webhelp-includes/modules/browser-version.js"); 
});

// window.addEventListener('beforeunload', function (e) {
//     e.preventDefault();
// 	console.log('Closing?');
// 	setCookie('audience', '', 0);
// 	setCookie('product', '', 0);
// 	setCookie('revision', '', 0);
//     // e.returnValue = '';
// });

// $(window).on('unload', function () {
// 	window.alert('help');
// });


$(document).ready(function() {
	// The following commands instruct this javascript page to "include" the associated files.
	// The included js files are fairly intuitive in understanding their function by filenames
	// alone. However, additional information is provided in a comment above each include.
	// 
	// To disable a whole feature, comment the desired line by placing two slashes at the beginning,
	// as is done with this line.

	// console.log("document ready.");

	// Load Cookie functions
	$.get("/resources/webhelp-includes/modules/cookies.js");

	// Cookie Banner
	$.get("/resources/webhelp-includes/modules/cookie-banner.js");

	// Server Maintenance message
	$.get("/resources/webhelp-includes/modules/server-maintenance.js");

	// Reload the page from the server
	// $.getScript("/resources/webhelp-includes/modules/reload-page.js"); 

	// Reload the page from the server
	// $.getScript("/resources/webhelp-includes/modules/reload-page.js"); 

	// Loader
	// $.getScript("/resources/webhelp-includes/modules/loader.js");
	// $('.loader').remove();

	// This code adds a new class (wkfs_title) to the publication title for modifying its styles.
	$.getScript("/resources/webhelp-includes/modules/modify-publication-title.js");

	// Get all the variables assigned in the page URL
	$.getScript("/resources/webhelp-includes/modules/get-url-parameters.js");

	// Provide the functionality for webhelp that relies on InfoDev's Dynamic Profiling.
	$.getScript("/resources/webhelp-includes/modules/dynamic-profiling.js");

	//Add favicon to page
	$.getScript("/resources/webhelp-includes/modules/favicon.js");

	// Create the Back To Top arrow displayed after the user scrolls 300 pixels.
	$.getScript("/resources/webhelp-includes/modules/back-to-top.js");

	// Modifies the logo to display the new round logo.
	$.getScript("/resources/webhelp-includes/modules/modify-header-logo.js");

	// Create Font size buttons
	// $.getScript("/resources/webhelp-includes/modules/font-size.js");

	// This code modifies all header items to the right of the logo. This is used to create and 
	// place the smaller search bar on the same line as the document title.
	$.getScript("/resources/webhelp-includes/modules/modify-wh_publication_title.js");

	// Modify the search button to have it conform to the new small search bar.
	$.getScript("/resources/webhelp-includes/modules/header-search-button.js");

	
	

	// ========== HEADER DOCUMENT LINKS
	// Add links to header
	// $.getScript("/resources/webhelp-includes/modules/header-documentation-links.js");
	// ========== END HEADER DOCUMENT LINKS




	// // Modifies the breadcrumbs to hide all parent titles
	// $.getScript("/resources/webhelp-includes/modules/breadcrumbs.js");

	// This code creates the Search Tips button (on the search bar) and div that slides out from
	// the right side of the page when the button is clicked.
	$.getScript("/resources/webhelp-includes/modules/search-tips.js");

	// Removes the table numbers from all pages, as we do not use them.
	$.getScript("/resources/webhelp-includes/modules/remove-table-numbers.js");

	// Cause the footer - on index page only - to always display on the bottom, rather 
	// than seeing it only after scrolling to the bottom.
	$.getScript("/resources/webhelp-includes/modules/sticky-index-footer.js");

	// Create the sidebar buttons that appear on the right side of each page.
	// If any individual button needs to be disabled, comment all code under the separated button
	// code within the sidebar.js file.
	$.getScript("/resources/webhelp-includes/modules/sidebar.js");

	// Provide the ability to open PDFs in a new tab
	//$.getScript("/resources/webhelp-includes/modules/show-pdf.js");

	// 
	// $.getScript("/resources/webhelp-includes/modules/get-search-parameters.js");

	// Create an important message tile on the index page if a tile's title contains the text
	// "Important Message".
	$.getScript("/resources/webhelp-includes/modules/important-message.js");

	// Create the slideout div that is displayed when the Was This Helpful sidebar button is clicked.
	$.getScript("/resources/webhelp-includes/modules/was-this-helpful.js");

	// Display a notice that Live Chat is available. The amount of time before displaying can be set
	// within the script file.
	// $.getScript("/resources/webhelp-includes/modules/live-chat-notice.js");

	// Create the Feedback slideout box that appears when the user clicks the Feedback sidebar button.
	$.getScript("/resources/webhelp-includes/modules/feedback.js");

	// Create the Live Chat slideout box that appears when the user clicks the Live Chat sidebar button.
	$.getScript("/resources/webhelp-includes/modules/live-chat.js");

	//Remove the default oXygen webhelp printer link icon
	// $.getScript("/resources/webhelp-includes/modules/remove-printer-link.js");
	
	// Expand collapsible tables by default.
	// $.getScript("/resources/webhelp-includes/modules/expand-tables.js");

	// Remove the topic TOC for select artifacts
	$.getScript("/resources/webhelp-includes/modules/securityadmin-and-workflow.js");

	// Remove the topic toc from the Expere Authoring changelog pages.
	$.getScript("/resources/webhelp-includes/modules/expere-authoring-topic-toc-removal.js");

	// Sort the TOC for Expere Authoring Changelog pages
	$.getScript("/resources/webhelp-includes/modules/sort-changelog-nav.js");

	// Makes the titles of collapsible sections clickable.
	$.getScript("/resources/webhelp-includes/modules/expand-collapse-titles.js");

	// Record all webhelp searches to an InfoDev database.
	// $.getScript("/resources/webhelp-includes/modules/send-search-to-db.js");

	// Reformat an index page tile if the tile's title contains "Top FAQs".
	// $.getScript("/resources/webhelp-includes/modules/top-faqs.js");

	// run permission mapping for STS
	$.getScript("/resources/webhelp-includes/modules/permission-mapping.js");

	// Create a keyboard shortcut for accessing STS login.
	$.getScript("/resources/webhelp-includes/modules/webauth-permissions-shortcut.js");

    // Format general images
	$.getScript("/resources/webhelp-includes/modules/general-images.js");
	
	// format footer
	$.getScript("/resources/webhelp-includes/modules/footer.js");

	// Show the Short Description on topic pages
	// $.getScript("/resources/webhelp-includes/modules/show-shortdesc.js");

	// Ensure that the content area is displayed after the load graphic disappears.
	// $.getScript("/resources/webhelp-includes/modules/unhide-content-area.js");
	
	// Hide any tiles on the index page that appear empty.
	$.getScript("/resources/webhelp-includes/modules/hide-blank-tiles.js");

	// $.getScript("/resources/webhelp-includes/modules/refresh.js");

	// Send Google Analytics code
	$.getScript("/resources/webhelp-includes/modules/ga.js");

	// Create Changelog TOC
	$.getScript("/resources/webhelp-includes/modules/changelog-toc.js");

	// Add filter for Expere Authoring Changelog
	$.getScript("/resources/webhelp-includes/modules/changelog-filter.js");

	// DDV Changelog customizations
	//$.getScript("/resources/webhelp-includes/modules/ddv-changelog.js");

		// Modifies the breadcrumbs to hide all parent titles
	// $.getScript("/resources/webhelp-includes/modules/breadcrumbs.js");




});


// $(window).unload(function(){
// 	alert('Bye.');
//   });

// $(window).bind('beforeunload', function(){
// 	alert("Closing - Expire cookies");
// 	setCookie('audience', '', 0);
// 	setCookie('product', '', 0);
// 	setCookie('revision', '', 0);
// });


// window.onbeforeunload = function(e) {
// 	var dialogText = 'are you sure?';
// 	e.returnValue = dialogText;
// 	return dialogText;
// 	alert("Closing - Expire cookies");
// 	setCookie('audience', '', 0);
// 	setCookie('product', '', 0);
// 	setCookie('revision', '', 0);
//   };