// This sorts the TOC for Expere Authoring Changelog pages

// Style ChangelogNav to float right and have blue background
// THIS WILL WORK IF THE TABLES ARE MADE TO SIMPLETABLES AS IN 2018.1.0
$('.ChangelogNav').wrap($('<div class="clToc"></div>'));
// $('.cl_section').wrap($('<div class="clContent"</div>'));
$('.ChangelogNav').css({
	'background-color': 'rgb(0,122,195)',
	'border-radius': '10px',
	'padding': '10px 20px'
});
$('.ChangelogNav').children().css({
	'color': 'white'
});
$('.ChangelogNav').find('a').css('color', 'white');
$('.clToc').css({
	'float': 'right',
	'width': '40%'
});
$('.ExpereRN').css({
	'margin-top': '40px'
});
$('.sthead > .stentry').css({
	'color': 'rgb(0,122,195)',
	'font-size': '2.2rem'
});
// $('.cl_section').wrap('<div class="myDiv"></div>')
$('.clToc').prependTo('.clContent');
// $('.wh_content_area, .wh_topic_content').css('width',"98%");



// sortChangelogNav();
sortChangelogNavEnhancements();
sortChangelogNavDefects();


function sortChangelogNav() {
	var myClList = $('[id*="_ChangelogNav"]');
	var ClListItems = myClList.children('li').get();
	ClListItems.sort(function(a, b) {
	return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase());
	})
	$.each(ClListItems, function(idx, itm) { myClList.append(itm); });
}
function sortChangelogNavEnhancements() {
	var myEnhlist = $('[id*="_ChangelogNavEnhancements"]');
	var EnhListItems = myEnhlist.children('li').get();
	EnhListItems.sort(function(a, b) {
	return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase());
	})
	$.each(EnhListItems, function(idx, itm) { myEnhlist.append(itm); });
}
function sortChangelogNavDefects() {
	var myDeflist = $('[id*="_ChangelogNavDefects"]');
	var DefListItems = myDeflist.children('li').get();
	DefListItems.sort(function(a, b) {
	return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase());
	})
	$.each(DefListItems, function(idx, itm) { myDeflist.append(itm); });
}
