function plus(obj) {
	if (obj.nextSibling.style.display=='none') {
		obj.nextSibling.style.display='inline'
	} else {
			obj.nextSibling.style.display='none'
	}
}

function minus(obj) {
	obj.style.display='none'
}

function plusAll() {
	var x = document.getElementsByClassName('plusinfo');
	var i;
	for (i = 0; i < x.length; i++) {
		x[i].style.display='inline';
	}
}

function plusAdv() {
	minusAll();
	var x = document.getElementsByClassName('a');
	var i;
	for (i = 0; i < x.length; i++) {
		x[i].style.display='inline';
	}
}

function minusAll() {
	var x = document.getElementsByClassName('plusinfo');
	var i;
	for (i = 0; i < x.length; i++) {
		x[i].style.display='none';
	}
}

function plusParentNode(obj) {
	var x = obj.parentNode.getElementsByClassName('plusinfo');
	var i;
	for (i = 0; i < x.length; i++) {
		x[i].style.display='inline';
	}
}

function advParentNode(obj) {
	minusParentNode(obj);
	var x = obj.parentNode.getElementsByClassName('a');
	var i;
	for (i = 0; i < x.length; i++) {
		x[i].style.display='inline';
	}
}

function minusParentNode(obj) {
	var x = obj.parentNode.getElementsByClassName('plusinfo');
	var i;
	for (i = 0; i < x.length; i++) {
		x[i].style.display='none';
	}
}

function setRevealLevelSelect() {
	if (typeof(Storage) !== "undefined") {
		switch (localStorage.revealLevel) {
			case "📖 Reveal All":
				document.getElementById("revealLevelSelect").selectedIndex = 0;
				break;
			case "📄 Reveal Advanced":
				document.getElementById("revealLevelSelect").selectedIndex = 1;
				break;
			case "📘 Reveal None":
				document.getElementById("revealLevelSelect").selectedIndex = 2;
				break;
		}
	}
}

function changeRevealLevel(selectTag) {
	switch (selectTag.options[selectTag.selectedIndex].text) {
		case "📖 Reveal All":
			plusAll();
			break;
		case "📄 Reveal Advanced":
			plusAdv();
			break;
		case "📘 Reveal None":
			minusAll();
			break;
	}

	if (typeof(Storage) !== "undefined") {
		localStorage.revealLevel = selectTag.options[selectTag.selectedIndex].text;
	}
}

function setRevealLevel() {
	// if localStorage is supported, set according to localStorage.revealLevel
	if (typeof(Storage) !== "undefined") { // check browser support for localStorage

		// Code for localStorage/sessionStorage.
		// initialize if necessary
		if (!localStorage.revealLevel) {
			localStorage.revealLevel = "📄 Reveal Advanced";
		}

		// set according to localStorage.revealLevel
		switch (localStorage.revealLevel) {
			case "📖 Reveal All":
				plusAll();
				break;
			case "📄 Reveal Advanced":
				plusAdv();
				break;
			case "📘 Reveal None":
				minusAll();
				break;
		}

		setRevealLevelSelect();
	}
	else {
		// if localStorage is not supported, set to Reveal Advanced
		plusAdv();
		document.getElementById("revealLevelSelect").selectedIndex = 1;
	}
}

// on page load
setRevealLevel()
