function upgradeSubtabs(subtabs, openPage) {
	if (openPage === undefined)
		openPage = window.location.hash.substr(1);

	var links = subtabs.querySelectorAll("a.tab");

	if (openPage && !subtabsHasPage(subtabs, openPage))
		return;

	var first;
	var gotActive = false;

	for (var i = 0; i < links.length; i++) {
		var link = links[i];
		if (link.classList.contains("external"))
			continue;

		var page = link.getAttribute("data-tab");
		if (!page)
			continue;

		if (!openPage)
			openPage = page;
		if (!first)
			first = link;

		var subtab = document.getElementById("tab-" + page);
		if (!subtab)
			continue;

		var show = page == openPage;
		upgradeSubtabPage(subtab, page, show);

		if (show) {
			link.classList.add("active");
			gotActive = true;
		}
		else
			link.classList.remove("active");
	}

	if (!gotActive && first) {
		first.classList.add("active");
		var page = first.getAttribute("data-tab");
		upgradeSubtabPage(document.getElementById("tab-" + page), page, true);
	}
}
/**
 * @param {HTMLElement} subtabs
 * @param {string} [openPage] the page to open by default or undefined to resolve from hash. If not found, the first page will be shown instead.
 */
@param {HTMLElement} subtabs
@param {string} [openPage] the page to open by default or undefined to resolve from hash. If not found, the first page will be shown instead.
@param { HTMLElement } subtabs @param { string } [ openPage ] the page to open by default or undefined to resolve from hash . If not found the first page will be shown instead .
function upgradeSubtabs(subtabs, openPage) {
	if (openPage === undefined)
		openPage = window.location.hash.substr(1);
	var links = subtabs.querySelectorAll("a.tab");
	if (openPage && !subtabsHasPage(subtabs, openPage))
		return;
	var first;
	var gotActive = false;
	for (var i = 0; i < links.length; i++) {
		var link = links[i];
		if (link.classList.contains("external"))
			continue;
		var page = link.getAttribute("data-tab");
		if (!page)
			continue;
		if (!openPage)
			openPage = page;
		if (!first)
			first = link;
		var subtab = document.getElementById("tab-" + page);
		if (!subtab)
			continue;
		var show = page == openPage;
		upgradeSubtabPage(subtab, page, show);
		if (show) {
			link.classList.add("active");
			gotActive = true;
		}
		else
			link.classList.remove("active");
	}
	if (!gotActive && first) {
		first.classList.add("active");
		var page = first.getAttribute("data-tab");
		upgradeSubtabPage(document.getElementById("tab-" + page), page, true);
	}
}
function upgradeSubtabs ( subtabs , openPage ) { if ( openPage === undefined ) openPage = window . location . hash . substr ( 1 ) ; var links = subtabs . querySelectorAll ( "a.tab" ) ; if ( openPage && ! subtabsHasPage ( subtabs , openPage ) ) return ; var first ; var gotActive = false ; for ( var i = 0 ; i < links . length ; i ++ ) { var link = links [ i ] ; if ( link . classList . contains ( "external" ) ) continue ; var page = link . getAttribute ( "data-tab" ) ; if ( ! page ) continue ; if ( ! openPage ) openPage = page ; if ( ! first ) first = link ; var subtab = document . getElementById ( "tab-" + page ) ; if ( ! subtab ) continue ; var show = page == openPage ; upgradeSubtabPage ( subtab , page , show ) ; if ( show ) { link . classList . add ( "active" ) ; gotActive = true ; } else link . classList . remove ( "active" ) ; } if ( ! gotActive && first ) { first . classList . add ( "active" ) ; var page = first . getAttribute ( "data-tab" ) ; upgradeSubtabPage ( document . getElementById ( "tab-" + page ) , page , true ) ; } }
@param {HTMLElement} subtabs
 @param {string} [openPage] the page to open by default or undefined to resolve from hash.
@param { HTMLElement } subtabs @param { string } [ openPage ] the page to open by default or undefined to resolve from hash .